Skip to content

Instantly share code, notes, and snippets.

View whacked's full-sized avatar

whacked

  • let's do something cool together.
  • sillycon belly
View GitHub Profile
@whacked
whacked / gist:583811
Created September 17, 2010 06:21
example of reading yaml into a matlab struct via java interop
%% read YAML and put into matlab struct
%% http://code.google.com/p/snakeyaml/
import('org.yaml.snakeyaml.Yaml');
yamlreader = Yaml();
yml = fileread(yml_filepath);
jymlobj = yamlreader.load(yml);
num_question = jymlobj.size;
package org.devboy.hxTask;
import neko.Lib;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.Type;
class ComponentMacro
{
private static var idCount = 0;
@whacked
whacked / celerypolling.py
Created August 29, 2014 06:34
minimal runnable example of Flask + celery worker + jquery progress polling
'''
testing celery progress reporting/polling
* start server
python tempserver.py
* start worker
celery -A tempserver worker -c 1 --loglevel=DEBUG
@whacked
whacked / round_progress_bar.html
Created September 13, 2014 20:54
example jQuery plugin to make a media player button with circular progress indicator
<!-- modified/converted from http://blog.invatechs.com/round_progress_bar_with_html5_css3_and_javascript -->
<style>
.loader
{
position: relative;
width: 20px;
height: 20px;
float:left;
user-select: none;
box-sizing: border-box;
@whacked
whacked / core.clj
Created October 10, 2014 00:46
Glenn's ringtone
(ns ringtone.core
(:use [overtone.live]
[overtone.inst.piano]))
(def state
(atom {:measure-number 0
:is-running true}))
(let [
;; milliseconds for each tick
increment 100
(defn collect-into-consecutive
"collect indexes into sets of N consecutive indexes,
discarding all other indexes.
N defaults to 6 (for guitar tabs)"
([index-list]
(collect-into-consecutive index-list 6))
([index-list required-length]
@whacked
whacked / gist:86d764a9e2b2607da741
Created February 6, 2015 16:17
traverse ncbi taxonomy?
'''
> head nodes.dmp
1 | 1 | no rank | | 8 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | |
2 | 131567 | superkingdom | | 0 | 0 | 11 | 0 | 0 | 0 | 0 | 0 | |
6 | 335928 | genus | | 0 | 1 | 11 | 1 | 0 | 1 | 0 | 0 | |
7 | 6 | species | AC | 0 | 1 | 11 | 1 | 0 | 1 | 1 | 0 | |
9 | 32199 | species | BA | 0 | 1 | 11 | 1 | 0 | 1 | 1 | 0 | |
10 | 135621 | genus | | 0 | 1 | 11 | 1 | 0 | 1 | 0 | 0 | |
11 | 1707 | species | CG | 0 | 1 | 11 | 1 | 0 | 1 | 1 | 0 | |
13 | 203488 | genus | | 0 | 1 | 11 | 1 | 0 | 1 | 0 | 0 | |
@whacked
whacked / traverse.m
Created February 6, 2015 17:07
ncbi taxonomy in matlab (incomplete -- see DANGER)
function traverse(node_id, iter)
if nargin < 2
iter = 0;
end
% > head names.dmp
% 1 | all | | synonym |
% 1 | root | | scientific name |
% 2 | Bacteria | Bacteria <prokaryote> | scientific name |
@whacked
whacked / modtime
Last active August 29, 2015 14:16
date >> OUT.txt
$files = Get-ChildItem "C:\Users\Public\Memrise\*.txt"
for ($i=0; $i -lt $files.Count; $i++) {
Add-Content -Value "==================" -Path OUT.txt
Add-Content -Value $files[$i].FullName -Path OUT.txt
Add-Content -Value "CREATION" -Path OUT.txt
Add-Content -Value $files[$i].CreationTime -Path OUT.txt
Add-Content -Value "LASTACCESS" -Path OUT.txt
@whacked
whacked / watcher.py
Created April 10, 2015 18:48
watchdog skeleton
# -*- coding: utf-8 -*-
# ref http://pythonhosted.org//watchdog/quickstart.html#a-simple-example
'''
watchdog skeleton
'''
import sys
import time
import datetime