Skip to content

Instantly share code, notes, and snippets.

View jettero's full-sized avatar
🕸️
Hliðskjálf

Paul Miller jettero

🕸️
Hliðskjálf
View GitHub Profile
@jettero
jettero / qw.js
Created December 10, 2010 16:40
I wanted a way to quickly test some html templates I was barfing up...
/*jslint white: false, onevar: false, laxbreak: true, maxerr: 500000
*/
/*global require console process
*/
var http = require('http'),
url = require('url'),
fs = require('fs');
function mystat(path) {
@jettero
jettero / joe.pl
Created August 4, 2011 01:54
a curious little number encoder
#!/usr/bin/perl
use common::sense;
use Math::BigInt;
my $orig = $ARGV[0] ? Math::BigInt->new(shift) : Math::BigInt->new(1 . (0 x 3000)) + 7;
my $res = blog_reduce($orig);
print stringify_series( $res ), "\n";
@jettero
jettero / bug.pl
Last active December 15, 2015 19:19
package dumb_thing;
use strict; use warnings;
use Tie::Array;
use Carp;
use base 'Tie::StdArray';
sub TIEARRAY {
my $class = shift;
my $this = bless [], $class;
#!/usr/bin/perl
use strict;
for my $pid (1..32000) {
if( open IN, "/proc/$pid/cmdline" ) {
my @x = <IN>;
my $x = `ps $pid | tail -n +2`;
s/[^\/\.\-\_\d\w]/ / for @x;
#!/bin/bash
# don't run this, source it
# source cisco-like-help.sh
function ciscolikehelp() {
if [[ $READLINE_POINT=${#READLINE_LINE} && "$READLINE_LINE" =~ \ $ ]]; then
cmd="$( sed -e 's/.*[;|]//' -e "s/ .*//g" <<< "$READLINE_LINE" )"
pcmd=$( type -P $cmd )
TYPE=$( type -t ${pcmd:-$cmd} )
s/\x00/␀/g; # seems like 00 => 2400
s/\x07/␇/g; # and 07 => 2407 … implies that there's
# an easy transform that would literally do
# \x00 — \0x20 → \u2400 — \u2420 automatically.
# damned if I know it though.
__END__
#perl corgifex suggests something like: "\0\1\2"; s/([\x00-\x1f])/"\x{2400}" | $1/eg
@jettero
jettero / Vendor_05ac_Product_0220.kcm
Last active July 30, 2017 17:39
Android Keymap and Charmap files — that I used to reverse the Fn key results for my Anker® T300 Ultra-Slim Mini Bluetooth 3.0 Wireless Keyboard
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@jettero
jettero / .chrome-remote-desktop-session
Last active February 4, 2016 07:27
Chrome Remote Desktop, actual remote desktop instead of a remote X session
#!/bin/bash
ACTUAL_DISPLAY=:0
NUM=$(echo $DISPLAY | sed s/://)
PORT="55$NUM"
TARGET=127.0.0.1:$PORT
function killthemall() {
echo;echo "-----------------:= $(date) killing all running vncviewers and x11vncs"
for tokill in x11vnc vncviewer; do
@jettero
jettero / .vimrc
Last active August 29, 2015 14:08
Got tired of having all those swap files in the current dir and having them sync over Dropbox or show up in git tracking GUI windows and things
" … blah …
" WARNING: There are probably security problems with using /tmp/ for this!!! \o/
" If this directory isn't owned by the current user and not world writable,
" it's highly likely nefarious evildoers could elite haxx into your vim
" memories through the swap files. (… project for later …)
" (:-2 to remove end of line)
" &g:directory is the global option directory
" let &g:directory="poo" is roughly equiv to set dir=poo
#!/usr/bin/perl
use common::sense;
my $trials = shift // 1_000;
my $orig_t = $trials;
my $DOORS = shift // 3;
my $switch_wins = 0;
my $stay_wins = 0;