Skip to content

Instantly share code, notes, and snippets.

View Katharine's full-sized avatar

Katharine Berry Katharine

View GitHub Profile
@Katharine
Katharine / gist:5677054
Created May 30, 2013 10:44
Demo program that breaks text. Move it left and right with the up and down keys.
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#define MY_UUID { 0xFC, 0xF3, 0xC3, 0xF1, 0xBC, 0xE4, 0x48, 0x3D, 0x92, 0x48, 0x79, 0x97, 0xAC, 0xC7, 0x2F, 0x7F }
PBL_APP_INFO_SIMPLE(MY_UUID, "Text Rendering Error", "Demo Corp", 1 /* App version */);
Window window;
@Katharine
Katharine / http_demo.c
Created May 25, 2013 21:01
Simplest possible HTTP demo.
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#include "http.h"
PBL_APP_INFO_SIMPLE(HTTP_UUID, "HTTP Demo", "Demo Corp", 1 /* App version */);
Window window;
TextLayer textLayer;
@Katharine
Katharine / gist:5597329
Created May 17, 2013 06:38
httpebble local cookie demo.
#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"
#include "http.h"
#include "itoa.h"
#define COUNTER_COOKIE 1
PBL_APP_INFO_SIMPLE(HTTP_UUID, "Counter Demo", "Demo Corp", 1 /* App version */);
Window window;
diff -r 39932e2ec204 indra/newview/exonotificationmanager.cpp
--- a/indra/newview/exonotificationmanager.cpp Fri Aug 03 07:52:38 2012 -0400
+++ b/indra/newview/exonotificationmanager.cpp Sat Aug 04 00:00:13 2012 -0400
@@ -39,6 +39,8 @@
// Platform-specific includes
#ifdef LL_DARWIN
#include "exonotifiermacosx.h"
+#elif LL_LINUX
+#include "exonotifierlinux.h"
#endif
@Katharine
Katharine / clobber.c
Created May 16, 2012 18:11
Clobber i by overflowing s
#include <stdio.h>
struct foo {
char s[4];
int i;
};
int main() {
struct foo f;
f.i = 10;
@Katharine
Katharine / ai.cpp
Created May 12, 2012 16:20
Noughts and Crosses for netbyte
#include "ai.h"
ai::ai(tictactoe &game, tictactoe::player_t player) : m_game(game), m_player(player) { }
void ai::move() {
// All of these methods return true on success, thus the pile of ifs.
if(try_win()) return;
if(try_block()) return;
if(try_fork()) return;
if(try_block_fork()) return;
@Katharine
Katharine / link-hunspell.diff
Created April 25, 2012 18:53
Fix Darwin libhunspell.dylib linking (STORM-276)
def largest_key(d):
k = None
largest = 0
for i in d:
if d[i] > largest:
largest = d[i]
k = i
return k
# Because urllib's doesn't like multibyte unicode.
def escapeurl(url):
safe = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-'
output = ''
for char in url:
if char in safe:
output += char
else:
code = hex(ord(char))[2:]
while len(code) > 0:
def get_interfaces(fname):
interfaces = []
current = []
with open(fname) as f:
for line in f:
line = line.strip()
if line == '!':
if current:
interfaces.append(current)
current = []