Skip to content

Instantly share code, notes, and snippets.

In [1]: %matplotlib qt
In [2]: import numpy as np
In [3]: import pandas
In [4]: x = np.random.rand(1, 100) * 100
In [5]: x
Out[5]:
function uid(key){
return 'Symbol(' + key + ')_' + (++sid + Math.random()).toString(36);
}
uid.safe = require('./$').g.Symbol || uid;
module.exports = uid;
},{"./$":33}],43:[function(require,module,exports){
// 22.1.3.31 Array.prototype[@@unscopables]
var $ = require('./$')
, UNSCOPABLES = require('./$.wks')('unscopables');
if($.FW && !(UNSCOPABLES in []))$.hide(Array.prototype, UNSCOPABLES, {});
# What I have for the JSX:
/*
<button onClick={this.loadMore} data-style="expand-right" className={loadMoreClasses}>
<span className="ladda-label">Load More</span>
</button>
*/
<button onClick={this.previous}>Previous</button>
<button onClick={this.next}>Next</button>
vagrant@precise64:/etc/apt$ sudo apt-get update
Ign http://ppa.launchpad.net precise InRelease
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main amd64 Packages
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
json = reward.json(req=self.request)
json['notification']['message'] = 'bullshit'
self.response['view'] = json
kiip ➤ jshint --show-non-errors static/js/Kiip/Kiip.Reward.Unit.js
static/js/Kiip/Kiip.Reward.Unit.js :
Implied globals:
Class: 4,6
document: 39,56,57,58,59,60,61,62,63,165,167,235,315,363
window: 53,100,126,133,139,141,147,154,160,163,164,166,168,175,178,185,198,204,210,216,220,230,273,279,282,303,307,310,319,321,333,349,426,431,444,447,452,470,475,489,490,491,498,499,503,505
Element: 73,192,196,201,207,213,227,233
event: 343,344
# Error
TASK: [create foobar database user] ***********************************
failed: [ec2-184-73-128-96.compute-1.amazonaws.com] => {"failed": true, "item": ""}
msg: unable to connect to database: FATAL: Peer authentication failed for user "postgres"
# Playbook
---
- hosts: dbservers
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
WARN [watcher]: Pattern "/Users/nickhs/sandpit/shepherd/tests/javascripts/test.js" does not match any file.
INFO [PhantomJS 1.9 (Mac)]: Connected on socket id V_1vqoE7_20FR9u6YQSj
PhantomJS 1.9 (Mac) ERROR
TypeError: 'undefined' is not a function (evaluating 'window.addEvent('domready', function() {
new Main();
})')
at /Users/nickhs/sandpit/shepherd/static/js/index.js:3
PhantomJS 1.9 (Mac): Executed 0 of 0 ERROR (0.073 secs / 0 secs)
import requests
from subprocess import call
import time
URL = "http://proximobus.appspot.com/agencies/sf-muni/stops/17421/predictions.json"
INTERVAL = 30 # seconds
def say(to_say):
call(['espeak', '-a', '15', str(to_say)])
@nickhs
nickhs / gist:5392647
Created April 16, 2013 01:24
Decrypt cookie
# Cookie is named session in the client browser, is set to persist across subdomains (so foobar.com and app.foobar.com will
# still be valid).
#!/usr/bin/env python
import base64
cookie = 'eyJjb21wYW55IjoiZm9vYmFyIiwidXNlcl9pZCI6NSwiZW1haWwiOiJuaWNrQG5pY2tocy5jb20ifQ.BE43Cw.7CUdWGN2mjcKsRdOOtrIamCv09s'
info, timestamp, signature = cookie.split('.')
padding = -len(info) % 4 * '='
info = info + padding