Skip to content

Instantly share code, notes, and snippets.

View jedisct1's full-sized avatar

Frank Denis jedisct1

View GitHub Profile
@jedisct1
jedisct1 / const_pnt_vs_const_array.txt
Created September 17, 2011 20:50
const char * vs const char []
#include <string.h>
size_t zob1(const char *c)
{
const char *s = "abcdefghijklmnopqrstuvwxyz";
return strspn(c, s);
}
size_t zob2(const char *c)
{
@jedisct1
jedisct1 / spinlocks.h
Created October 13, 2011 22:22
My trivial userland spinlock implementation
#ifndef SPINLOCKS_H
#define SPINLOCKS_H
#include <unistd.h>
typedef volatile char spinlock_t;
#if defined(__x86_64__) || defined(__i386) || defined(_X86_)
# define CPU_PAUSE __asm__ ("pause")
@jedisct1
jedisct1 / edns payload sizes.txt
Created November 11, 2011 16:36
EDNS payload sizes of outgoing queries to the same resolver - Just different apps running on the same host
edns payload size: none
edns payload size: none
edns payload size: none
edns payload size: 65535
edns payload size: none
edns payload size: none
edns payload size: none
edns payload size: none
edns payload size: 65535
edns payload size: 65535
@jedisct1
jedisct1 / favorites.rb
Last active September 28, 2015 03:07
favorites.rb
require 'twitter'
USER = 'jedisct1'
SINCE_ID_FILE = "#{ENV['HOME']}/.favorites_since_id"
Twitter.configure do |config|
config.consumer_key = 'fuck a duck'
config.consumer_secret = 'fuck a duck'
config.oauth_token = 'fuck a duck'
config.oauth_token_secret = 'fuck a duck'
@jedisct1
jedisct1 / unbound-status-for-digdns.c
Created December 20, 2011 17:13
Get Unbound status, for @digdns
#define UNBOUND_CONTROL_VERSION 1
#define UNBOUND_ETC_DIR "/var/unbound/etc"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <string.h>
@jedisct1
jedisct1 / ldns-signzone.sh
Created March 19, 2012 19:40
ldns-signzone wrapper that understands $INCLUDE statements #dnssec #nsd
#! /bin/sh
LDNS_SIGNZONE="ldns-signzone"
errx() {
echo "$1" >&2
exit 1
}
parse_opts() {
@jedisct1
jedisct1 / webigin2.php
Created April 20, 2012 16:37
webigin token generation
<?php
define('WEBIGIN2_CIPHER', 'aes-128-cfb');
define('WEBIGIN2_CIPHER_BLOCK_SIZE', 16);
define('WEBIGIN2_CIPHER_KEY1', '0123456789ABCDEF');
define('WEBIGIN2_CIPHER_KEY2', 'CAFEBABEDEADBEEF');
define('WEBIGIN2_KV_KEY_SIZE', 8);
function webigin2_base32_encode($str) {
$BASE32_TABLE = '0123456789bcdfghjklmnpqrstuvwxyz';
@jedisct1
jedisct1 / webigin_base32.php
Created May 14, 2012 18:05
base32 encode/decode
<?php
function webigin2_base32_encode($str) {
$BASE32_TABLE = '0123456789bcdfghjklmnpqrstuvwxyz';
$out = '';
$i = $v = $bits = 0;
$str_len = strlen($str);
while ($i < $str_len) {
$v |= ord($str[$i++]) << $bits;
$bits += 8;
@jedisct1
jedisct1 / dnsrequestfromhell.txt
Created May 16, 2012 23:25
dnsrequestfromhell
[1337210514] unbound[81693:0] debug: mesh_run: start
[1337210514] unbound[81693:0] debug: validator[module 0] operate: extstate:module_state_initial event:module_event_new
[1337210514] unbound[81693:0] info: validator operate: query Aucknqwgxadsmektw21eg1zfv2xgtaqs312xvaf54j0ex4oly6umokv510ra.3augqanx502ftqbmv0aubnwxvrpd5bbbg3tyaxw2z2pszp2xpxe3kbdcpj35.yt3wsv3cl4sovyqbbadhg4unkt2kdj5vgxjjczfesyll00ffvakfp5etpx21.en1k5c6otskovmktvh63sdkqtopag2xrgwt1e2xmmv4pftfnbo0m.sa.skype.net. A IN
[1337210514] unbound[81693:0] debug: validator: pass to next module
[1337210514] unbound[81693:0] debug: mesh_run: validator module exit state is module_wait_module
[1337210514] unbound[81693:0] debug: iterator[module 1] operate: extstate:module_state_initial event:module_event_pass
[1337210514] unbound[81693:0] debug: process_request: new external request event
[1337210514] unbound[81693:0] debug: iter_handle processing q with state INIT REQUEST STATE
[1337210514] unbound[81693:0] info: resolving Aucknqwgxadsmektw21eg1zfv2xgtaqs3
@jedisct1
jedisct1 / skype-b0rk3d-auth-servers.txt
Created May 21, 2012 16:01
Skype b0rk3d auth servers
$ drill $(echo aryujzocnag3pbb6e1yqc065qwgreyza6e5xpp2dv5vjp0t2oc2syfhfpt1m.eerquwxahdh14c42p6bsn6wt1pwwdwl6zcj445ez1h5wrgtz0wus1aerrp0f.cpr524xemp2d15tz5lon04hwhdkbdsshruzc1upubk5g3za3n4lgztyg6hrd.b13ulsaoxlzgbjkx1nfwxnzewlgokvm5cuvr00mbuwb5yd5dk35a.sa.skype.net) @b1.skype.net
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 62761
;; flags: qr aa ra ; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; aryujzocnag3pbb6e1yqc065qwgreyza6e5xpp2dv5vjp0t2oc2syfhfpt1m.eerquwxahdh14c42p6bsn6wt1pwwdwl6zcj445ez1h5wrgtz0wus1aerrp0f.cpr524xemp2d15tz5lon04hwhdkbdsshruzc1upubk5g3za3n4lgztyg6hrd.b13ulsaoxlzgbjkx1nfwxnzewlgokvm5cuvr00mbuwb5yd5dk35a.sa.skype.net. IN A
;; ANSWER SECTION:
aryujzocnag3pbb6e1yqc065qwgreyza6e5xpp2dv5vjp0t2oc2syfhfpt1m.eerquwxahdh14c42p6bsn6wt1pwwdwl6zcj445ez1h5wrgtz0wus1aerrp0f.cpr524xemp2d15tz5lon04hwhdkbdsshruzc1upubk5g3za3n4lgztyg6hrd.b13ulsaoxlzgbjkx1nfwxnzewlgokvm5cuvr00mbuwb5yd5dk35a.sa.skype.net. 0 IN CNAME av5kv2pcfczaow3jd0nq0xja5bndroezc2eskbbmukrcbb5ktr0tcyza