Skip to content

Instantly share code, notes, and snippets.

@cgag
cgag / kibit.clj
Last active December 11, 2015 17:58
(ns kibbittest.core)
(if true
::test
nil)
===
Consider using:
(when true :user/test)
@cgag
cgag / recur.clj
Created January 9, 2013 14:29
Clojure recur example
(defn naive-sum [n]
(if (= n 0)
0
(+ n (naive-sum (dec n)))))
(defn recur-sum [n]
(loop [acc 0
cnt n]
(if (= cnt 0)
acc
@cgag
cgag / gist:3172590
Created July 24, 2012 20:51
wasdfwf
bash "restart storm processes" do
action :nothing
code <<-EOH
echo "Restarting storm processes"
jps | grep "worker\|supervisor" | awk '{print $1}' | xargs kill
EOH
end
@cgag
cgag / gist:d0c712d84960458f7501
Created September 7, 2015 22:28
attemping to build neovim on void linux. Fixed by symlinking /bin/sh to bash
inja -C .deps
ninja: Entering directory `.deps'
[1/25] Performing build step for 'unibilium'
[2/25] No patch step for 'luarocks'
[3/25] Performing install step for 'libvterm'
[4/25] No update step for 'luarocks'
[5/25] Performing configure step for 'luarocks'
FAILED: cd /home/cgag/tmp/neovim/.deps/build/src/unibilium && /usr/bin/make CC=/usr/bin/cc PREFIX=/home/cgag/tmp/neovim/.deps/usr CFLAGS=-fPIC && /usr/bin/cmake -E touch /home/cgag/tmp/neovim/.deps/build/src/unibilium-stamp/unibilium-build
make[1]: Entering directory '/home/cgag/tmp/neovim/.deps/build/src/unibilium'
libtool --mode=compile --tag=CC /usr/bin/cc -I. -Wall -std=c99 -fPIC -o unibilium.lo -c unibilium.c

Things that programmers don't know but should

(A book that I might eventually write!)

Gary Bernhardt

I imagine each of these chapters being about 2,000 words, making the whole book about the size of a small novel. For comparison, articles in large papers like the New York Times average about 1,200 words. Each topic gets whatever level of detail I can fit into that space. For simple topics, that's a lot of space: I can probably walk through a very basic, but working, implementation of the IP protocol.

@cgag
cgag / TrueColor.md
Last active August 29, 2015 14:18 — forked from XVilka/TrueColour.md

Colors in terminal

It's a common confusion about terminal colors... Actually we have this:

  • plain ascii
  • ansi escape codes (16 color codes with bold/italic and background)
  • 256 color palette (216 colors+16gray + ansi) (colors are 24bit)
  • 24bit true color (888 colors (aka 16 milion))
    printf "\x1b[${bg};2;${red};${green};${blue}m\n"
    
@cgag
cgag / gist:0afef1fe2bbd701de6ff
Created March 21, 2015 07:59
zsh config found on pastebin
alias ls='ls --tabsize=0 --literal --show-control-chars --color=always --human-readable'
alias grep='grep --color=auto'
alias cp='cp --interactive'
alias mv='mv --interactive'
alias rm='rm --interactive'
alias ll='ls -lhX'
alias la='ls -lAhX'
alias l='ll -S'
alias less='less --quiet'
alias df='df --human-readable'
@cgag
cgag / gist:f6304367a8625d800067
Last active August 29, 2015 14:06
plivo test
<Response>
<Dial callerId="18004321321">
<Number>16184021401</Number>
</Dial>
</Response>
@cgag
cgag / gruntfile.js
Created July 14, 2014 20:42
purescript psc gruntfile
module.exports = function(grunt) {
"use strict";
grunt.initConfig({
psc: {
options: {
main: "Mymodule.Main",
modules: ["Mymodule.Main"]
},
@cgag
cgag / purescript-alert
Created July 12, 2014 22:54
purescript alert ffi
module FFI.Test where
import Control.Monad.Eff
import Debug.Trace
foreign import data Alert :: !
foreign import alert
"function alert(s) { \
\ return function() { \