Skip to content

Instantly share code, notes, and snippets.

View puzza007's full-sized avatar
💭
💅

Paul Oliver puzza007

💭
💅
View GitHub Profile
@puzza007
puzza007 / binary_xor.erl
Last active August 29, 2015 13:56
bxor a binary k against a (longer) binary value
-module(foo).
-export([b/2]).
b(K, B) when is_binary(K) andalso
is_binary(B) andalso
byte_size(K) =< byte_size(B) ->
SizeB = byte_size(B),
N = (SizeB div byte_size(K)) + 1,
K2 = lists:duplicate(N, K),
@puzza007
puzza007 / borsuk.txt
Created February 18, 2014 09:16
Etymology of the word Borsuk
Proto-Turkic: *borsuk, *borsmuk
Meaning: badger
Russian meaning: барсук
Karakhanid: borsmuq (MK), borsuq (MK Oghuz)
Turkish: porsuk
Tatar: bursɨq
Middle Turkic: porsuq (Sangl.)
Uzbek: bɔrsiq
Uighur: borsuq

Keybase proof

I hereby claim:

  • I am puzza007 on github.
  • I am puz (https://keybase.io/puz) on keybase.
  • I have a public key whose fingerprint is 708A 0D1E 0024 1407 5F80 91F4 B3A7 C000 6790 E7EA

To claim this, I am signing this object:

@puzza007
puzza007 / gist:a658ba1b90cecc8ca280
Created May 11, 2015 10:05
A message to Benedict Arnold
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v2.0.8
Comment: https://keybase.io/crypto
wcBMA1CKWgaC/3qoAQf/b0X45MfjyO0ilvfYpMU86ygicPRDT071M5KrRHw2tBoy
AJViGWPVXdb/NSoc1U/veMgV+VkMKn0iTASAJoFk3RITWM4becJOqi/XjN2pToq9
PBfymlhP2KlRQ6WK5dDILB3+dINSBCr4PjUY2tVgVsXyCaKbJ1+xYD1kSJKwKU0x
SOYF6X1wkHgk1yeTpekFuD0MqUicDfmQUUSo/FMO57xuZSOsVP95hSoOvYL20O+d
1nfHywMyjH4xYG9wWGJFcJR/cEQGBiwAq/+NN2rMq9bW02PnlsSCt9SvVCwnAhj3
f5CfhIxd1dA+B2Vu/O8ovTMhqH4Xh/9nFxd6J/yI9MHBTAOSUAaeiva/TwEP/3s4
redis device-cache-stage.ygmmk0keys network*
1) "network:63325842-b606-442c-8537-778b15cc86f9"
2) "network:b5c26a1a-f3f2-45ae-8558-7a6773527cbd"
3) "network:46850009-cef7-4703-8877-29a2577f6d1d"
4) "network:351e7e43-6648-416b-b982-e59ccd968ba1"
5) "network:afe5ef70-4765-48dd-8ffa-bca98ec8a087"
6) "network:37e30236-3608-4182-b4b5-1b0e8f599b3b"
7) "network:cc67395a-3cc5-4082-9f8d-eedee3b91b4a"
8) "network:4528d91c-e9d6-437c-857f-e9760088fb25"
redis device-cache-stage.ygmmk0
@puzza007
puzza007 / Makefile
Last active August 29, 2015 14:23
hiperfifo.c Makefile
TARGET = hiperfifo
OBJS= hiperfifo.o
CC = gcc
CFLAGS = -c -g
# This should point to a directory that holds libcurl, if it isn't
# in the system's standard lib dir
puzza@MacBook-Pro ~/src/katipo (master*) $ lldb ./priv/katipo --core /cores/core.35417
(lldb) target create "./priv/katipo" --core "/cores/core.35417"
warning: (x86_64) /cores/core.35417 load command 83 LC_SEGMENT_64 has a fileoff + filesize (0x20198000) that extends beyond the end of the file (0x20197000), the segment will be truncated to match
warning: (x86_64) /cores/core.35417 load command 84 LC_SEGMENT_64 has a fileoff (0x20198000) that extends beyond the end of the file (0x20197000), ignoring this section
Core file '/cores/core.35417' (x86_64) was loaded.
Process 0 stopped
* thread #1: tid = 0x0000, 0x00007fff8af1b286 libsystem_kernel.dylib`__pthread_kill + 10, stop reason = signal SIGSTOP
frame #0: 0x00007fff8af1b286 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff8af1b286 <+10>: jae 0x7fff8af1b290 ; <+20>
puzza@MacBook:~/src/mochiweb-read-only/ebin$ erl
Erlang R13B02 (erts-5.7.3) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.3 (abort with ^G)
1> mochihex:to_bin("FEDCBA9876543210").
<<254,220,186,152,118,84,50,16>>
2> mochihex:to_hex(mochihex:to_bin("FEDCBA9876543210")).
"fedcba9876543210"
3> mochihex:to_bin("37363534333231204E6F77206973207468652074696D6520666F722000").
<<55,54,53,52,51,50,49,32,78,111,119,32,105,115,32,116,
@puzza007
puzza007 / bf_test.erl
Created October 13, 2009 15:26
Test module for crypto blowfish functions
-module(bf_test).
%% Test vectors from http://www.schneier.com/code/vectors.txt
%% I've used this on the command-line
-export([to_bin/1]).
-include_lib("eunit/include/eunit.hrl").
-define(KEY, to_bin("0123456789ABCDEFF0E1D2C3B4A59687")).
%%
%% Simple pool for gen_servers that only use :call
%%
-module(gen_server_call_pool).
-behaviour(gen_server).
%% --------------------------------------------------------------------
%% External exports
-export([start_link/3, stats/1]).