Skip to content

Instantly share code, notes, and snippets.

View bpostlethwaite's full-sized avatar

Ben Postlethwaite bpostlethwaite

View GitHub Profile
@bpostlethwaite
bpostlethwaite / extract8TracksGIFs
Created July 25, 2014 15:27
extract all the gif img tags from 8tracks
var tmp = $('<div></div>')
$('body').prepend(tmp)
tmp.css('height', 400)
tmp.css('width', 900)
tmp.css('overflow', 'scroll')
a = $('#feed-container').find('li')
for (var i = 0; i < a.length; i++) {
InfiniteCheeseburger Spiral
http://8tracks.imgix.net/i/002/376/836/I-love-weed-infinite-cheeseburgers-8011.gif
Olive sleep walking
http://8tracks.imgix.net/i/002/376/853/I-love-weed-never-ending-sleep-walking-9251.gif
cellular bio-thing
http://8tracks.imgix.net/i/002/347/582/giphy-1174.gif
awesome pyramid brain rail
http://8tracks.imgix.net/i/001/999/892/tumblr_n3jzcmLUuD1tn7hmso1_500-1226.gif
Infinite Oceans
http://8tracks.imgix.net/i/002/376/856/I-love-weed-symmetrical-oceans-1551.gif
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:PCI address determined earlier"
@bpostlethwaite
bpostlethwaite / post.js
Last active August 29, 2015 14:05
post to plotly /datacache endpoint
$(function(){
var payload;
function getPlotlyGraphData() {
return [{x:[1,2,3],y:[2,4,3]},{x:[1,2,3],y:[9,7,8]}];
}
function getPlotlyGraphLayout() {
return {};
}
$(function(){
'use strict';
var payload;
function getPlotlyGraphData() {
return [{x:[1,2,3],y:[2,4,3]},{x:[1,2,3],y:[9,7,8]}];
}
function getPlotlyGraphLayout() {
return {};
@bpostlethwaite
bpostlethwaite / backup
Created January 1, 2017 00:39
curlable backup script
#!/bin/bash
if [ -z ${1} ]; then
echo "usage: backup [static|dynamic]"
exit 1
fi
# see https://sipb.mit.edu/doc/safe-shell/
set -euf -o pipefail
@bpostlethwaite
bpostlethwaite / deployment.yml
Last active October 18, 2017 03:17
kube potato
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: sentimentextor
spec:
replicas: 1
template:
metadata:
labels:
app: sentimentextor

Additional auth cookies:

  • dash_user
    • signed with itsdangerous.
    • the username appears in clear text in the cookie as user.TOKEN
  • dash_user_data
    • json web signature with itsdangerous.
    • The json web signature is not entirely safe, do not add sensitive data.

The users cookies have no expiry, they are validated by the python package itsdangerous.

@bpostlethwaite
bpostlethwaite / app.py
Last active September 24, 2018 20:21
possible solution for 2 input graph
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
DATA = [
{"value": "MTL", "label": "Montreal", "x": [1, 2, 3], "y": [4, 1, 2]},
{"value": "NYC", "label": "New York", "x": [1, 2, 3], "y": [2, 4, 5]},
{"value": "SF", "label": "San Fransisco", "x": [1, 2, 3], "y": [1, 8, 3]},
{"value": "HOU", "label": "Houston", "x": [1, 2, 3], "y": [3, 4, 12]},
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
import csv
import random
def get_data():