Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'

ActiveRecord cheat sheet / EXAMPLES

INSTALL

$ gem install activerecord in GEMFILE: gem ‘activerecord’

REQUIRE

require ‘active_record’

#!/bin/bash
# Create an Iframe index from HLS segmented streams
# $1: Filename to be created
# $2: Location of segmented ts files
# Check how many arguments
if [ $# != 2 ]; then
echo "Usage: $0 [Input filename] [Location of segmented streams]"
exit 1;
fi
@Mistobaan
Mistobaan / FBAnimationPerformanceTracker.h
Last active September 14, 2015 21:36 — forked from clementgenzmer/FBAnimationPerformanceTracker.h
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
@Mistobaan
Mistobaan / build_gcc4.7.1.sh
Created August 18, 2012 04:39 — forked from henry0312/build_gcc4.7.1.sh
Build GCC 4.7.1 on Mac OS X Lion with Go support
#!/bin/sh
# GCC
## Prerequisites for GCC
## http://gcc.gnu.org/install/prerequisites.html
## Installing GCC: Configuration
## http://gcc.gnu.org/install/configure.html
GCC_VER=4.7.1
WORK_DIR=$HOME/Builds/GCC
@Mistobaan
Mistobaan / tee.go
Created November 26, 2012 00:40 — forked from earino/tee.go
Tee not quite right
package main
import (
"io"
"bufio"
"os"
"flag"
"log"
)
@Mistobaan
Mistobaan / ReCodeSign.md
Last active October 23, 2015 03:23 — forked from 0xc010d/ReCodeSign
Codesign an iOS app, with a different distribution certificate and mobileprovisioning file.
  • Copy the delivered ipa into a directory to work in.

  • export PlistBuddy="/usr/libexec/PlistBuddy" to get the PlistBuddy tool to your shell. If it is not added, all references to PlistBuddy will need to be written as the full path.

  • Take the delivered App.ipa and unzip it using the unzip command. This should produce a Payload directory containing the app and its resources.

  • Enter the command "codesign -d --entitlements :enterprise.plist Payload/PathToApp.app/" This pulls the entitlements out of the app, and prints them to a plist, without a leading "blob" of data. Pay particular attention to the colon before the enterprise.plist file name.

@Mistobaan
Mistobaan / gist:5374118
Last active December 16, 2015 03:59 — forked from tkdave/gist:4150916
# Installing OpenCV python libs on mac to work with virtualenv
# OpenCV 2.4.3
# Python 2.7.3 installed with brew
# download CUDA https://developer.nvidia.com/cuda-downloads
# OpenNI SDK http://www.openni.org/openni-sdk/?download=http://www.openni.org/wp-content/uploads/2013/01/OpenNI-MacOS-x64-2.1.0.tar.zip#.UWhRlyt4YRk
# assuming you have virtualenv, pip, and python installed via brew
# assuming $WORKON_HOME is set to something like ~/.virtualenvs
# using homebrew - make sure we're current

Avi Flax wrote a very interesting article about Profiling Node Programs on Mac OS X. However, if you manage your Node.js installation with homebrew, you can use the following scripts to install the V8 debugger separately.

Just download this Gist, make install.sh executable with chmod u+x install.sh and run the script.

@Mistobaan
Mistobaan / min-char-rnn.py
Created December 30, 2015 00:26 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)