Skip to content

Instantly share code, notes, and snippets.

View kiljacken's full-sized avatar
🦀

Emil Lauridsen kiljacken

🦀
  • Danske Bank
  • Copenagen, Denmark
View GitHub Profile
@kiljacken
kiljacken / BootImage
Created August 25, 2011 15:39
LGE P990 Development Info
Base: 0x10000000
Pagesize: 0x800
Cmdline: mem=383M@0M nvmem=128M@384M loglevel=0 muic_state=1 lpj=9994240 CRC=3010002a8e458d7 vmalloc=256M brdrev=1.0 video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,linux:34700:1000:800,mbr:400:200:800,system:600:2bc00:800,cache:2c200:8000:800,misc:34200:400:800,userdata:38700:c0000:800 androidboot.hardware=p990
package com.koushikdutta.desktopsms;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@kiljacken
kiljacken / gogame_example.go
Last active August 29, 2015 14:02
Update to work with value matrices
package main
import (
"github.com/go-gl/gl"
glfw "github.com/go-gl/glfw3"
"github.com/kiljacken/gogame"
"github.com/kiljacken/gogame/math"
"log"
)
LZO_PUBLIC(int)
lzo1_decompress ( const lzo_bytep in , lzo_uint in_len,
lzo_bytep out, lzo_uintp out_len,
lzo_voidp wrkmem )
{
lzo_bytep op;
const lzo_bytep ip;
const lzo_bytep const ip_end = in + in_len;
lzo_uint t;
@kiljacken
kiljacken / main.rs
Last active August 29, 2015 14:10
main.rs
// History : Event[]
// Event : Time|Period, (Person|Object)[], Action[]
// Time : basic
// Period : Time, Time
//
use std::io;
enum LoopAction<'a> {
#!/bin/bash
# variables
export GOPATH=$HOME/ark_go
# functions
info() {
echo "[ ] $@"
}
@kiljacken
kiljacken / draft.md
Last active August 29, 2015 14:25
Operation overloading spec draft

Rough sketch follows.

Operator overloading

To prevent the issue, from C++ style operator overloading, of an operator having to be defined on each type involved in th operation, we use based on the syntax for function declarations. This will allow independent definition without any duplication.

operator +(a: Vector2, b: Vector2): Vector2 {
    ...

Generics

Generics provide a method for creating functions and composite types that work across a wide range (read: all other) of types.

An example of a type definition using generics is the Option type:

type Option<T> enum {
	None,
	Some(T)
};
@kiljacken
kiljacken / Fibo.java
Created November 5, 2015 13:06
Fibonacci in java using a horrible state machine.
public class Fibo
{
public static int fib(int n) {
State[] sss = new State[]{
(l) -> new int[]{ l[0], l[1], l[2], l[3], 0},
(l) -> new int[]{ l[0], l[1], l[3]>0?l[3]!=0?l[3]!=1?6:5:4:3, l[3], l[4]},
(l) -> new int[]{ l[0], l[1], l[3]>0?6:0, l[3], l[4]},
(l) -> new int[]{ -1, l[1], 0, l[3], l[4]},
(l) -> new int[]{ 0, l[1], 0, l[3], l[4]},
(l) -> new int[]{ 1, l[1], 0, l[3], l[4]},
@kiljacken
kiljacken / ratelimit.nginxconf
Created March 9, 2017 12:36 — forked from ipmb/ratelimit.nginxconf
Nginx reverse proxy with rate limiting
upstream myapp {
server 127.0.0.1:8081;
}
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
server {
listen 443 ssl spdy;
server_name _;