Skip to content

Instantly share code, notes, and snippets.

@steverichey
steverichey / DontMovePreloader
Created December 18, 2013 18:23
Custom Preloader for HaxeFlixel, used in Don't Move
package;
import flash.Lib;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flixel.system.FlxPreloader;
import flash.events.Event;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
@steverichey
steverichey / Iconizer.sh
Last active February 23, 2022 17:40
Create iOS application icons from one PDF file. Requires ImageMagick.
#!/bin/sh
#
# Iconizer shell script by Steve Richey (srichey@floatlearning.com)
#
# This is a simple tool to generate all necessary app icon sizes and the JSON file for an *EXISTING* Xcode project from one file.
# To use: specify the path to your vector graphic (PDF format) and the path to your Xcode folder containing Images.xcassets
# Example: sh iconizer.sh MyVectorGraphic.pdf MyXcodeProject
#
# Requires ImageMagick: http://www.imagemagick.org/
@steverichey
steverichey / NeuralPlayground.swift
Created March 17, 2016 03:21
NeuralSwift - A very simple neural network written in Swift.
// see http://lumiverse.io/series/neural-networks-demystified
import Foundation
let startTime = NSDate()
defer {
let endTime = NSDate()
print("Total time \(endTime.timeIntervalSinceDate(startTime))")
}
@steverichey
steverichey / delete_git_submodule.md
Last active January 26, 2021 14:43 — forked from myusuf3/delete_git_submodule.md
How to effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes: git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path/to/submodule (no trailing slash).
  • Run rm -rf .git/modules/path/to/submodule (no trailing slash).
  • Commit git commit -m "Removed submodule <name>"
  • Delete the now untracked submodule files: rm -rf path/to/submodule
@steverichey
steverichey / install_cuda.sh
Created June 15, 2016 16:24
CUDA ARM Setup (Ubuntu 14.04)
# install CUDA
sudo apt-get update
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb"
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda -y
export PATH=/usr/local/cuda-7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
# install MPI (optional, for some samples)
#!/usr/bin/env bash
set -eu
# macOS
find . -type f \( -iname \*.cs \) -exec perl -e 's/\xef\xbb\xbf//;' -pi.bak {} \; -exec rm {}.bak \;
!/usr/bin/env sh
set -eu
git diff master..HEAD | grep -B 2 -A 2 "${@}"
import sys
simple_table = {
":encoded1:" : "a",
":encoded2:" : "b",
":encoded3:" : "c",
":encoded4:" : "d",
":encoded5:" : "e",
":encoded6:" : "f",
":encoded7:" : "g",
import sys
pair_table = {
"a" : ("", 1),
"b" : ("", 2),
"c" : ("", 3),
"d" : ("", 4),
"e" : ("", 5),
"f" : ("", 6),
"g" : ("", 7),
@steverichey
steverichey / PerformOnExit.cs
Created May 14, 2020 14:02
A C# class to call a method when the object goes out of scope.
/// <summary>
/// Performs an action when disposed.
/// <code>
/// using (new PerformOnExit(Foo))
/// {
/// Bar();
/// }
/// </code>
/// </summary>
public sealed class PerformOnExit : IDisposable