This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pairwise(iterable): | |
"s -> (s0,s1), (s1,s2), (s2, s3), ..." | |
a, b = itertools.tee(iterable) | |
next(b, None) | |
return zip(a, b) | |
def shorten_url(url, maxlength): | |
"""Will shorten a url to the given maximum length by removing the | |
(hopefully) least interesting parts - the ones in the middle. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- JavaScript is def. not batteries included. --> | |
<!-- From http://pastebin.com/B5r3P5Ny --> | |
<script src="http://crypto-js.googlecode.com/files/2.5.3-crypto-sha256.js"></script> | |
<script src="http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js"></script> | |
<script src="http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn2.js"></script> | |
<!-- taken from bitcoinjs almost verbatim --> | |
<script> | |
BigInteger.valueOf = nbv; | |
BigInteger.prototype.toByteArrayUnsigned = function () { | |
var ba = this.toByteArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"hash": "427621A220C2DA6A5791C7EC160C1BE1DF1AECBF78883F8BF3513DAC3B21DAE9", | |
"accepted": true, | |
"closed": true, | |
"parent_hash": "E3804285F2284708A8F3F25BEB3D5DC9710F73BCD9D3ED7B2E4D5235DCD29C6B", | |
"transactions": 3, | |
"totalCoins": "99999998168574101", | |
"ledger_hash": "427621A220C2DA6A5791C7EC160C1BE1DF1AECBF78883F8BF3513DAC3B21DAE9", | |
"transaction_hash": "AA6C38477BB136C87BE0363391509404A435F27DD52107268EDB4BFFBDE2F013", | |
"account_hash": "271103032FA414BE2E662FBCC8B2AACC08E518EAEB7ACB4FDF773001A7154E9A", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UInt160 = require('../src/js/ripple/uint160').UInt160; | |
sjcl = require('../src/js/ripple/utils').sjcl; | |
u = UInt160.from_bits(sjcl.codec.hex.toBits('F4FD179DF34F1C2483618F44CD61F8E0E46BC8F3')) | |
u._version_byte = 0 | |
u.to_json() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Installs tarsnap client on Debian and Ubuntu | |
# | |
# You'll need to setup an account at | |
# http://www.tarsnap.com | |
# and load it with some funds | |
# | |
# Make sure you run this as root | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert an existing docker container into a "docker run" command line. | |
# | |
# This is useful when trying to debug containers that have been created | |
# by orchestration tools. | |
# | |
# Install jq: stedolan.github.io/jq/ | |
function format_run() { | |
cid=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@1ab2badf98de:/hibiscus-server/cfg# /hibiscus-server/jameicaserver.sh -p 234234234234234234 -f /srv/hibiscus2 | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.StartupParams.<init>] starting in SERVER mode | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.StartupParams.<init>] workdir: /srv/hibiscus2 | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.StartupParams.<init>] master password given via commandline | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.Application.init] starting jameica... | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.system.Platform.getWorkdir] using workdir: /srv/hibiscus2 | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.services.SecurityManagerService.init] applying jameica security manager | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.security.JameicaSecurityManager.<init>] protecting program dir /hibiscus-server/ | |
[Mon Jul 07 05:55:37 UTC 2014][INFO][de.willuhn.jameica.services.LockService.init] creati |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/Arnavion/libjass | |
// https://github.com/spiegeleixxl/html5-ass-subtitles/blob/master/assparser.js | |
Subtitles = {}; | |
Subtitles.ASS = function(content) { | |
var linesOfDialog = []; |