Skip to content

Instantly share code, notes, and snippets.

Bruno Bronosky RichardBronosky

Block or report user

Report or block RichardBronosky

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
@RichardBronosky
RichardBronosky / URL_transforms.sh
Last active Aug 29, 2015
You can download this file and run it to see the result of the test suite via: curl -sL https://gist.github.com/RichardBronosky/8808048/raw/URL_transforms.sh | bash
View URL_transforms.sh
#!/bin/bash
## The regex string to use for all detail page transforms is:
regex='s/([^:]{4,5}:\/\/)?((www|m).)?(.*)/http:\/\/m.\4?embed=copyright/'
## It is hardened against transient protocol and subdomain presence.
## It does not account for preexisting query strings.
## That would require 2 separate regexes and is not likely to occur in our feed.
## Here is the test suite.
@RichardBronosky
RichardBronosky / grant.py
Last active Aug 29, 2015
The GitHub web UI for adding access to repos for organization teams is pretty terrible. Luckily the API is pretty robust.
View grant.py
import re
import sys
from pygithub3 import Github
# Notice: there is a requirements.txt file to help you get pygithub3 via...
# pip install -r requirements.txt
if __name__ == '__main__':
larg = len(sys.argv)
if larg < 5 or larg == 6 or (larg > 7 and sys.argv[5] != '--include'):
print " {command} username password oranization team [--include 'RegularExpression']". format(command=sys.argv[0])
View equals_separated.sh
#!/bin/bash
for i in "$@"
do
case $i in
-e=*|--extension=*)
EXTENSION="${i#*=}"
shift
;;
-s=*|--searchpath=*)
@RichardBronosky
RichardBronosky / docker_install.txt
Last active Aug 29, 2015
Setting up Docker on Mac OS X 10.10.1
View docker_install.txt
brew update
brew install caskroom/cask/brew-cask
brew cask install virtualbox
// At this point I was getting a sha256 mismatch.
// brew was expecting the same value listed at:
// https://www.virtualbox.org/download/hashes/4.3.20/SHA256SUMS
// But a different sha256 was found for multiple downloads of:
// http://download.virtualbox.org/virtualbox/4.3.20/VirtualBox-4.3.20-96996-OSX.dmg
// This was resolved by:
// rm /Library/Caches/Homebrew/virtualbox-4.3.20-96996.dmg
View Dockerfile
FROM ubuntu:14.04
MAINTAINER Richard Bronosky <bruno@bronosky.com>
# the default image doesn't have python, so this is going to be a big install
RUN apt-get update && apt-get install -y python-pip
# remove this next line when development is done
#RUN apt-get update && apt-get install -y tmux vim git
RUN pip install -U https://github.com/RichardBronosky/celery_test/archive/master.zip
USER nobody
ENTRYPOINT celery -A celery_test.tasks worker --loglevel=info
View __error.msg
Running "cordovaBuild:statesman:android" (cordovaBuild) task
>> Error: Error: ENOENT, no such file or directory '/Users/bruno/src/mm/newspaper-app/projects/statesman/platforms/android/src/com/mm/cmg/newspaper/statesman'
>> at Error (native)
>> at Object.fs.readdirSync (fs.js:765:18)
>> at android_parser.update_from_config (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:285:25)
>> at android_parser.update_project (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/metadata/android_parser.js:349:14)
>> at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:122:27
>> at Array.map (native)
>> at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:65:40
>> at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
@RichardBronosky
RichardBronosky / clone_into_here.sh
Created Mar 12, 2015
Clone a repo into the current directory. Good for moving an existing non-version-controlled project to github repo you just created.
View clone_into_here.sh
# This script is designed so that you can either call it as a script or copy-paste the function into your shell and use it directly.
clone_into_here(){
repo=$1
git clone $repo ./tmp_repo
mv tmp_repo/* tmp_repo/.* ./
rm -r tmp_repo
}
clone_into_here($1)
@RichardBronosky
RichardBronosky / config
Last active Aug 29, 2015
.git/config of local service_layer_config.git
View config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/RichardBronosky/service_layer_config.git
fetch = +refs/heads/*:refs/remotes/origin/*
@RichardBronosky
RichardBronosky / Dockerfile
Last active Aug 29, 2015
Your Dockerfile ENTRYPOINT's dirty little secret.
View Dockerfile
FROM ubuntu
# Works the same on Centos too if you want to try it. ;-)
# "Shell Form"
# Don't do this. it fails to accept arguments from the docker cli
ENTRYPOINT cat
# "Exec Form"
# This is what you want. Even if the "Shell Form" seems to work for you. (See the transcript below.)
ENTRYPOINT ["cat"]
@RichardBronosky
RichardBronosky / Makefile
Created Mar 29, 2015
A hands on Makefile learning exercise
View Makefile
TARGET=hello.txt
# This is a hands on learning exercise I made for myself. I hope you get something out of it.
# Here are some experiments to try:
# 1. (notice the "Nothing to be done for")
# make; make;
#
# 2. (notice that it removes hello.txt which clears the previous error)
# make clean; make
#
You can’t perform that action at this time.