Skip to content

Instantly share code, notes, and snippets.

@x3rAx
x3rAx / # SSH-Agent.md
Last active April 27, 2024 12:47
SSH Agent

Note:

Replace @ with / in filenames.

Set up your .bashrc to use .shellrc.d.

Make sure ssh-agent, ps and awk are installed and that $USER is set to your username.

@x3rAx
x3rAx / # Shellrc.d #.md
Last active April 27, 2024 12:47
Setup instructions for `~/.shellrc.d/`

Shellrc.d

Setup

Create the directory ~/.shellrc.d

mkdir ~/.shellrc.d

@ofou
ofou / servers.csv
Created April 11, 2021 06:15
List of servers to test speedtest-cli
We can't make this file beautiful and searchable because it's too large.
Country,City,Provider,Host,ID
Abkhazia,Sukhum,Aquafon GSM,62.182.8.78:8080,9058
Abkhazia,Sukhum,"Systema, LTD",cyxym.net:8080,5089
Abkhaziya,Sukhum,A-Mobile,speedtest.a-mobile.biz:8080,9714
Afghanistan,Herat,Afghan Wireless,hrtspeedtest.afghan-wireless.com:8080,9622
Afghanistan,Kabul,Afghan Telecom,sp1.afghantelecom.af:8080,11019
Afghanistan,Kabul,etisalat Afghanistan,speedtest.etisalat.af:8080,21807
Afghanistan,Kabul,Afghan Wireless,speedtest.afghan-wireless.com:8080,5189
Afghanistan,Kabul,Afghan Wireless Communication Company,kdzspeedtest.afghan-wireless.com:8080,13501
Afghanistan,Kabul,Insta Telecom,speedtest.instatelecom.com:8080,12798
@mattysmith22
mattysmith22 / Dfa.hs
Created July 18, 2020 16:24
Deterministic Finite Automaton implementation in Haskell
module Dfa (DFA, State, transition, runString, match, findEquivalent, nequivalent, automaton1, automaton2, minimise) where
import Data.List
import Text.Layout.Table
type State = Int
data DFA = DFA
{ states :: [State]
, initial :: State
, final :: [State]
@xameeramir
xameeramir / default nginx configuration file
Last active April 27, 2024 12:35
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@davidhq
davidhq / gist:3556485
Created August 31, 2012 17:51
Unpermute (reverse Burrows-Wheeler transform)
# calculates BW(T)
def bw(t):
m = sorted(t[-i:] + t[:-i] for i in range(len(t)))
return "".join(m[i][len(t)-1] for i in range(len(t)))
# for a given string return index with nth occurence of char
def n_occurence_index(string, char, n):
vector = [string[:index+1].count(char) for index in range(0, len(string))]
return vector.index(n)
@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.