Skip to content

Instantly share code, notes, and snippets.

View n8henrie's full-sized avatar

Nathan Henrie n8henrie

View GitHub Profile
@n8henrie
n8henrie / Average Internet Speed.ipynb
Last active March 28, 2019 18:47
My average internet speed over the last year or so
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@n8henrie
n8henrie / whois.py
Last active April 2, 2020 07:18
Python transliteration of whois tool, taken from http://code.activestate.com/recipes/577364-whois-client/
"""
Whois client for python
https://gist.github.com/n8henrie/dc55b8fb366710003b5d3c557dfc4469
transliteration of:
http://www.opensource.apple.com/source/adv_cmds/adv_cmds-138.1/whois/whois.c
The MIT License (MIT)
@n8henrie
n8henrie / dateformat.py
Created May 18, 2017 13:49
Format free text date in yyyymmdd format
"""dateformat.py :: Format free text date in yyyymmdd format."""
@n8henrie
n8henrie / newpost.py
Last active March 14, 2017 17:54
Create a new draft for n8henrie.com
"""newpost.py :: Create a new draft for n8henrie.com
Args:
--drafts-dir: Path to drafts directory
"""
import datetime
import argparse
@n8henrie
n8henrie / notifier.pl
Created December 11, 2016 04:18
irssi script to notify via Notification Center if I'm mentioned by nickname or receive a DM
# Script for irssi to trigger macOs Notification Center
# Nathan Henrie (modifications, ©2016)
# Inspired by https://github.com/paddykontschak/irssi-notifier/blob/master/notifier.pl
#
# Currently notifies if mentioned by nickname or if PMed
# Only sends a static message to avoid arbitrary command execution by `system`
#
## Installation:
# Copy to `~/.irssi/scripts/` (and symlink to `~/.irssi/scripts/autorun` if desired)
@n8henrie
n8henrie / time_stuff.py
Last active November 22, 2016 18:38
Gist of simple timing comparisons in Python
"""time_stuff.py :: A bunch of `timeit` comparisons for different snippets.
The module just loads the tests, so you can run specific examples interactively
if desired:
$ python3 -i <(curl -s https://gist.githubusercontent.com/n8henrie/db6880e2c84df153c5ae19d5dba16757/raw)
>>> find_vs_split_vs_re()
Best of 10000 runs over 5 repeats
test_find: 0.0087874069577083
test_split: 0.013382209988776594
@n8henrie
n8henrie / ScratchpadMe.applescript
Last active November 14, 2016 16:47
Quicksilver Action to add Quicksilver contents to my "scratchpad" with a timestamp
property test_str : "This is a test note."
on process_text(str)
set time_str to current date
try
tell application "Notes"
-- log (get properties of first note)
set scratchpad to first note whose name is "#scratchpad #scratchpad"
set notebody to body of scratchpad
// Downloads all Project Euler problems into directory `outdir`
// With queue of 10 runs in about 43 seconds for 582 problems
// Python asyncio solution was about 42 secs
package main
import (
"bytes"
"fmt"
"log"
@n8henrie
n8henrie / .gitignore
Last active October 6, 2023 18:32
Download and install Golang for Raspberry Pi
go*.linux-armv6l.tar.gz
@n8henrie
n8henrie / strip_whitespace.applescript
Created July 7, 2016 19:32
Quicksilver Action to strip leading and trailing whitespace
property test_block_text : "
this and
that and
asdf
"
on process_text(block_text)
-- AppleScript and Quicksilver are using code "e2 80 a8" as linebreak for some reason
-- inspect by piping to `hexdump -C` and viewing with `echo -e`
set perl to "/usr/bin/perl -0777 -pe 's#(^[[:space:]\\xe2\\x80\\xa8]*)|([[:space:]\\xe2\\x80\\xa8])*$##g' <<<"