Skip to content

Instantly share code, notes, and snippets.

@kylelk
kylelk / database.c
Last active August 29, 2015 14:16
product database using sqlite3
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <string.h>
#define DATABASE_PATH "products.db"
#define MENU_LIST_PRODUCTS 1
#define MENU_ADD_PRODUCT 2
#define MENU_DELETE_PRODUCT 3
@kylelk
kylelk / AndroidManifest.xml
Created December 29, 2014 20:16
Android created Gist
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.multWinTest"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="11" />
local Stack = {}
Stack.__index = Stack
function Stack:push(value)
table.insert(self,value)
end
function Stack:pop()
return table.remove(self)
@kylelk
kylelk / stack.lua
Created December 16, 2014 07:20
simple stack in lua
stack = {}
function stack.push(item)
table.insert(stack, item)
end
function stack.pop()
return table.remove(stack)
end
@kylelk
kylelk / demo.py
Created December 16, 2014 06:50
python function argument demo
def demo(**arguments):
print arguments
demo(arg1="one", arg2="two")
@kylelk
kylelk / convert_int.c
Created November 23, 2014 07:47
Android created Gist
#include <stdio.h>
void printd(int n)
{
if (n < 0)
{
putchar('-');
n = -n;
}
if (n / 10)
@kylelk
kylelk / pointer_test.c
Created November 19, 2014 08:47
pointer_test.c
#include <stdio.h>
int main()
{
int n[5] = { 3, 6, 9, 12, 15 };
int *ptr = n;
ptr++;
printf("%d", *ptr);
return 0;
@kylelk
kylelk / byte_count.c
Created November 16, 2014 21:07
Counts the occurrences of each byte in a file
//
// main.c
// byte count
//
// Created by kyle kersey on 11/16/14.
// Copyright (c) 2014 kyle kersey. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
@kylelk
kylelk / hello_world_signature
Created November 11, 2014 03:21
hello world
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hello world
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Darwin)
iQEcBAEBAgAGBQJUYYCVAAoJECqmFjSW0I3xiN8H/3jGLt5nl1FB9sDnZ5RFUqNX
sUs6RHRN9bDCTs03rJIWxc5a9+ZnxOOjZOpV5NrOhO9HjUwMyjKkVPaoV3ySTtp3
T+/snXfxpk2EfoxjvI4wx/jx/KSa21hkSBrV/ysyHbLQQnU125mc84QSCwGoU/qk
@kylelk
kylelk / leaf_animation.py
Created November 7, 2014 08:32
Creates a SVG animation of falling leaves
import xml.etree.cElementTree as ET
from math import sin
import random
# configuation
leaf_count = 30
min_fall_duration = 10.0
max_fall_duration = 15.0