Skip to content

Instantly share code, notes, and snippets.

@kylelk
kylelk / content
Last active December 31, 2015 21:59
bitcoin:1CuJxwjqf8z2uy3EHh2Kge12tcR5eNiB4t
pbpaste 0cea18bc3a56d15c9fb889868a12d145e707cedc8dee9edbe114c9dcf61b09ff
@kylelk
kylelk / line.c
Created December 14, 2013 02:21
SDL draw line
#include <SDL.h> /* All SDL apps need this */
#include <stdio.h>
#include <math.h>
#include <stdlib.h> /* for exit() */
void putpixel(SDL_Surface *theScreen, int x, int y, Uint32 pixel) {
int byteperpixel = theScreen->format->BytesPerPixel;
@kylelk
kylelk / thesaurus.m
Created December 11, 2013 03:16
Lookup a word using cocoa
/* compile with:
gcc -o thesaurus -framework CoreServices -framework Foundation thesaurus.m
*/
#import <Foundation/Foundation.h>
#include <CoreServices/CoreServices.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
e = 7aa41de858d58ba2ef1c2e84373147b733ff8b3af5b4c4372de545473ce519aa1ac08800a00a4604490060008954c1d02044384820000440816456a708c8000000020002c000008402c000000000000514040004040d4004300a41c000074000096001620ad828004008829fc0008001044386002144e02112085a020300cd01
n = 8e5ae7047cc6407fe0d672a075de2df1c26e67753470639e470e8de625c62b7644fb82645ec52773b48222f12650598fce8a408f52b2b70fd848a5749634d8acf28e0de6c3e90f22a156434195c337d5d4226a03fcfc0fa98805d0b31dfb96d76fd527e5601e0b6a5f23c9be04bc17c954ce507c1e7a234509a2252d057e0dbb
@kylelk
kylelk / androidmanifest.xml
Created November 22, 2013 09:00
set the android wallpaper
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kylelk.wallpaper"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
W/NotificationManager( 7558): notify: id corrupted: sent 998, got back 0
W/NotificationManager( 7558): notify: id corrupted: sent 986, got back 0
W/NotificationManager( 7558): notify: id corrupted: sent 987, got back 0
E/NotificationService( 147): Package has already posted 50 notifications. Not showing more. package=com.android.providers.downloads
E/NotificationService( 147): Package has already posted 50 notifications. Not showing more. package=com.android.providers.downloads
E/NotificationService( 147): Package has already posted 50 notifications. Not showing more. package=com.android.providers.downloads
E/NotificationService( 147): Package has already posted 50 notifications. Not showing more. package=com.android.providers.downloads
W/NotificationManager( 7558): notify: id corrupted: sent 984, got back 0
W/NotificationManager( 7558): notify: id corrupted: sent 985, got back 0
W/NotificationManager( 7558): notify: id corrupted: sent 990, got back 0
@kylelk
kylelk / int_to_file.py
Created November 12, 2013 06:42
Writes an integer to a file
#number to write to file
num = 100000
#convert to hexadecimal
data = str('{0:0x}'.format(num))
#pad number if odd length
if(len(data) % 2 != 0):
data='0'+data
#split into chucks of two
info = [data[i:i+2] for i in range(0, len(data), 2)]
#convert each chuck to character
//
// webserver.c
//
// Simple HTTP server sample for sanos
//
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <sys/stat.h>