Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Cranny tkcranny

  • Brisbane, Australia
View GitHub Profile
@tkcranny
tkcranny / check_output_concurrent.py
Last active Nov 27, 2017
Simple script to run a shell command multiple times very quickly and concurrently, and report on the failure rate.
View check_output_concurrent.py
#!/usr/bin/env python
"""
Simple script to run a shell command repeatedly using concurrent
subprocesses. Shows a pretty progress bar, and prints a percentage of
times the command failed.
Took a ~20 minute sequence of `npm run test` to under 2 minutes.
"""
@tkcranny
tkcranny / Open in iTerm.workflow
Last active Aug 29, 2019
macOS Sierra Automater service to open iTerm2 from a finder window
View Open in iTerm.workflow
-- Adapted from these sources:
-- http://peterdowns.com/posts/open-iterm-finder-service.html
-- https://gist.github.com/cowboy/905546
-- https://gist.github.com/ttimasdf/7bb02ed419db4b472b534e1a57008a3b
--
-- Modified to work with files as well, cd-ing to their container folder
on run {input, parameters}
tell application "Finder"
set my_file to first item of input
set is_folder to (do shell script "file -b " & quoted form of (POSIX path of my_file))
View Comp
echo -e "\e[36m================================================================================"
echo -e "\e[35mWarnings:\e[33m"
gcc -Wall -ansi -pedantic thebox.c -o thebox
echo -e "\e[35mCompilation Complete\e[33m"
echo -e "\e[36m================================================================================\e[0m"
@tkcranny
tkcranny / desktop.py
Created Jun 6, 2013
Simple script to retreive the highest rated (1080p) image from reddit.com/r/wallpapers and apply it as the windows desktop image.
View desktop.py
import urllib2, ctypes
import os, re
from time import sleep
__author__ = "Thomas Cranny"
__version__ = "1.0"
def CheckConnection(checks=5*60, delay=1):
for i in range(checks):
try: