Skip to content

Instantly share code, notes, and snippets.


Kristopher Johnson kristopherjohnson

Block or report user

Report or block kristopherjohnson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kristopherjohnson / Play White Noise.applescript
Created Feb 15, 2020
AppleScripts for using SoX to play white noise
View Play White Noise.applescript
-- Choose a white noise generator and play.
-- Requires installation of SoX <>
-- With Homebrew: brew install sox
-- Starts a background process. Kill it with command "killall play" or by running the "Stop Playing" script.
set theSynth to ¬
choose from list {"pinknoise", "whitenoise", "brownnoise"} ¬
with prompt ¬
kristopherjohnson / FontsView.swift
Created Jan 4, 2020
SwiftUI view that displays all available fonts in a scrolling list
View FontsView.swift
import SwiftUI
import UIKit
/// Displays all available fonts in a vertically scrolling view.
struct FontsView: View {
private static let fontNames: [String] = {
var names = [String]()
for familyName in UIFont.familyNames {
names.append(contentsOf: UIFont.fontNames(forFamilyName: familyName))
kristopherjohnson / DecodeGlass.swift
Last active Dec 27, 2019
Decoding the "binary codes" on a beer glass gift
View DecodeGlass.swift
import Foundation
let codes: [UInt8] = [
kristopherjohnson / Set Terminal Background Colors.applescript
Created Dec 12, 2019 — forked from MLKrisJohnson/Set Terminal Background Colors.applescript
AppleScript that sets background colors of terminal windows to different colors, for easier identification
View Set Terminal Background Colors.applescript
-- Set background colors of terminal windows to different colors, for easier identification
tell application "Terminal"
set window_colors to
{8192, 0, 0}, ¬
{0, 8192, 0}, ¬
{0, 0, 8192}, ¬
{4096, 4096, 0}, ¬
{0, 4096, 4096}, ¬
{4096, 0, 4096}, ¬
View Hello.applescript
tell application "SpeechRecognitionServer"
set possibleResponses to
"hello", ¬
"good bye", ¬
"good morning", ¬
"good afternoon", ¬
"good night", ¬
"nice to meet you", ¬
"pleased to meet you", ¬
"how are you", ¬
kristopherjohnson / Unfollow_Quiet_Accounts.ipynb
Created Sep 7, 2019
Python script to unfollow Twitter accounts that have not tweeted in the last 400 days
View Unfollow_Quiet_Accounts.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
kristopherjohnson /
Last active May 18, 2019
Translation of classic Lunar Lander game from FOCAL to Rust
//! Translation of
//! <>
//! by Jim Storer from FOCAL to Rust.
use std::error::Error;
use std::io;
use std::io::prelude::*;
use std::marker::{Send, Sync};
use std::process;
use std::str::FromStr;
kristopherjohnson /
Last active Feb 3, 2020
Script for generating iOS app icons in all necessary sizes
# Given a source image, create icons in all sizes needed for an iOS app icon.
# See <> for details.
# First (required) argument is path to source file.
# Second (optional) argument is the prefix to be used for the output files.
# If not specified, defaults to "Icon-".
kristopherjohnson / log.swift
Last active Sep 8, 2018
Simple Swift logging functions
View log.swift
import Foundation
extension String {
/// Return last path component.
public var lastPathComponent: String {
return (self as NSString).lastPathComponent
/// Write a message to the system log.
kristopherjohnson /
Last active Aug 12, 2018
Delete all tweets that are listed in a tweets.csv archive that are over 90 days old
#!/usr/bin/env python
"""Deletes all tweets in your 'tweets.csv' archive older than 90 days.
You can obtain your 'tweets.csv' archive by going to
<>, requesting your archive,
downloading it, and then extracting the 'tweets.csv' file.
from __future__ import print_function
You can’t perform that action at this time.