Skip to content

Instantly share code, notes, and snippets.

View sebble's full-sized avatar

Sebastian Mellor sebble

  • Sebble.com
  • Newcastle upon Tyne
View GitHub Profile
@sebble
sebble / mutaframe-GUI.R
Created July 19, 2011 13:19
attempting to return a value..
require("gWidgets")
require("cranvas")
tmp <- qdata(list('a'=c(1,2,3),'b'=c(4,5,6)))
gui <- function (data) {
obj <- gbutton("Hello world", container = gwindow(), handler = function(...){ data$b[2] <-9 })
}
@sebble
sebble / plots.gui.R
Created July 22, 2011 12:54
Drawing some plots in a gWidgets window
library(gWidgets)
plots.gui <- function(toolkit, resize) {
options("guiToolkit"=toolkit)
window <- gwindow("plots.gui - gWidgets")
wgroup <- ggroup(horizontal=FALSE, cont=window)
pgroup <- gpanedgroup(container=wgroup)
add(pgroup, ggraphics()); ggmain <- dev.cur()
@sebble
sebble / geo-projection.js
Created January 4, 2012 12:00 — forked from djagdish/basic-raphael-map.html
Simple Raphael Maps using D3 Projections
(function(){geo = {};
// This geographic projection library is
// derived from D3 library by Mike Bostock
// https://github.com/mbostock/d3/
// which is licensed under a BSD license.
// mercator with custom default scaling to match world.svg.js
geo.mercator = function() {
var scale = 1000,
@sebble
sebble / __etc__udev__rules.d__51-android.rules
Created June 18, 2013 00:50
Scripts to help with android development
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0e79", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="091e", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"
@sebble
sebble / init.sh
Created July 5, 2013 09:34
A script to run any executable in background, check if it is already running, or kill the process tree (includes children spawned from main executable).
#!/bin/bash
# simple service checker, starter, process tree killer
# usage:
# init.sh <script_path> [start|stop|status|restart]
SCRIPT=$1
ACTION=$2
@sebble
sebble / custom.css
Created May 7, 2014 10:49
IPython Notebook Custom Style
/*
Placeholder for custom user CSS
mainly to be overridden in profile/static/custom/custom.css
This will always be an empty file in IPython
*/
/* set toolbar to hide by default */
.notebook_app #maintoolbar {
@sebble
sebble / dme
Last active August 29, 2015 14:01
Command Line Fu
#!/bin/bash
## Pass all files in the PATH to dmenu and execute on success (with sorting by usage frequency)
tmp_bin=$(tempfile)
echo $PATH | tr ':' '\n' | xargs ls -1 | grep -Ev '^(/|$)' | sort -u > $tmp_bin
cat ~/.dme_history >> $tmp_bin
tmp_count=$(tempfile)
cat $tmp_bin | sort | uniq -c | sort -sb -k 1,1rn -k 2,2f > $tmp_count
run=$(cat $tmp_count | awk '{print $2}' | dmenu -b -i) && (echo $run >> ~/.dme_history ; $run)
rm $tmp_bin
rm $tmp_count
#!/bin/bash
## Found this somewhere.. not my own work
if [[ -z "$1" ]]; then
echo "Syntax: $0 debfile"
exit 1
fi
DEBFILE="$1"
TMPDIR=`mktemp -d /tmp/deb.XXXXXXXXXX` || exit 1
@sebble
sebble / start-app.sh
Created May 12, 2014 13:05
Start an application inside a screen
#!/bin/bash
screen -d -m -s /path/to/my.app
@sebble
sebble / github.api
Created June 23, 2014 20:43
GitHub, GitLab, Prose.io API comparisons
DELETE /applications/:client_id/tokens
DELETE /applications/:client_id/tokens/:access_token
GET /applications/:client_id/tokens/:access_token
POST /applications/:client_id/tokens/:access_token
GET /authorizations
POST /authorizations
PUT /authorizations/clients/:client_id
DELETE /authorizations/:id
GET /authorizations/:id
PATCH /authorizations/:id