Skip to content

Instantly share code, notes, and snippets.

@aktau
aktau / 32.asm
Created August 31, 2014 09:01 — forked from desertmonad/32.asm
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The .data section is for storing and naming constants.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section .data
msg: db "Hello world!", 10
.len: equ $ - msg
#if defined(__GNUC__)
#include <stdint.h>
#include <cpuid.h>
#elif defined(_WIN32)
#include <intrin.h>
typedef unsigned __int32 uint32_t;
#endif
#include <stdio.h>
/**

How to connect a PS3 controller to a different machine (PS3, Mac, PC)

You will need a Mini USB cable. Overcome your laziness and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It doesn't! From my testing, the controller pairs with the last machine it was CONNECTED VIA A USB CABLE.

Here are the real Steps:

  1. Turn OFF your PS3 controller by either...
@aktau
aktau / .bashrc
Last active August 29, 2015 14:01 — forked from tarruda/.bashrc
Also works in .zshrc
# Start working on a pull request, this requires a .git/user-repo file
# containing the string "user/repository"
pr () {
if [[ ! -r .git/user-repo ]]; then
echo "Need to setup user/repo" >&2
return 1
fi
local user_repo=$(< .git/user-repo)
local pr_num=$1
if [[ -z $pr_num ]]; then
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <emmintrin.h>
/*
* Round up n to the next multiple of m.
* m needs to be a power of 2.
*/
@aktau
aktau / lisp.c
Created April 4, 2014 19:25 — forked from sanxiyn/lisp.c
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
##
## 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() {
#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#
program_exists () {
type "$1" &> /dev/null ;
}
if program_exists go; then
local ffi = require("ffi")
ffi.cdef[[
typedef void (*cb)(void);
void call(int n, void (*)(void));
void loop(int n);
void func(void);
]]
local callback = ffi.load("./callback.so")
local timeit = require("timeit")