Skip to content

Instantly share code, notes, and snippets.

View dsjoerg's full-sized avatar
🎯
Focusing

David Joerg dsjoerg

🎯
Focusing
View GitHub Profile
@dsjoerg
dsjoerg / battlegram.js snippet
Created February 5, 2012 02:57
the heart of the code for updating highcharts chart
function updateData() {
for (i=0; i<2; i++) {
chart.series[i == 0 ? 1 : 0].setData(thedata[roundNum][i]);
}
if (roundNum < thedata.length-1) {
roundNum++;
}
setTimeout(updateData, 15);
}
@dsjoerg
dsjoerg / enforcer.sh
Created February 21, 2014 01:05
This bash script runs every minute on my home server, keeps me from staying up too late.
#!/bin/bash
# Usage: enforcer.sh
curfew_active=`curl -s http://superego.herokuapp.com/api/v1/curfew/is_active`
curfew=`curl -s http://superego.herokuapp.com/api/v1/curfew/compute`
now=`date`
if [ $curfew_active == 'true' ]
then
i have been shaking my head a lot the last 36 hours. first thing i
would say, michael and brad, shame on both of you for falsely accusing
literally thousands of people and possibly scaring millions of
investors in an effort to promote a business model. sue, it's a very,
very old tactic to try to build a business on the planks of fear,
mistrust and accusation. this has certainly taken that to a new
level. it reflects either an unwillingness -- a continued lack of
understanding about how the market operates or just unwillingness to
acknowledge it, because you're trying to launch a new business and you
want to get volunteer platform. let me try to weigh in here. you are
@dsjoerg
dsjoerg / gist:3a8870f2d9f55afb1765
Created May 22, 2014 14:24
DJs GET HUGE Workout
1 Jumping Jacks
2 Push ups
3 Standing T
4 Bicep curl
5 Bar on shoulders
6 Bar over head
7 Sit ups
8 Triceps
9 Bench press
10 Plank
@dsjoerg
dsjoerg / sample_output
Last active August 29, 2015 14:03
demonstrating "Bad gameloop values in replays from loaded/saved games"
bash-3.2$ wget -q https://dl.dropboxusercontent.com/u/556553/put_things_here/s2protocol_issue.SC2Replay
bash-3.2$ python ./show_tracker_gameloops.py s2protocol_issue.SC2Replay
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 18, 160, 160, 226, 258, 290, 290, 290, 292, 320, 320, 435, 480, 480, 498, 498, 498, 498, 563, 640, 640, 707, 707, 707, 723, 738, 793, 800, 800, 834, 866, 960, 960, 978, 1120, 1120, 1123, 1123, 1123, 1123, 1124, 1138, 1138, 1138, 1176, 1193, 1218, 1265, 1280, 1280, 1376, 1395, 1395, 1395, 1396, 1
<Response>
<Dial>
<Conference waitUrl="http://twimlets.com/holdmusic?Bucket=com.twilio.music.electronica" waitMethod="GET">d41d8cd98f00b204e9800998ecf8427e</Conference>
</Dial>
</Response>
@dsjoerg
dsjoerg / conf_call.rb
Created December 8, 2014 15:57
conf_call.rb
#!/usr/bin/env ruby
# Usage conf.rb <number>
#
# Will call the number, repeatedly if necessary, and join them to a conference call when they join.
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'
# put your own credentials here
# returns value in decimal hours (e.g. 23.5 = 11:30pm)
def self.compute_curfew(user, verbose = false)
targetHoursSleep = 7.5
targetMinutesSleep = targetHoursSleep * 60
minutesSleptType = ObservationType.find_by!(name: "minutes_slept_jawbone")
curfewType = ObservationType.find_by!(name: "curfew")
lastSleepObservation = DailyObservation.retrieve(minutesSleptType, { beforeDate: Date.today, user: user }).last
@dsjoerg
dsjoerg / curfew_computation.rb
Created December 8, 2015 17:00
curfew_computation.rb
# returns value in decimal hours (e.g. 23.5 = 11:30pm)
def self.compute_curfew(user, verbose = false)
targetHoursSleep = 7.5
targetMinutesSleep = targetHoursSleep * 60
minutesSleptType = ObservationType.find_by!(name: "minutes_slept_jawbone")
curfewType = ObservationType.find_by!(name: "curfew")
lastSleepObservation = DailyObservation.retrieve(minutesSleptType, { beforeDate: Date.today, user: user }).last
was:~ david$ wget 37.187.205.99
--2016-04-16 21:52:57-- http://37.187.205.99/
Connecting to 37.187.205.99:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://lichess.org/ [following]
--2016-04-16 21:52:58-- http://lichess.org/
Resolving lichess.org... 37.187.205.99
Reusing existing connection to 37.187.205.99:80.
HTTP request sent, awaiting response... 303 See Other
Location: http://en.lichess.org/ [following]