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
#!/usr/bin/env bash | |
curl --silent --fail -4 api64.ipify.org "$@" || | |
curl --silent --fail https://httpbin.org/ip "$@" | jq --raw-output .origin |
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
#!/usr/bin/env perl | |
# Generate TMDS codes (for DVI / HDMI) | |
# Takes decimal numbers 0-255 on stdin and emits ASCII binary numbers on stdout. | |
# Emits 462 unique codes where the standard expects 460; the user should reject | |
# the two zero-transition codes it produces. | |
use strict; | |
use warnings; | |
# LSb first | |
sub unbitarray ($$) { unpack "S", pack "b$_[0]", join "", @_[0 .. $#_] } |
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
*.o | |
main |
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
function intersect_n() | |
{ | |
var aoa = Array.prototype.slice.call(arguments); | |
var c = []; | |
var indexes = aoa.map(function(v) { return 0 }); | |
while (aoa.every(function(curr,i) { return indexes[i] < curr.length })) { | |
var currs = aoa.map(function(curr,i) { return curr[indexes[i]] }); | |
var max = Math.max.apply(null, currs); | |
aoa.forEach(function(curr,i) { while (curr[indexes[i]] < max) indexes[i]++; }); |
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 -e | |
HOSTED_ZONE_IP=/hostedzone/CHANGEME | |
DOMAIN=CHANGEME | |
TTL=300 | |
my_ip=$HOME/.my_ip | |
IP=$(dig +short myip.opendns.com @resolver1.opendns.com) | |
if [ "$IP" = "$(cat $my_ip)" ] | |
then | |
exit 0 |
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
#include <stdint.h> | |
#include <stdio.h> | |
#include <limits.h> | |
static inline uint32_t rol(uint32_t x, unsigned char y) | |
{ | |
return (x << y) | ((x >> (32 - y)) & ~(-1 << y)); | |
} | |
static void chunk(uint32_t h[5], unsigned char *ptr) |
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
{ patterns = ( | |
{ name = 'variable'; | |
match = '\b([A-Pa-p])\b'; | |
}, | |
{ name = 'string.quoted.double'; | |
begin = '"'; | |
end = '"'; | |
}, | |
{ name = 'string.quoted.single'; | |
begin = "'"; |
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
#!/usr/bin/env perl | |
# export PAGER="ansi16_to_ansi256.pl | ${PAGER:-less -R}" | |
use strict; | |
use Color::ANSI::Util qw(ansi16_to_rgb rgb_to_ansi256); | |
my $esc = qr/\x1b\[/; | |
my $fg = qr/3\d/; | |
my $bg = qr/4\d/; | |
my $seq = qr/$esc((?:$fg|$bg)(?:;(?:$fg|$bg))*)m/o; |
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
#include "huffman.h" | |
int huff_decode(const dict_entry *dict, char *out, const huff_word **in, | |
size_t *len, size_t *bits, size_t *off) | |
{ | |
const dict_entry *n = dict; | |
int found = 0; | |
while (!found && *len && *off < *bits) { | |
unsigned char bit = (**in >> *off) & 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my @queue = map { [ /(\S+)\s*=\s*(\d+)/, undef ] } <>; | |
my $total = 0; | |
my $bitlen = 0; | |
my $keys = 0; | |
while ((@queue = sort { $a->[1] <=> $b->[1] } @queue) > 1) { |
NewerOlder