Skip to content

Instantly share code, notes, and snippets.

@plugnburn
plugnburn / README.md
Last active August 29, 2015 14:04
DualWarp - a universal bootloader for data:URIs and external scripts to be usable in redirectable URLs

Overview

DualWarp is a simple 134-byte bootloader for URIs and external scripts. It was created for users who want their data: URIs and external script to be allowed for shortening and cloaked execution. You just host this single HTML file and then pass whatever you want (data: URI or external Javascript link) into the URL hash.

Usage

Note that when you call external script, it may be served as any MIME-type, so hacks like [Giffer] (https://gist.github.com/plugnburn/3364bc56ecc820534143) will also work when your JS is embedded into a GIF and uploaded to an image hosting.

@plugnburn
plugnburn / zw.js
Last active August 29, 2015 14:05
Zero-Width encoder/decoder with autodetection feature in 400 bytes
ZW={enc:function(s){return unescape(encodeURIComponent(s)).split("").map(function(c){return("00000000"+c.charCodeAt(0).toString(2)).substr(-8)}).join("").replace(/0/g,"\u200b").replace(/1/g,"\u200c")},dec:function(s){return(s=s.match(/[\u200b\u200c]{8}/g))&&decodeURIComponent(escape(s.map(function(c){return String.fromCharCode(parseInt(c.replace(/\u200b/g,0).replace(/\u200c/g,1),2))}).join("")))}}
@plugnburn
plugnburn / watchcoder.sh
Last active August 29, 2015 14:05
WatchCoder - encode any number from 0 to 5183999 to the values you can store in your Casio electronic watch, decode the stored values back into number
#!/bin/bash
# The WatchCoder method guarantees to encode an unsigned 22-bit (or signed 21-bit converted to unsigned)
# integer into the values present in any electronic Casio watch: an alarm setting and 1-hour stopwatch
# Maximal theoretically encodable unsigned value is 5183999
case "$1" in
num2watch)
[ -z "$2" ] && echo "Specify the number to encode" && exit 1
NUM=$2
SWDABS=$(($NUM / 1440))
ALMABS=$(($NUM % 1440))
@plugnburn
plugnburn / README.md
Last active August 29, 2015 14:06
SMSPP: Short Message Security

SMSPP: Short Message Security

Overview

SMSPP (stands for Short Message Security - Pencil and Paper) is a simple, pencil-and-paper based protocol to exchange very short encrypted messages via commonly available communication channels with a limited character set (such as SMS, hence the name).

SMSPP Workflow

@plugnburn
plugnburn / anonstrap.sh
Created November 2, 2014 15:40
AnonStrap - experimental anonymous posting engine using DualWarp-type loader, StrapdownJS renderer and TinyURL API
#!/bin/bash
#Usage: anonstrap.sh [your markdown file] ["optional title"]
LOADER="http://bl.ocks.org/anonymous/raw/f15ba2c3e3ea8742ced3/"
INMD="$1"
TITLE="$2"
[ -z "$TITLE" ] && TITLE="Anonymous post"
INPUT="$(<$INMD)"
HTML="<!DOCTYPE html><html><head><meta charset=utf-8><title>${TITLE}</title></head><xmp style='display:none'>${INPUT}"'</xmp><script src="http://strapdownjs.com/v/0.2/strapdown.js"></script></html>'
B64=$(echo -n "$HTML"|base64 -w 0)
DATAURL="data:text/html;charset=utf-8;base64,$B64"
@plugnburn
plugnburn / tweetgrid.css
Last active August 29, 2015 14:17
TweetGrid: a tweet-sized (137 bytes) fork of ungrid.css with pixel media limit, shorter class names and two helper classes for one-third and one-fourth layout cases
@media(min-width:481px){.gr{width:100%;display:table;table-layout:fixed}.gc{display:table-cell}.gc.f3{width:33.333333%}.gc.f4{width:25%}}
@plugnburn
plugnburn / neogrid.css
Last active August 29, 2015 14:17
neoGrid
.row{width:100%;display:table;table-layout:fixed;border-collapse:collapse;margin:0;padding:0}
.row.auto{table-layout:auto}
.col,.col1,.col2,.col3,.col4,.col5,.col6,.col7,.col8,.col9,.col10,.col11,.col12{display:table-cell;border:hidden;vertical-align:top;margin:0;padding:0}
.vpos-middle{vertical-align:middle}
.vpos-bottom{vertical-align:bottom}
.col1{width:8.333333%;width:-webkit-calc(100%/12);width:-moz-calc(100%/12);width:calc(100%/12)}
.col2{width:16.666666%;width:-webkit-calc(100%/6);width:-moz-calc(100%/6);width:calc(100%/6)}
.col3{width:25%}
.col4{width:33.333333%;width:-webkit-calc(100%/3);width:-moz-calc(100%/3);width:calc(100%/3)}
.col5{width:41.666666%;width:-webkit-calc(500%/12);width:-moz-calc(500%/12);width:calc(500%/12)}
@plugnburn
plugnburn / barbust.js
Created March 26, 2015 12:14
BarBust - a JS hack to hide mobile browser's address bar on load or handheld rotation
if('addEventListener'in self && 'pageYOffset'in self && !location.hash.substr(1)) {
(function(c){
self.addEventListener('DOMContentLoaded',c,!1);
self.addEventListener('orientationchange',c,!1)
})(function(){
setTimeout(function(P){
P=self.pageYOffset;
self.scrollTo(0,1);
if(self.pageYOffset) self.scrollTo(0,0);
if(P>20) self.scrollTo(0,P)
@plugnburn
plugnburn / stego-bookmarklet
Last active August 29, 2015 14:17
tweetStego
javascript:(function(s){s=document.createElement('script');document.body.appendChild(s);s.onload=function(){TSWidget()};s.src='https://cdn.rawgit.com/plugnburn/bc773a2f912acba406ef/raw/tweetStego.js'})(),void 0
@plugnburn
plugnburn / LICENSE.txt
Last active December 20, 2015 09:49 — forked from 140bytes/LICENSE.txt
Myth programming language reference implementation
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 plugnburn
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE