Skip to content

Instantly share code, notes, and snippets.

@cpq
cpq / Stack.md
Last active April 27, 2024 12:27
Why stack grows down

Why stack grows down

Any running process has several memory regions: code, read-only data, read-write data, et cetera. Some regions, such as code and read-only data, are static and do not change over time. Other regions are dynamic: they can expand and shrink. Usually there are two such regions: dynamic read-write data region, called heap, and a region called stack. Heap holds dynamic memory allocations, and stack is mostly used for keeping function frames.

Both stack and heap can grow. An OS doesn't know in advance whether stack or heap will be used predominantly. Therefore, an OS must layout these two memory regions in a way to guarantee maximum space for both. And here is the solution:

  1. Layout static memory regions at the edges of process's virtual memory
  2. Put heap and stack on edges too, and let them grow towards each other: one grows up, one grows down
@webinista
webinista / RunAProxyOnAmazonEC2VPC.md
Last active April 27, 2024 12:21
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@benlubas
benlubas / telescope_action_harpoon_mark.lua
Last active April 27, 2024 12:21
Harpoon mark files from telescope picker
M = {}
local telescope_utils = require("telescope.actions.utils")
local utils = require("telescope.actions.utils")
local actions = require("telescope.actions")
M.mark_file = function(tb)
actions.drop_all(tb)
actions.add_selection(tb)
telescope_utils.map_selections(tb, function(selection)
@yinzara
yinzara / github_bitbucket_multiple_ssh_keys.md
Last active April 27, 2024 12:21
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

@NehemiahLimo
NehemiahLimo / Visual Studio 2015
Last active April 27, 2024 12:20
Product keys for Visual Studio 2015
Visual Studio Professional 2015
Key : HMGNV-WCYXV-X7G9W-YCX63-B98R2
Visual Studio Enterprise 2015
Key :HM6NR-QXX7C-DFW2Y-8B82K-WTYJV
Visual Studio Enterprise 2015
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active April 27, 2024 12:24
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@nntrn
nntrn / espn-api-list.md
Last active April 27, 2024 12:15
List of nfl api endpoints from espn

List of NFL API Endpoints

This page has been updated a lot in the past 3 years. Older revisions you might like more than this one:

  • June 2021 - list of endpoints for other sports/leagues (i.e. basketball, baseball, lacrosse, rugby)
  • August 2021 - get historical fantasy league data
  • September 2021 - list of endpoints in plain text
  • May 2023 - collapsed endpoint response examples

Additional Resources

@straker
straker / README.md
Last active April 27, 2024 12:11
Basic Snake HTML and JavaScript Game

Basic Snake HTML and JavaScript Game

Snake is a fun game to make as it doesn't require a lot of code (less than 100 lines with all comments removed). This is a basic implementation of the snake game, but it's missing a few things intentionally and they're left as further exploration for the reader.

Further Exploration

  • Score
  • When the snake eats an apple, the score should increase by one. Use context.fillText() to display the score to the screen
@mlocati
mlocati / exceptions-tree.php
Created March 9, 2017 10:58
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');