Skip to content

Instantly share code, notes, and snippets.

View rsp's full-sized avatar

Rafał Pocztarski rsp

View GitHub Profile
@rsp
rsp / git-change-url
Created March 16, 2016 17:18 — forked from sankalp-khare/git-change-url
Changes the git url type from https to ssh or vice versa
#!/usr/bin/env bash
# Utility to change the connection method for a git repo.
# === Colour Definitions ===
red='\e[0;31m'
green='\e[0;32m'
purple='\e[0;35m'
orange='\e[0;33m'
# No Color, i.e. turn off color
@rsp
rsp / text-editors.md
Last active September 21, 2023 20:51
Text Editors
@rsp
rsp / get-node-6.7.0.md
Last active May 3, 2019 17:26
How to get Node 6.7.0 on Linux

How to get Node 6.7.0 on Linux

How to get a specific version of Node on Linux, on the example of Node 6.7.0

Written for this question on Stack Overflow: Nodejs - DeprecationWarning process.EventEmitter is deprecated

If you don't have any Node version installed yet but you want to have it installed globally, it may be easiest to install it in /usr/local as /usr/local/bin is likely already present in your PATH.

If you want to install it in addition to a version of Node that is installed on the system, then maybe /opt/node or /opt/node-6.7.0 would be a better place to install it.

@rsp
rsp / .tmux.conf
Last active December 12, 2023 19:50 — forked from spicycode/tmux.conf
The best and greatest tmux.conf ever - improved!
# The best and greatest tmux.conf ever - improved!
# https://gist.github.com/rsp/f4770a1fe8ea7e2378ac3a16e01a2b53
# Here are some customizations done by Rafał Pocztarski:
# use Ctrl+Backslash instead of Ctrl+A or Ctrl+B
# use Slash to split vertically
# use Backslash to split horizontally
unbind-key C-b
set -g prefix 'C-\'
bind-key 'C-\' send-prefix
@rsp
rsp / statuses.md
Created April 21, 2017 08:51 — forked from vkostyukov/statuses.md
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507
@rsp
rsp / languagewars-churchnumerals-lambda.txt
Last active November 6, 2017 05:13
Language Wars - Church numerals - untyped lambda calculus
suc = λa.λb.λc.b (a b c)
add = λa.λb.λc.λd.a c (b c d)
mul = λa.λb.λc.a (b c)
exp = λa.λb.b a
pre = λa.λb.λc.a (λd.λe.e (d b)) (λf.c) (λg.g)
sub = λa.λb.b pre a
@rsp
rsp / languagewars-churchnumerals-es6.js
Created November 6, 2017 04:28
Language Wars - Church numerals - ES6 JavaScript
const suc = a => b => c => b(a(b)(c));
const add = a => b => c => d => a(c)(b(c)(d));
const mul = a => b => c => a(b(c));
const exp = a => b => b(a);
const pre = a => b => c => a(d => e => e(d(b)))(f => c)(g => g);
const sub = a => b => b(pre)(a);
const ntc = n => n > 0 ? a => b => a(ntc(n - 1)(a)(b)) : a => b => b;
const ctn = a => a(x => x + 1)(0);
@rsp
rsp / languagewars-churchnumerals-js.js
Created November 6, 2017 04:30
Language Wars - Church numerals - legacy JavaScript
var suc = function (a) {
return function (b) {
return function (c) {
return b(a(b)(c));
};
};
};
var add = function (a) {
return function (b) {
return function (c) {
@rsp
rsp / languagewars-churchnumerals-scheme.scm
Created November 6, 2017 04:32
Language Wars - Church numerals - Scheme
(define suc (lambda (a) (lambda (b) (lambda (c) (b ((a b) c))))))
(define add (lambda (a) (lambda (b) (lambda (c) (lambda (d) ((a c) ((b c) d)))))))
(define mul (lambda (a) (lambda (b) (lambda (c) (a (b c))))))
(define exp (lambda (a) (lambda (b) (b a))))
(define pre (lambda (a) (lambda (b) (lambda (c)
(((a (lambda (d) (lambda (e) (e (d b))))) (lambda (f) c)) (lambda (g) g))))))
(define sub (lambda (a) (lambda (b) ((b pre) a))))
(define ntc (lambda (n) (if (> n 0)
(lambda (a) (lambda (b) (a (((ntc (- n 1)) a) b))))
(lambda (a) (lambda (b) b)))))
// Applies x() 1 time:
function input1(x) {
return function (y) {
return x(y);
};
}
// Applies x() 2 times:
function input2(x) {
return function (y) {