Skip to content

Instantly share code, notes, and snippets.

@rca
rca / git_whitespace
Created February 13, 2018 01:31
get rid of whitespace in your uncommitted work
#!/usr/bin/env python2.7
"""
Ensure new lines added to git do not have whitespace
"""
import os
import sys
import time
import traceback
from optparse import OptionParser
@rca
rca / r-rreboto.com.asc
Created November 30, 2017 13:30
Public GPG key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFofh2EBEADOk6j+F3WhGVcjsIIwgSEglsNBjVDYs9q8t+zEYrumOInS/VD4
7zshkVkJTo6TwplLOIxj/b2EbeG/9Qsf2zGF63fdfk4l/gTcELfTdnKc9lH2JdBm
1dm/XdLL09ITn3u36TL19xUjV2qiSBL6iXWmn5Zqg28LzVjWiMkjSuLNsPOfxiYG
lQXFnSD8zX3mL9ceFmyOFBt8DwzttyYui2dQ4xw67GpMnxEmsTOtNP6hEasBAjzA
r9fRjpP6wer6isDqVcgCkUzZY670p3oA3mMCy5qbi4eHCNn1h8caQdhoMElNVPYA
dnSx/Ut9TGQnFWtCpl9O4wMieMg2AtNsKXbTDpHVO7VN+Asj0bQb0+ysN0Y/PUP6
+FFi6u7OAyUslmkxS+UGxasm8prKSRBY9oF/00vgeCC/mAuWY2crjJhjNeO5n0Tb
BJOkh9ouEMmd5VARGQaH3FmCcyEAsQBRJW5ingg2FYDrFx2NsdSLvFN9mfYjkDSQ
@rca
rca / mpm_prefork.conf
Created August 25, 2017 21:50
MySQL and Apache configuration on a small DigitalOcean Droplet for a low-traffic Wordpress site
# /etc/apache2/mods-enabled/mpm_prefork.conf
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 3
@rca
rca / embed.js
Created April 5, 2017 14:16
embed.js file for grafana dashboard embedding
/*! grafana - v3.0.0-pre1 - 2016-04-10
* Copyright (c) 2016 Torkel Ödegaard; Licensed Apache-2.0 */
!function(){"use strict";function a(a){var b=0;if(a.offsetParent)for(;;){if(b+=a.offsetTop,!a.offsetParent)break;a=a.offsetParent}else a.y&&(b+=a.y);return b}function b(b){if(b&&-1!==c.grafanaUrl.indexOf(b.origin)&&b.data&&("grafana-resize"===b.data.type&&b.data.height&&(e.height=b.data.height+"px"),"grafana-scroll"===b.data.type&&b.data.top)){var d=a(e)+b.data.top;window.scrollTo(0,d)}}var c=window.GrafanaEmbed||{},d=document.getElementById("grafana-dashboard"),e=document.createElement("iframe");["grafanaUrl","embedUrl","dashnav"].forEach(function(a){window[a]&&(c[a]=c[a]||window[a])});var f=c.queryParams||{};f.embed=!0,c.embedUrl&&(f.embed_url=encodeURIComponent(c.embedUrl));var g=c.grafanaUrl+"/dashboard/db/"+c.dashboard,h=Object.keys(f);if(h.length>0){g+="?";for(var i=0;i<h.length;i++){i>0&&(g+="&");var j=h[i];g+=j+"="+f[j]}}e.src=g,e.id="grafana-embed-frame",e.width="100%",e.height="0px",e.frameBorder="0
@rca
rca / gist:c312ffd1a13fcf70338e
Created July 10, 2015 10:48
init info for debian based /etc/init.d script
### BEGIN INIT INFO
# Provides: your service
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: service description
### END INIT INFO
@rca
rca / git_step.sh
Last active August 29, 2015 14:01
Step through commits in a git branch
#!/bin/bash
# step through commits showing the commit information
BASE_REV=${BASE_REV:-$1};
current_branch=$(git branch | grep '^*' | awk '{print $2}');
for rev in $(git rev-list ${BASE_REV}..HEAD | tail -r); do
git checkout $rev;
LESS='CRSX' git show -p $rev;
done;
@rca
rca / hdf5_tables_install.sh
Created May 19, 2014 19:28
Install HDF5 and pytables on OS X Mavericks
# build and install HDF5
# set where HDF5 will be installed; this is needed for pytables and is used in the configuration line for HDF5 below
export HDF5_DIR=/opt/hdf5
# download, configure and install HDF5
curl -O 'http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.13.tar.bz2'
tar xjf hdf5-1.8.13.tar.bz2
cd hdf5-1.8.13
./configure --prefix=${HDF5_DIR}
#!/bin/bash
GFORTRAN_URL='http://gcc.gnu.org/wiki/GFortranBinaries#MacOS'
which gfortran
[ "$?" != "0" ] && echo "download and install gfortran from ${GFORTRAN_URL}" && exit 1
# set up flags for Numpy C extentions compiling
export CFLAGS="-arch i386 -arch x86_64"
export FFLAGS="-m32 -m64"
<!DOCTYPE html>
<html>
<head>
<title>Dropdown Test</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #