Skip to content

Instantly share code, notes, and snippets.

View nilz3ro's full-sized avatar
🧃

nil nilz3ro

🧃
View GitHub Profile
@nilz3ro
nilz3ro / langs.txt
Last active February 8, 2017 14:20
Hello, Worlds.
c
c#
c++
clojure
common lisp
crystal
dart
elixir
erlang
eve
@nilz3ro
nilz3ro / .tmux.conf
Created August 31, 2016 17:48
Tmux Conf
set -g default-terminal "screen-256color"
set -s escape-time 0
set -g prefix C-a
bind C-a send-prefix
unbind C-b
set -g mouse on
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
@nilz3ro
nilz3ro / commit_commenter.rb
Last active June 5, 2017 19:20
Add the latest commit hash to a given file, as an html comment.
require 'fileutils'
class CommitCommenter
def initialize(git_project_path)
@project_path = git_project_path.chomp
end
def latest_commit_hash
FileUtils.cd(@project_path)
return `git rev-parse HEAD`.chomp
@nilz3ro
nilz3ro / lambda.js
Created July 14, 2016 02:01
lambda expressions / currying in es6
((n) => ((y) => y*n))
// [Function]
((n) => ((y) => y*n))(9)
// [Function]
((n) => ((y) => y*n))(9)(3)
// 27
@nilz3ro
nilz3ro / ws.md
Last active February 27, 2016 04:36
WebSocket Notes

Notes

WebSocket Protocol is an Application Layer protocol that enables a client and server to send and receive messages simultaneously through a full duplex stream over one TCP/IP connection on port 80 or 443.

Default WebSocket protocol client request, and server response:

  • send HTTP/1.1 GET
    GET /chat HTTP/1.1
    
    Host: server.example.com
    
# Path to your oh-my-zsh installation.
export ZSH=/Users/abuddington/.oh-my-zsh
source /usr/local/share/chruby/chruby.sh
source /usr/local/opt/chruby/share/chruby/auto.sh
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
alias be="bundle exec"
alias gs="git status"
set -g default-terminal "screen-256color"
set -g status-bg white
set -g status-fg black
set -g pane-border-style fg=black
set -g pane-active-border-style fg=white
set -g pane-active-border-style bg=black
# remap prefix to Control + a
set -g prefix C-a
# bind 'C-a C-a' to type 'C-a'
@nilz3ro
nilz3ro / max-integer-by-bit.go
Created December 21, 2015 07:15
Wondering what the maximum integer value is in the go language? Wonder no more!!!
package main
import "fmt"
const (
MaxInt8 = 1<<7 - 1 // 127
MinInt8 = -1 << 7
MaxInt16 = 1<<15 - 1 // 32_767
MinInt16 = -1 << 15
MaxInt32 = 1<<31 - 1 // 2_147_483_647
MinInt32 = -1 << 31
@nilz3ro
nilz3ro / iso.countries.js
Last active November 18, 2023 05:38
Write json file
// Paste this in a node v4.x REPL.
// let iso = require('./iso.countries.js');
// iso.writeCountryJsonFile('test.js', (country) => { let o={}; o['name'] = country['name']; o['ISO3166-1-Alpha-2'] = country['ISO3166-1-Alpha-2']; o['code'] = country['ISO3166-1-Alpha-2']; o['Dial'] = country['Dial']; return o;});
'use strict';
let fs = require('fs');
let countries;
const writeCountryJsonFile = (outputFilename, mapFunction) => {
@nilz3ro
nilz3ro / brew.txt
Last active September 21, 2016 02:09
ack
autoconf
automake
aws-elasticbeanstalk
awscli
bdw-gc
boot-clj
cairo
chgems
chrome-cli