Skip to content

Instantly share code, notes, and snippets.

@aktau
aktau / luaposix-error.sh
Created February 22, 2014 12:48
homebrew: error while installing luaposix
➜ local git:(master) luarocks install luaposix
Installing http://www.luarocks.org/repositories/rocks/luaposix-31-1.src.rock...
Using http://www.luarocks.org/repositories/rocks/luaposix-31-1.src.rock... switching to 'build' mode
Missing dependencies for luaposix:
luabitop >= 1.0.2
Using http://www.luarocks.org/repositories/rocks/luabitop-1.0.2-1.src.rock... switching to 'build' mode
export MACOSX_DEPLOYMENT_TARGET=10.5; gcc -O2 -fPIC -I/usr/local/include/luajit-2.0 -c bit.c -o bit.o
export MACOSX_DEPLOYMENT_TARGET=10.5; gcc -bundle -undefined dynamic_lookup -all_load -o bit.so -Lluajit/lib bit.o
@aktau
aktau / style.c
Last active August 29, 2015 13:56
aktau C-style
/**
* This file is part of neovim.
*
* (c) 2014 The neovim authors
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with the source code.
*
* It might be handy to define a few macro's for early quit, which could save a
* lot of lines. Many projects define such things and it increases readability if
@aktau
aktau / vim_source_analysis.md
Created March 5, 2014 12:11
vim_source_analysis.md

Vim refactoring

Analyse how f_system works (the VimL system call).

eval.c: f_system()

infile = NULL if arg[1].v_type is not VAR_UNKNOWN:

  • this is an input string
@aktau
aktau / sse.go
Created March 20, 2014 12:57
Server-Sent-Events client in Go
package main
import (
"bufio"
"bytes"
"crypto/tls"
"encoding/json"
"fmt"
"log"
"net"
##
## Simple password management in ksh-compatible shell
## You'll need a unix-like system and a working GPG configuration
export GPG_KEY=""
function pwgrep() {
gpg --batch -q -d -r $GPG_KEY $HOME/.auth/pwdb.asc | grep $*
}
function pwcat() {
@aktau
aktau / pcc-make-install.sh
Created April 1, 2014 10:45
Where does the PCC place its files after `make install` on OSX?
cd cc && /Applications/Xcode.app/Contents/Developer/usr/bin/make install
cd cc && /Applications/Xcode.app/Contents/Developer/usr/bin/make install
test -z "/usr/local/bin" || mkdir -p "/usr/local/bin"
/usr/local/bin/ginstall -c pcc /usr/local/bin
strip /usr/local/bin/pcc
test -z "/usr/local/share/man/man1" || mkdir -p "/usr/local/share/man/man1"
/usr/local/bin/ginstall -c ./cc.1 /usr/local/share/man/man1/pcc.1
test -z "/usr/local/lib/pcc/i386-apple-darwin13.1.0/1.0.0.RELEASE/include" || mkdir -p "/usr/local/lib/pcc/i386-apple-darwin13.1.0/1.0.0.RELEASE/include"
test -z "/usr/local/lib/pcc/i386-apple-darwin13.1.0/1.0.0.RELEASE/lib" || mkdir -p "/usr/local/lib/pcc/i386-apple-darwin13.1.0/1.0.0.RELEASE/lib"
cd cpp && /Applications/Xcode.app/Contents/Developer/usr/bin/make install
@aktau
aktau / pcc.rb
Created April 1, 2014 13:36
Maybe someday, when it supports 64-bit darwin... The portable C compiler (pcc)
require "formula"
# Documentation: https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook
# /usr/local/Library/Contributions/example-formula.rb
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Pcc < Formula
homepage "http://pcc.ludd.ltu.se"
url "http://pcc.ludd.ltu.se/ftp/pub/pcc-releases/pcc-1.0.0.tgz"
sha1 "a994d6bf75ae81add70d35478b59fca7c63bd5df"
@aktau
aktau / unicode.md
Last active August 29, 2015 14:00
Links on unicode

References

These are absolutely fantastic references for anyone who wants to clear up all doubts regarding unicode and its most important encodings (utf-8, utf-16 and utf-32).

The Big One

Read this if you're feeling masochistic, or want to know everything a human being would possibly want to know (or can know) about unicode.

@aktau
aktau / clang34-int.s
Last active August 29, 2015 14:00
Which part of the register is used?
.section __TEXT,__text,regular,pure_instructions
.globl _main
.align 4, 0x90
_main: ## @main
.cfi_startproc
## BB#0:
pushq %rbp
Ltmp2:
.cfi_def_cfa_offset 16
Ltmp3: