Skip to content

Instantly share code, notes, and snippets.

View MichaelPereira's full-sized avatar

Michael Pereira MichaelPereira

  • Northwesterrn Mutual
  • Paris/New York/Milwaukee
View GitHub Profile
0479bb41cbe04af310eb9e704ff69e407e1c9c453d21bb24aa3cdb0b72fd445fb85ea5acd313b70b9b192d6a5e0bf0dd6c65c1fecaef15d6763bcbe855dd68df10
@MichaelPereira
MichaelPereira / github_organization_hooks.txt
Created May 15, 2017 06:43
Comparison of gitlab system hooks and github organization hooks
Commit comment (Commit or diff commented on.)
Create (Branch or tag created.)
Delete (Branch or tag deleted.)
Deployment (Repository deployed.)
Deployment status (Deployment status updated from the API.)
Fork (Repository forked.)
Gollum (Wiki page updated.)
Issue comment (Issue comment created, edited, or deleted.)
Issues (Issue opened, edited, closed, reopened, assigned, unassigned, labeled, unlabeled, milestoned, or demilestoned.)
Label (Label created, edited or deleted.)
@MichaelPereira
MichaelPereira / pr_reminder.py
Created April 7, 2017 14:46
Python celery task for Pull Requests reminders
@shared_task()
def daily_pr_reminder():
list_of_repos = []
# Use both pygithub and our Github API since we are using Github API beta endpoints
gh = GithubAPI(GithubToken.repo_token)
g = Github(GithubToken.repo_token.value)
for repo_string in list_of_repos:
repo = g.get_repo(repo_string, lazy=False)
attachments = []
for pr in repo.get_pulls():
@MichaelPereira
MichaelPereira / branch_cleanup.sh
Created September 9, 2016 14:52
Script to clean-up remote branches that have already been merged to master.
#!/bin/bash
# Format for excluded branches: "branch|branch|branch..."
excluded_branches="master|gh-pages|HEAD"
for branch in $(git branch -r | tr -d ' ' | sed -e 's/->.*//' | egrep -v "${excluded_branches}"); do
if git branch -r --contains "${branch}" | grep -q master; then
git push origin ":${branch#origin/}"
fi
done
cpanm (App::cpanminus) 1.7042 on perl 5.010001 built for x86_64-linux-thread-multi
Work directory is /root/.cpanm/work/1466518127.22818
You have make /usr/bin/make
You have LWP 5.833
You have /bin/tar: tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@MichaelPereira
MichaelPereira / gist:72c4879f24eb296a4e5562d30655ee43
Created May 10, 2016 19:34
failing unit tests after removing stray space
Failures:
1) Chef::Provider::Git with an ssh wrapper without a timeout set clones a repo with default git options
Failure/Error: shell_out!(clone_cmd, run_options)
#<Chef::Provider::Git:0x00000003a38128> received :shell_out! with unexpected arguments
expected: ("git clone \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\"", {:user=>"deployNinja", :environment=>{"GIT_SSH"=>"do_it_this_way.sh", "HOME"=>"/home/deployNinja"}, :log_tag=>"git[web2.0 app]"})
got: ("git clone \"git://github.com/opscode/chef.git\" \"/my/deploy/dir\"", {:user=>"deployNinja", :log_tag=>"git[web2.0 app]", :environment=>{"HOME"=>"/home/deployNinja", "GIT_SSH"=>"do_it_this_way.sh"}})
Diff:
choco install virtualbox
choco install vagrant
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
choco install cygwin
choco install cyg-get
choco install sublimetext3
choco install notepadplusplus.install
choco install gitextensions
choco install jdk7
choco install jdk8
choco install vmwarevsphereclient
@MichaelPereira
MichaelPereira / gist:7117888
Created October 23, 2013 12:38
Verify if a git branch has been pushed to production
for branch in `git branch | grep DMX | sed 's/\*/ /' |cut -f3 -d' '`; do
echo $branch
if [ `git branch -r --contains $branch | grep -c origin/prod` -gt 0 ]; then
git branch -d $branch
fi
done
@MichaelPereira
MichaelPereira / loadGen.py
Created August 22, 2012 14:07 — forked from anonymous/loadGen.py
Two scripts for 1. generating a git repo with lots of files and 2. generating and timing a series of small, synthetic commits to a repo
#!/usr/local/bin/python -t
# Originally by Joshua Redstone
#
# Hacky script to generate gobs of files to test git operations as a function
# of the number of files in the repo.
#
# Call at least with setting baseDir
# ./loadGen.py --baseDir=foo
# This creates a git repo with lots of files in dir 'foo'
#