Skip to content

Instantly share code, notes, and snippets.

View euank's full-sized avatar

Euan Kemp euank

View GitHub Profile
@euank
euank / Steam-runtime build.md
Last active August 29, 2015 13:57
ponscripter steam runtime build

ponscripter-fork build for steam.

The machine I used was running 32-bit ubuntu server, 12.04. I think it needs to be 32 bit to easily do these steps or else there's some issues with the configure script.

sudo apt-get install git build-essential automake

wget http://media.steampowered.com/client/runtime/steam-runtime-sdk_latest.tar.xz
tar xvf steam-runtime-sdk_latest.tar.xz
cd steam-runtime-sdk*
@euank
euank / gist:cae2773776741ff46049
Last active August 29, 2015 13:57
Just demonstrating c behavior that allows a non-returning function to still accidentally return the right value.
#include <stdlib.h>
#include <stdio.h>
int *getOne() {
register int eax asm("eax");
printf("eax is %x before malloc\n", eax);
int *one = malloc(sizeof(int));
@euank
euank / sleepsort.js
Created April 16, 2014 19:41
sleepsort joke in javascript eventloop. yes-it's-a-joke
function sort(arr) {arr.forEach(function(n){var s=['console.log('+n+');'];for(var i=0;i<n;i++) {s.unshift('process.nextTick(function(){');s.push('});');}eval(s.join(''));});}
var fs = require('fs');
try {
fs.readFile('/tmp/kek.not-json', function(err, data) {
JSON.parse(data);/* exception, uncaught */
})
} catch(ex) {
console.log("I don't print. It instead errors out with an exception");
}
@euank
euank / GameTime.rb
Last active August 29, 2015 14:01
Ruby code found in the wild by a friend (distributed by facebook no less. wow). I made it slightly better, but it's still, with no offense to the author, pretty bad code
#Basic Game Time + Night/Day v1.6.2
#----------#
#Features: Provides a series of functions to set and recall current game time
# as well customizable tints based on current game time to give the
# appearance of night and day.
#
#Usage: Script calls:
# GameTime::minute? - returns the current minute
# GameTime::hour? - returns the current hour
# GameTime::set(time) - sets the game time to time, in frames (max:1440)
@euank
euank / RandNum.java
Created June 4, 2014 20:42
Yes it's a joke. Random number generator in java.
import java.net.*;
import java.io.*;
import java.util.*;
class RandNum {
public static void main(String[] args) {
for(int i=0;i<100;i++) {
System.out.println("Your random number is: " + GetRandomNumber(1,2));
}
}
@euank
euank / gist:e80269ed5d5c2eee9c1f
Created December 24, 2014 20:52
keybase proof....
### Keybase proof
I hereby claim:
* I am euank on github.
* I am euank (https://keybase.io/euank) on keybase.
* I have a public key whose fingerprint is B21D B279 98F1 8351 633B 0A07 173E 1948 65D4 40F2
To claim this, I am signing this object:
@euank
euank / docker_pull.bt
Created August 24, 2015 16:47
Docker pull deadlock backtrace; v1.6.2
goroutine 0 [idle]:
runtime.futex(0x134f1b8, 0x0, 0x0, 0x0, 0x0, 0x134e400, 0x1, 0x41a0ef, 0x41a30e, 0x134f1b8, ...)
/usr/local/go/src/runtime/sys_linux_amd64.s:277 +0x21
runtime.futexsleep(0x134f1b8, 0xc200000000, 0xffffffffffffffff)
/usr/local/go/src/runtime/os_linux.c:49 +0x47
runtime.notesleep(0x134f1b8)
/usr/local/go/src/runtime/lock_futex.go:145 +0xae
stopm()
/usr/local/go/src/runtime/proc.c:1178 +0x119
exitsyscall0(0xc20837e480)
@euank
euank / docker_pull_v2.bt
Created August 24, 2015 17:07
Docker 1.8.0-dev deadlock in v2 pull / error handling
Containers: 173
Images: 493
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 881
Dirperm1 Supported: false
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.13.0-48-generic
@euank
euank / docker_create.go
Created August 24, 2015 22:27
A program that calls `docker create` at the given frequency
package main
import (
"flag"
"time"
"github.com/Sirupsen/logrus"
"github.com/fsouza/go-dockerclient"
)