Skip to content

Instantly share code, notes, and snippets.

@kulp
kulp / dehex.c
Created April 21, 2009 20:56
Convert a hex string into integer or character buffer
static inline char _hexify(const char c)
{
return (((c | ('A' ^ 'a')) - '0') % 39);
}
/// Converts a len-digit hex number into its unsigned native representation.
unsigned int dehex_to_int(int ilen, const char ibuf[ilen])
{
unsigned int result = 0;
@BlockoS
BlockoS / openDisplay.c
Created December 9, 2009 20:57
Smallest possible raw X11 init
//// TODO :: 3. Clean up
//// 4. Events
//// 5. Create a colormap
//// 6. glx ?
#ifdef DEBUG
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/un.h>
#include <sys/select.h>
@kulp
kulp / tree_macro.pl
Created March 30, 2010 22:54
Generates CPP macros for mapping arbitrary integer sets to small integer sets
#!/usr/bin/env perl
use strict;
use List::Util qw(max);
my $name = "b";
# for each significant bit position, where the sequence through the bit
# positions is chosen such that each bit chosen divides the remaining
# search space as nearly evenly as possible, construct an array that
# looks like this:
@je-so
je-so / testprogram.c
Last active May 5, 2024 20:38
Xlib transparent window with OpenGL support
/*
____ _____
/\__ \ /\ ___\
\/__/\ \ \ \ \__/_
\ \ \ \ \____ \
_\_\ \ \/__/_\ \
/\ _____\ /\ _____\
\/______/ \/______/
Copyright (C) 2011 Joerg Seebohn
@OrangeTide
OrangeTide / bitfield.h
Created April 7, 2011 17:47
bitfield macros
/* bitfield.h - bitfield macros */
/*
* PUBLIC DOMAIN - NO COPYRIGHT CLAIMED - Jonathan Mayo - July 2005
*
* Updated January 2010
*/
#ifndef BITFIELD_H
#define BITFIELD_H
#include <limits.h>
@mmalex
mmalex / pngencode.cpp
Created April 7, 2011 17:48 — forked from anonymous/pngencode.cpp
bug fix png encoder
// by alex evans, 2011. released into the public domain.
// based on a first ever reading of the png spec, it occurs to me that a minimal png encoder should be quite simple.
// this is a first stab - may be buggy! the only external dependency is zlib and some basic typedefs (u32, u8)
//
// VERSION 0.02! now using zlib's crc rather than my own, and avoiding a memcpy and memory scribbler in the old one
// by passing the zero byte at the start of the scanline to zlib first, then the original scanline in place. WIN!
//
// more context at http://altdevblogaday.org/2011/04/06/a-smaller-jpg-encoder/.
//
// follow me on twitter @mmalex http://twitter.com/mmalex
@OrangeTide
OrangeTide / ini.c
Created April 28, 2011 19:11
.ini file parser
/* This software is public domain. No copyright is claimed.
* Jon Mayo April 2011
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Load an .ini format file
* filename - path to a file
* report - callback can return non-zero to stop, the callback error code is
@roxlu
roxlu / main.cpp
Created November 2, 2012 09:46
OpenSSL + LibUV: client https
#include <iostream>
#include <libgen.h>
#include <openssl/ssl.h>
#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <uv.h>
#include <vector>
#include <iterator>
#include <algorithm>
@lgaff
lgaff / boot.asm
Created November 30, 2012 03:02
FAT12 stage 1 boot loader
; incboot.s
; Incrementally build a boot block for x86
; I'm going to keep adding bits to this one step at a time from
; boot-and hang to hopefully loading a kernel
; Here we go.
; We're implementing a FAT12 file system for the boot disk. This file system is well
; documented so it shouldn't be a hard ask for a first-timer like me.
; There is a certain order required for the metadata appearing at the top of the
; boot block below the jump to start, we'll introduce each as we go.
@Proplex
Proplex / DHT_Servers
Last active June 23, 2016 08:00
Tox Bootstrap servers
You can pick anyone of these servers, they all are linked together.
192.81.133.111 33445 8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858
66.175.223.88 33445 B24E2FB924AE66D023FE1E42A2EE3B432010206F751A2FFD3E297383ACF1572E
192.184.81.118 33445 5CD7EB176C19A2FD840406CD56177BB8E75587BB366F7BB3004B19E3EDC04143
192.210.149.121 33445 F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67
81.224.34.47 443 48F0D94C0D54EB1995A2ECEDE7DB6BDD5E05D81704B2F3D1BB9FE43AC97B7269
198.46.136.167 33445 728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854
95.47.140.214 33445 F4BF7C5A9D0EF4CB684090C38DE937FAE1612021F21FEA4DCBFAC6AAFEF58E68
54.215.145.71 33445 6EDDEE2188EF579303C0766B4796DCBA89C93058B6032FEA51593DCD42FB746C