This file contains 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
''' | |
fizzbuzz refers to a quick test to filter applicants for programmer jobs who don't actually know how to code. | |
(see eg, http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/) | |
"pass in a sequence of integers from 1 to 100; | |
for integers that are multiples of three: print “fizz” | |
for integers that are multiples of five print “buzz” | |
for integers that are multiples of five AND three print "fizzbuzz" | |
for remaining integers, print the integer value | |
''' |
This file contains 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
class KeyifyList(object): | |
def __init__(self, inner, key): | |
self.inner = inner | |
self.key = key | |
def __len__(self): | |
return len(self.inner) | |
def __getitem__(self, k): | |
return self.key(self.inner[k]) |
This file contains 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/bash | |
echo "\n\n--- Killing Stupid Adobe Auto Load Crap ---\n\n" | |
launchctl unload -w /Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist | |
launchctl unload -w /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist | |
echo "\n\n--- Done! ---\n\n" |
This file contains 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
rm -rf ~/Library/Application\ Support/Slack/ | |
rm -rf ~/Library/Containers/com.tinyspeck.slackmacgap/ | |
rm -rf ~/Library/Preferences/com.tinyspeck.slackmacgap.plist | |
rm -rf ~/Library/Saved\ Application\ State/com.tinyspeck.slackmacgap.savedState | |
rm ~/Library/Safari/LocalStorage/*slack* |
This file contains 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/bash | |
# Usage: slackpost <token> <channel> <message> | |
# Enter the name of your slack host here - the thing that appears in your URL: | |
# https://slackhost.slack.com/ | |
slackhost=PUT_YOUR_HOST_HERE | |
token=$1 |
This file contains 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
# Use this file to parse the structure of your minilogue programs and libraries (sound banks) | |
# this makes it easy to understand and document a finished sound | |
# run "python mnlgxd.py test.mnlgxdprog" to print the sound in a program name test.mnlgxdprog | |
# or "python mnlgxd.py test.mnlgxdlib 1" to print the second sound in the bank named test.mnlgxdlib | |
import struct, sys, zipfile, fpdf | |
fileStructure = [ | |
("MAGIC", "<4s"), | |
("PROGRAM NAME", "12s"), |
This file contains 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
# http://en.wikipedia.org/wiki/Extreme_points_of_the_United_States#Westernmost | |
top = 49.3457868 # north lat | |
left = -124.7844079 # west long | |
right = -66.9513812 # east long | |
bottom = 24.7433195 # south lat | |
def cull(latlngs): | |
""" Accepts a list of lat/lng tuples. | |
returns the list of tuples that are within the bounding box for the US. | |
NB. THESE ARE NOT NECESSARILY WITHIN THE US BORDERS! |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
Go to Google Bookmarks: https://www.google.com/bookmarks/ | |
On the bottom left, click "Export bookmarks": https://www.google.com/bookmarks/bookmarks.html?hl=en | |
After downloading the html file, run this script on it to generate a KML. | |
""" |
This file contains 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
# Klein Tools TI250 image tool by Scott Smitelli. Public domain. | |
# Requires at least Python 3.6 (developed and tested on 3.9) | |
# See https://www.scottsmitelli.com/articles/klein-tools-ti250-hidden-worlds | |
import argparse | |
import numpy as np | |
import re | |
import struct | |
from PIL import Image, ImageDraw |
This file contains 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
from subprocess import Popen, PIPE | |
from time import sleep | |
# run the shell as a subprocess: | |
p = Popen(['python', 'shell.py'], | |
stdin = PIPE, stdout = PIPE, stderr = PIPE, shell = False) | |
# issue command: | |
p.stdin.write('command\n') | |
# let the shell output the result: | |
sleep(0.1) |