Skip to content

Instantly share code, notes, and snippets.

View johnrc's full-sized avatar

John Cragun johnrc

View GitHub Profile
@johnrc
johnrc / git-rpms.md
Created April 11, 2016 19:38
Steps to create the Git RPMs

Git RPMs

Here are the steps to compile and build the Git RPMs using the git.spec provided by the project:

wget http://kernel.org/pub/software/scm/git/git-2.8.1.tar.gz -P ~/rpmbuild/SOURCES
tar xf ~/rpmbuild/SOURCES/git-2.8.1.tar.gz
cp git-2.8.1/git.spec ~/rpmbuild/SPECS
rm -fr git-2.8.1
# install all dependencies (e.g. yum install  -y)
@johnrc
johnrc / watch.sh
Created May 3, 2016 22:02
Command to watch for deleted files in a directory
#!/usr/bin/sh
inotifywait -mr -e delete /some/dir
@johnrc
johnrc / .gitignore
Last active June 6, 2016 16:41 — forked from esamson/.gitignore
systemd service file for sonatype nexus. Put this in `$HOME/.config/systemd/user/nexus.service`. Launch with `systemctl --user start nexus`.
default.target.wants/
nexus
@johnrc
johnrc / jupyterhub-install.sh
Last active May 27, 2020 00:39
JupyterHub setup on centos
#!/bin/sh
curl -O http://repo.continuum.io/archive/Anaconda3-4.0.0-Linux-x86_64.sh
chmod u+x Anaconda3-4.0.0-Linux-x86_64.sh
./Anaconda3-4.0.0-Linux-x86_64.sh -b -p /opt/anaconda3
export PATH=/opt/anaconda3/bin:$PATH
curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
yum install nodejs -y
npm install -g configurable-http-proxy
pip install jupyterhub
@johnrc
johnrc / nexus.service
Created June 25, 2016 02:44
Nexus unit file for systemd (as opposed to upstart)
[Unit]
Description=Sonatype Nexus
After=centrifydc.service
Requires=centrifydc.service
[Service]
User=user
Group=group
Type=forking
PIDFile=/path/to/nexus-2.11.4-01-bundle/nexus-2.11.4-01/bin/jsw/linux-x86-64/nexus.pid
@johnrc
johnrc / repset_mongo.sh
Created July 19, 2016 14:02 — forked from massenz/repset_mongo.sh
Creates and initializes a MongoDb replica set: allows the user to choose the number of members and the starting port number; this should also work on a remote host, but I have only tested it so far on localhost
#!/bin/bash
#
# Starts up a MongoDB replica set
#
# There is a lot of documentation about replica sets:
#
# http://docs.mongodb.org/manual/reference/replica-configuration/
# http://docs.mongodb.org/manual/administration/replica-sets/
#
# To read data from a SECONDARY, when in the client, use:
@johnrc
johnrc / jenkins-git-backup.sh
Created February 13, 2017 17:05 — forked from abayer/jenkins-git-backup.sh
Example of a script for backing up Jenkins config in git.
#!/bin/bash
#
# Copies certain kinds of known files and directories from a given Jenkins master directory
# into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em.
#
set -ex
if [ $# -ne 2 ]; then
echo usage: $0 root_dir jenkins_master
@johnrc
johnrc / selenium-grid-docker.md
Created February 27, 2017 04:32
How to use Selenium grid via Docker

Selenium Grid on Docker

Setup Containers

docker run -d -P --name selenium-hub selenium/hub
docker run -d --link selenium-hub:hub selenium/node-chrome
docker exec -it ad6211909835 bash
@johnrc
johnrc / svn2git.md
Created April 14, 2017 09:38
Subversion to Git commands

Below is a list of helpful commands to run a successful migration of Subversion to Git.

svn log --quiet https://svn-server.example.com/repos/my_repo | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/ //g' | sort | uniq > svnauthors.txt
# convert the `svnauthors.txt` to proper format (name, email) in `authors.txt`
git svn clone --prefix="" --authors-file="authors.txt" -s https://svn-server.example.com/repos/my_repo
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --force
git remote add origin ssh://git@github.com/my_username/my_repo.git
git push --all
git push --tags
@johnrc
johnrc / statuses.md
Created May 15, 2017 17:12 — forked from vkostyukov/statuses.md
HTTP status codes used by world-famous APIs
API Status Codes
[Twitter][tw] 200, 304, 400, 401, 403, 404, 406, 410, 420, 422, 429, 500, 502, 503, 504
[Stripe][stripe] 200, 400, 401, 402, 404, 429, 500, 502, 503, 504
[Github][gh] 200, 400, 422, 301, 302, 304, 307, 401, 403
[Pagerduty][pd] 200, 201, 204, 400, 401, 403, 404, 408, 500
[NewRelic Plugins][nr] 200, 400, 403, 404, 405, 413, 500, 502, 503, 503
[Etsy][etsy] 200, 201, 400, 403, 404, 500, 503
[Dropbox][db] 200, 400, 401, 403, 404, 405, 429, 503, 507