Skip to content

Instantly share code, notes, and snippets.

View jotaki's full-sized avatar

Kinsella, Joseph (Joey) jotaki

View GitHub Profile
@jotaki
jotaki / testflush.c
Created January 23, 2011 19:03
Testing if fsync(dup(1)) flushes stdout!
/* testflush.c
* Expected Output:
* Goodbye World!Hello World!
*
* Testing for Output:
* Hello World!Goodbye World!
*
* Actual Output:
* Goodbye World!Hello World!
*/
@jotaki
jotaki / test.s
Created December 11, 2011 15:10
Test
.text
.global _start
_start:
movq $42, %rcx
.L0:
cmpq $20, %rcx
loopnz .L0
@jotaki
jotaki / obfhello.c
Created January 14, 2012 15:46
Obfuscated Hello, World
/* compile with gcc -o obfhello obfhello.c -lm */
#define xR return
# define T typedef
# define E extern
# define S static
# define P putchar
# define Z ((V*)0)
#define Bb main
# define X int
@jotaki
jotaki / more_obf_c.c
Created September 21, 2012 22:03
More obfuscated C.
/*
* compile with no optimizations (eg. gcc -o a.out more_obf_c.c)
*/
#define FILE int
#define NULL ((void*)0)
#define T typedef
#define _w_ while
#define _r_ return
~/src/ext/luke-irc-client/src[tux]$ ldd lic
linux-gate.so.1 (0xf773a000)
libX11.so.6 => /usr/lib32/libX11.so.6 (0xf75f8000)
libXext.so.6 => /usr/lib32/libXext.so.6 (0xf75e8000)
libXpm.so.4 => /usr/lib32/libXpm.so.4 (0xf75d7000)
libXrandr.so.2 => /usr/lib32/libXrandr.so.2 (0xf75cf000)
libXrender.so.1 => /usr/lib32/libXrender.so.1 (0xf75c4000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf75aa000)
libc.so.6 => /lib32/libc.so.6 (0xf7421000)
libm.so.6 => /lib32/libm.so.6 (0xf73fa000)
@jotaki
jotaki / attachment_finder.rb
Created January 26, 2013 10:46
Find and download attachments in gmail's sent mail.
#! /usr/bin/env ruby
# tested with ruby-1.9.2p320
# no additional gems should be required as net/imap is
# part of the default "library"
require 'net/imap'
# imap server (gmail)
$server = 'imap.gmail.com'
@jotaki
jotaki / for.c
Last active December 18, 2015 23:49
#include <stdio.h>
#include <time.h>
#include <omp.h>
int main()
{
unsigned long long l = 0, a = 0;
clock_t start, stop;
start = clock();
@jotaki
jotaki / x.c
Last active December 24, 2015 13:19
simple hash:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include <sys/stat.h>
#define PATH "numbers.txt"
#define CHUNK_SIZE 4096
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void swap(int *p, int i, int j)
{
int t = p[i];
p[i] = p[j];
p[j] = t;
}
.file "mynewx.c"
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "numbers.txt"
.LC1:
.string "%u\n"
.LC2:
.string "%d in %ld ms\n"
.section .text.startup,"ax",@progbits
.p2align 4,,15