Skip to content

Instantly share code, notes, and snippets.

View brianfoshee's full-sized avatar
😎

Brian Foshee brianfoshee

😎
View GitHub Profile
@brianfoshee
brianfoshee / provisioning-profile-regexp.rb
Last active October 3, 2015 18:08
Regular Expression to match Apple Provisioning Profile strings
## This regular expression will match strings in the form of an Apple Provisioning Profile (iOS, at least)
## Example: A0D25BDA-BX3F-6AD1-BC65-6DC9G0S13BAK
## Simplified a bit from the first version of the gist.
str = "some string with A0D25BDA-BX3F-6AD1-BC65-6DC9G0S13BAK that in the middle of it"
new_str = str.sub(/[[A-Z\d]{4,12}-]{1,36}/,new_profile_string)
@brianfoshee
brianfoshee / moved.md
Last active December 18, 2015 00:19
Keep heroku dynos from idling - ping from a background worker in another app.
@brianfoshee
brianfoshee / geocoding.rb
Last active December 23, 2015 19:59
Comparing geocoders: Google vs Nominatim
require 'geocoder'
# (b-a)*prng.rand + a
def random(a,b)
(b-a) * rand() + a
end
# -90 -> 90
def random_lat
random(-90, 90)
@brianfoshee
brianfoshee / output
Created November 12, 2013 16:30
opencv install log
This file has been truncated, but you can view the full file.
➜ ~ brew doctor
Your system is ready to brew.
➜ ~ brew install python
Warning: python-2.7.6 already installed
➜ ~ pip-2.7 install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python2.7/site-packages
Cleaning up...
➜ ~ brew install -v homebrew/science/opencv
/usr/local/opt/python/bin/python2 -c import numpy
/usr/local/opt/python/bin/python2 -c import numpy
@brianfoshee
brianfoshee / .vimrc
Last active August 29, 2015 14:00
vimrc
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" The basics
Plugin 'kien/ctrlp.vim' " search for files
Plugin 'tpope/vim-fugitive' " git wrapper
Plugin 'bling/vim-airline' " nice looking status bar
#!/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'
@brianfoshee
brianfoshee / gencsrs.md
Last active August 29, 2015 14:07
Generating SSL certificate signing requests

Two options for generating a SHA2 Certificate Signing Request

(turns out your CA has to support signing with SHA256 as well)

1) Generate a CSR with a non password-protected key:

openssl req -nodes -sha256 -newkey rsa:2048 -keyout example.com.key -out example.com.csr
@brianfoshee
brianfoshee / .editorconfig
Last active August 28, 2015 20:46
Debugging issue with gofmt and editorconfig clashing on save
root = true
# Global rules
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
@brianfoshee
brianfoshee / Dockerfile
Created December 10, 2015 16:27
Dockerfile for building a project with Go and Node
FROM buildpack-deps:jessie
RUN apt-get update && apt-get install -y zip && rm -rf /var/lib/apt/lists/*
ENV GOLANG_VERSION 1.5.2
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA1 cae87ed095e8d94a81871281d35da7829bd1234e
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA1 golang.tar.gz" | sha1sum -c - \