Skip to content

Instantly share code, notes, and snippets.

View ashnur's full-sized avatar
🐢
fragments of scrolls surround me

Aron Gabor ashnur

🐢
fragments of scrolls surround me
View GitHub Profile
@ashnur
ashnur / .gitconfig
Created July 12, 2019 16:34 — forked from 0livare/.gitconfig
My git alias list. Running 'git alias' will pretty-print these commands to the terminal.
[alias]
# === Common Commands ===
s = status # Shortcut for status
b = branch # Shortcut for branch
a = add # Shortcut for add
d = difftool # Shortcut for difftool
m = mergetool # Shortcut for mergetool
f = fetch --all --prune
po = push origin # Shortcut for push origin
@ashnur
ashnur / todo.js
Created March 18, 2019 18:17 — forked from WebReflection/todo.js
Web Components, the React way, without Shadow DOM
// https://hackernoon.com/web-components-the-react-way-8ed5b6f4f942#.5em3zpgin
const store = (() => {
let state;
return todos => {
if (todos) {
state = todos;
render("todo-list");
}
return state;
};
@ashnur
ashnur / no-hackerrank.md
Created February 26, 2018 14:56 — forked from fasiha/no-hackerrank.md
A prospective employer invited me to do a HackerRank test. Here's my proposed alternative.
To: recruitment@EmployerABC.com
From: Ahmed Fasih
Subject: Re: Programming Test Invitation

Hi there! Thanks for offering to let me take a HackerRank test for ABC, I appreciate the vote of confidence.

I'd never heard of HackerRank, but after you wrote two other employers sent me their own HackerRank tests. Having worked on those tests first (I considered them practice, for the real thing with ABC :), I'd like to check if you have flexibility in finding an alternative way to evaluate my basic coding chops.

This is because, as functional programmer and author Paul Chiusano says, "Programming is all about managing complexity" [1], but HackerRank is quite bad at measuring my ability to manage complexity. It asks for small algorithmic coding puzzles to be done in unnatural conditions including (1) time limits, (2) forbidding research on Wikipedia or StackOverflow, (3) forbidding collaboration, and (4) forbidding the use of libraries (Python and JavaScript e.g. are so different when confined to thei

@ashnur
ashnur / keycloak.sh
Created November 10, 2017 18:10 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@ashnur
ashnur / netst
Created October 2, 2017 10:10 — forked from thusoy/netst
Windows equivalent of netstat -tulpn
#!/bin/bash
# Normally windows doesn't give out the process name when you run netstat -ano, thus making it
# hard to figure out what process is bound to the different ports. This script extracts the PID
# from the netstat output, and fetches the corresponding binary name from the tasklist, and
# merges the two together. Needs a MinGW environment like Git Bash and python to work.
{ tasklist | tail -n +5; echo ===; netstat -ano | grep LIST; } | python -c "
import sys
pad = [0, 21, 9, 0, 5, 8, 0]
@ashnur
ashnur / netst
Created October 2, 2017 10:10 — forked from thusoy/netst
Windows equivalent of netstat -tulpn
#!/bin/bash
# Normally windows doesn't give out the process name when you run netstat -ano, thus making it
# hard to figure out what process is bound to the different ports. This script extracts the PID
# from the netstat output, and fetches the corresponding binary name from the tasklist, and
# merges the two together. Needs a MinGW environment like Git Bash and python to work.
{ tasklist | tail -n +5; echo ===; netstat -ano | grep LIST; } | python -c "
import sys
pad = [0, 21, 9, 0, 5, 8, 0]
@ashnur
ashnur / web-servers.md
Created November 27, 2016 20:28 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@ashnur
ashnur / common-consensus-protocols.md
Created October 10, 2016 21:19 — forked from nerdfiles/common-consensus-protocols.md
Common Consensus Protocols

Common Consensus Protocols

Infocologically-sane consensus protocols must satisfy the following conditions:

Factivity Order        : False information is not stored.  
                         (Rollback)  
                         √ Persistence

Motive Order           : Only purposeful information is stored.  

(Recovery/Checkpointing)

@ashnur
ashnur / git_notes.md
Created April 6, 2016 03:34 — forked from jaygooby/git_notes.md
Git, you bloody git

Ignore line-ending differences when diffing

(You can't use this with git difftool or merge though)

git diff --ignore-space-at-eol

Prefer one branch over another when merging

@ashnur
ashnur / ReplicatedRandomChrome.js
Created September 25, 2015 10:12 — forked from fta2012/ReplicatedRandomChrome.js
Demonstrates how to replicate a stream of Math.random() given two past observations for **Chrome**. Code was only tried on Chrome 43 (07/2015). Answers the question from this issue: https://github.com/fta2012/ReplicatedRandom/issues/2.
var rngstate;
function MathRandom() {
// Our own implementation of Math.random().
// Source code was copied from https://code.google.com/p/chromium/codesearch#chromium/src/v8/src/math.js&q=MathRandom&sq=package:chromium&type=cs&l=130
// You need to solve for the rngstate first before this can be used.
console.assert(rngstate, "You need to set the global variable `rngstate` first. For example: `rngstate = solve(Math.random(), Math.random());`");
if (!rngstate) return;
var r0 = (Math.imul(18030, rngstate[0] & 0xFFFF) + (rngstate[0] >>> 16)) | 0;
rngstate[0] = r0;
var r1 = (Math.imul(36969, rngstate[1] & 0xFFFF) + (rngstate[1] >>> 16)) | 0;