Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
⍝ Left rotate ⍺ bit | |
Rot8 ← {2⊥⍺⌽(8⍴2)⊤⍵} | |
⍝ Addition and subtraction in finite field GF(2) | |
Add2 ← {⍺ ⊤≠ ⍵} | |
⍝ Multiplication in GF(2) [x]/(x8 + x4 + x3 + x + 1) | |
Mul2 ← {⊤≠/({⍵,$FF ⊤∧ ($11B×$80≤¯1↑⍵) ⊤≠ 2ׯ1↑⍵}⍣7 ⍺) × ⌽(8⍴2)⊤⍵} | |
⍝ Multiplicative inverse, calculated by brute force | |
Mul2Inv ← {$FF ⊤∧ 1⍳⍨⍵ Mul2¨⍳255} | |
SBox ← {⊤≠/$63,(1-⍨⍳5) Rot8¨Mul2Inv ⍵}¨1-⍨⍳256 |
bind -T root F12 \ | |
set prefix None \;\ | |
set key-table off \;\ | |
set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\ | |
set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\ | |
set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\ | |
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\ | |
refresh-client -S \;\ | |
bind -T off F12 \ |
#!/bin/sh | |
# Brainfuck interpreter implemented in pure POSIX sh builtins only (except I/O) | |
# Tested in bash and busybox ash (getchar uses a bash-specific read) | |
# === I/O === | |
getchar() { | |
# bashism | |
IFS= read -rN 1 a | |
if [ -z "$a" ]; then | |
echo $th |
// By Simon Lydell 2015. | |
// This file is in the public domain. | |
var stdin = require("get-stdin") | |
var tools = require("text-frequencies-analysis") | |
var helpers = require("text-frequencies-analysis/lib/helpers") | |
stdin(function(text) { | |
process.stdout.write(tools.jsonStringifyRow(convert(JSON.parse(text)))) | |
}) |
<?php | |
// Issue 1, empty associative arrays (dictionaries) become regular arrays. | |
$dictionary = array('key' => 'value'); | |
var_dump(json_encode($dictionary)); // gives '{"key":"value"}'; | |
unset($dictionary['key']); | |
var_dump(json_encode($dictionary)); // Gives '[]' -> json dictionary turned into array |
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence | |
(function(win, doc){ | |
if(win.addEventListener)return; //No need to polyfill | |
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}} | |
function addEvent(on, fn, self){ | |
return (self = this).attachEvent('on' + on, function(e){ | |
var e = e || win.event; | |
e.preventDefault = e.preventDefault || function(){e.returnValue = false} | |
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true} |
#!/usr/bin/perl | |
# Add cover images to XMMS2 medialib entries from file. | |
use strict; | |
use Audio::XMMSClient; | |
sub fold(&@) { | |
my $f = shift; | |
local ($a,$b) = (shift,undef); | |
$a = $f->($a, $b) while defined ($b = shift); | |
return $a; |