Skip to content

Instantly share code, notes, and snippets.

View dskinner's full-sized avatar

Daniel Skinner dskinner

  • Louisiana
View GitHub Profile
@dskinner
dskinner / godroid.sh
Created November 23, 2015 15:41
godroid.sh
#! /usr/bin/env bash
function usage {
echo "Usage: godroid [...command]"
echo " build build -target android ."
echo " install install -r *.apk"
echo " run run Activity"
echo " logcat filter by tag GoLog since now()"
}
package main
import (
"image"
"azul3d.org/gfx.v1"
"azul3d.org/gfx/window.v2"
"azul3d.org/keyboard.v1"
"azul3d.org/lmath.v1"
"azul3d.org/mouse.v1"
package main
import (
"fmt"
"math"
"os"
"sort"
"strings"
)
package main
import (
"bufio"
"encoding/json"
"flag"
"fmt"
"github.com/gorilla/mux"
"log"
"net/http"
package main
import (
"archive/tar"
"compress/bzip2"
"flag"
"io"
"io/ioutil"
"log"
"net/http"
@dskinner
dskinner / droidscale.go
Last active December 11, 2015 23:39
Resizes android xhdpi resources for ldpi, mdpi, and hdpi.
/*
Usage of droidscale:
-interp="Lanzcos3": interpolation to use. NearestNeighbor, Bilinear, Bicubic, MitchellNetravali, Lanzcos2, Lanzcos3.
-out="./out": directory to place resized images.
-path="": path of xhdpi drawables to process, can point to a single file.
Resizes xhdpi resources for ldpi, mdpi, and hdpi. Contents of flag path will
be walked and new files written to flag out will be flattened. This means
you can organize the contents of flag path with subdirectories to target
different interpolations for use on a particular set of images. For example:
@dskinner
dskinner / mysql2postgresql.awk
Created November 14, 2012 16:02
Basic conversion of table defs and inserts from mysqldump to postgresql.
#! /usr/bin/gawk -f
BEGIN {
IGNORECASE = 1 # gawkism
print "begin transaction;"
}
{
gsub("\r$", "") # dos2unix
}
@dskinner
dskinner / test.c
Created July 12, 2012 17:59
typedef test
#include <stdio.h>
#include <stdlib.h>
typedef int (*oper_cb)(int a, int b);
int add(int a, int b)
{
return a + b;
}
@dskinner
dskinner / duck.c
Created July 12, 2012 17:44
Polymorphic behaviour in C
#include <stdio.h>
#include <stdlib.h>
//
typedef struct Duck Duck;
typedef void (*quack_t)(void *self);
void Duck_quack(void *self);
// Overriding original structure members means you must include everything up.
// So if I want to override `quack`, I dont need to override anything