Skip to content

Instantly share code, notes, and snippets.

View philip-wernersbach's full-sized avatar

Philip Wernersbach philip-wernersbach

View GitHub Profile
@philip-wernersbach
philip-wernersbach / horizontal_scrolling_demo.html
Last active December 10, 2015 20:49
Demonstrates Horizontal Scrolling using HTML and CSS.
<html>
<!--
Horizontal Scrolling Demo by Philip Wernersbach
January 2013
Tri-Licensed: Public Domain, Creative Commons CC0, & WTFPL
!-->
<head>
<title>Horizontal Scrolling Demo</title>
@philip-wernersbach
philip-wernersbach / cat-xen.cfg.txt
Created September 7, 2013 05:34
IBM x3500 M4 ACPI Bug w/ Xen + EFI - Debug Output
# cat /boot/efi/EFI/xen/xen.cfg
[global]
default=debian
[debian]
options=placeholder console=vga dom0_mem=8192M dom0_max_vcpus=4 dom0_vcpus_pin=true
kernel=vmlinuz-3.10-2-amd64 placeholder console=tty0 root=UUID=1f2688b0-8fd5-4f0f-ac78-46b0acd33ebb ro quiet
ramdisk=initrd.img-3.10-2-amd64
@philip-wernersbach
philip-wernersbach / minimalist_cocoa_app.m
Created February 4, 2015 21:44
Araq/Nim: Invalid Objective-C code generated when calling class method
/* Generated by Nim Compiler v0.10.3 */
/* (c) 2015 Andreas Rumpf */
/* The generated code is subject to the original license. */
/* Compiled for: MacOSX, amd64, clang */
/* Command for C compiler:
clang -c -w -I/Users/philip/coding_projects/published-forked-from-github/Nim/lib -o nimcache/minimalist_cocoa_app.o nimcache/minimalist_cocoa_app.m */
#define NIM_INTBITS 64
#include "nimbase.h"
#import <Cocoa/Cocoa.h>
static N_INLINE(NI, newnsautoreleasepool_90038)(void);
@philip-wernersbach
philip-wernersbach / extract_framework_list.js
Last active August 29, 2015 14:15
Extract OS X Framework List
/*
Script to extract framework list from
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/OSX_Technology_Overview/SystemFrameworks/SystemFrameworks.html
*/
var framework = /(.+)\.framework/
var possibleNames = document.getElementsByTagName("code");
for (var i=0; i < possibleNames.length; i++) {
var possibleName = framework.exec(possibleNames[i].textContent);
if ((possibleName !== null) && (possibleName[1] !== null)) {
@philip-wernersbach
philip-wernersbach / generate_frameworks_nim.sh
Created February 15, 2015 23:58
Generate OS X Framework files for Nim
#!/bin/sh
for framework in $( cat - ); do
framework_upper=$( echo $framework | tr '[:lower:]' '[:upper:]' )
framework_lower=$( echo $framework | tr '[:upper:]' '[:lower:]' )
cat > ${framework_lower}_framework.nim <<EOF
{.passL: "-framework $framework".}
const ${framework_upper}_FRAMEWORK_HEADER* = "<$framework/$framework.h>"
@philip-wernersbach
philip-wernersbach / nim_objc_osx_error.nim
Created February 16, 2015 22:44
Araq/Nim: Basic Objective-C FFI fails to compile on OS X
# For simplicity, doesn't use anything from Foundation, like NSObject or NSString.
# Just basic Objective-C FFI.
{.emit: """
@interface Foo
+ (void)bar;
@end
@implementation Foo
@philip-wernersbach
philip-wernersbach / gittorrent_clone_hang.log
Created May 30, 2015 16:40
gittorrent_clone_hang.log
Cloning into 'GitTorrent'...
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] new DHT 3b1c2605b9d3b3a173e8d7175749faca6a739f9e
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] bootstrap with ["dht.gittorrent.org:6881","core.gittorrent.org:6881"]
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] listen undefined
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] emit listening 52843
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] lookup (find_node) 3b1c2605b9d3b3a173e8d7175749faca6a739f9e
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] sent find_node 3b1c2605b9d3b3a173e8d7175749faca6a739f9e to 192.34.86.36:6881
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] sent find_node 3b1c2605b9d3b3a173e8d7175749faca6a739f9e to 192.34.86.38:6881
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] addNode 9b582f248cd77af711f5c8af8efd63eadcda73c3 192.34.86.36:6881 discovered from 192.34.86.36:6881
Sat, 30 May 2015 16:34:03 GMT bittorrent-dht [3b1c260] skip addNode 74.83.117.69:52
total executions of each stack trace:
Entry: 1/29 Calls: 4/56 = 7.1% [sum: 4; 4/56 = 7.1%]
genericAssignAux 43/56 = 77.%
genericAssignAux 43/56 = 77.%
genericAssign 43/56 = 77.%
genericSeqAssign 37/56 = 66.%
unpack 21/56 = 38.%
test_all 56/56 = 1.0e+02%
Entry: 2/29 Calls: 4/56 = 7.1% [sum: 8; 8/56 = 14.%]
genericAssignAux 43/56 = 77.%
# Run with "nim cpp -r"
import asyncdispatch
# This doesn't work because the Nim compiler generates a goto that
# jumps into a try block.
#
# In C++ you can jump out of a try block, but not into it. In addition,
# jumping out of the try block here isn't valid behavior, because C++
# will execute applicable destructors.