Skip to content

Instantly share code, notes, and snippets.

View InPermutation's full-sized avatar

Jacob Krall InPermutation

View GitHub Profile
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Undercover communication
It should be obvious by now, that the only way to communicate
stealthily and securely is to avoid raising suspicion to the
level at which the authorities might consider it worthwhile
to put you under active surveillance (e.g., park a van with
TEMPEST equipment by your apartment).
@InPermutation
InPermutation / rot13.bf
Created October 24, 2013 15:18
wondering what Brainfuck syntax highlighting even looks like
-,+[ Read first character and start outer character reading loop
-[ Skip forward if character is 0
>>++++[>++++++++<-] Set up divisor (32) for division loop
(MEMORY LAYOUT: dividend copy remainder divisor quotient zero zero)
<+<-[ Set up dividend (x minus 1) and enter division loop
>+>+>-[>>>] Increase copy and remainder / reduce divisor / Normal case: skip forward
<[[>+<-]>>+>] Special case: move remainder back to divisor and increase quotient
<<<<<- Decrement dividend
] End division loop
]>>>[-]+ End skip loop; zero former divisor and reuse space for a flag
@InPermutation
InPermutation / gist:6625573
Created September 19, 2013 15:55
Check if a treeish is a ref or a (partial) sha
$treeish = "my_tag"
# $treeish = "my_branch"
# $treeish = "900fe0a22ea332fcbfdb4b0bc7136760ea30cc19"
# $treeish = "900fe0a22"
$exists = [bool](git rev-parse --quiet --verify $treeish)
$ref = [bool](git show-ref $treeish)
$sha = -not $ref
# Check if it's a tag. (Careful; --list uses shell wildcard syntax)
using System;
using System.Threading;
class A {
static Point currentPos = new Point(1,2);
class Point {
public int x;
public int y;
public Point(int x, int y) {
this.x = x;
@InPermutation
InPermutation / mini-profiler-histogram.js
Created July 16, 2013 20:38
MiniProfiler .profiler-label histogram hack
(function(){
var common={};
$("td.profiler-label").each(function(){var txt= $(this).text().trim(); if(!(txt in common))common[txt]=0; common[txt]++; });
var rg=[];
for(var c in common)
rg.push({name: c, val: common[c]});
rg.sort(function(a,b){return b.val-a.val;});
return rg;})();
/////////////////////////////////////////////////////////////////////////////
// Dispatch map
BEGIN_DISPATCH_MAP(CCircCtrl, COleControl)
//{{AFX_DISPATCH_MAP(CCircCtrl)
DISP_PROPERTY_NOTIFY(CCircCtrl, "CircleShape", m_circleShape, OnCircleShapeChanged, VT_BOOL)
DISP_PROPERTY_NOTIFY(CCircCtrl, "FlashColor", m_flashColor, OnFlashColorChanged, VT_COLOR)
DISP_PROPERTY_EX(CCircCtrl, "CircleOffset", GetCircleOffset, SetCircleOffset, VT_I2)
DISP_PROPERTY_EX(CCircCtrl, "Note", GetNote, SetNote, VT_BSTR)
DISP_STOCKPROP_BACKCOLOR()
if (a[o + 22 | 0] << 24 >> 24 == 24) {
if (!(Vp(d, o | 0) | 0)) {
break
}
p = (c[m >> 2] | 0) + (((c[h >> 2] | 0) - 1 | 0) * 40 & -1) + 12 | 0;
q = o + 28 | 0;
c[p >> 2] = c[q >> 2] | 0;
c[p + 4 >> 2] = c[q + 4 >> 2] | 0;
c[p + 8 >> 2] = c[q + 8 >> 2] | 0;
c[p + 12 >> 2] = c[q + 12 >> 2] | 0;
@import <foundation>
@implementation Person : CPObject
{
CPString name;
}
+ (id)personWithName:(CPString)aName
{
return [[self alloc] initWithName:aName];
}
- (id)initWithName:(CPString)aName
@InPermutation
InPermutation / Applet.java
Created June 13, 2013 02:39
The example applet from Wikipedia
import java.applet.Applet;
import java.awt.*;
// Applet code for the "Hello, world!" example.
// This should be saved in a file named as "HelloWorld.java".
public class HelloWorld extends Applet {
// This method is mandatory, but can be empty (i.e., have no actual code).
public void init() {
}
@InPermutation
InPermutation / gravataresponsive.js
Created May 13, 2013 22:26
gravatar.com URL resizing on DPI change (this is stupid)
setInterval(function(){
if(window.devicePixelRatio > 1) {
jQuery('img.profilePic').each(function(){
var el=this;
if(!el.src.contains('gravatar.com')) return;
el.src = el.src.replace(/\bs=(\d+)/,
function(match, px) {
return "s="+Math.round(window.devicePixelRatio*jQuery(el).innerWidth());
});
});