Skip to content

Instantly share code, notes, and snippets.

Roberto Aguilar rca

  • NYC
Block or report user

Report or block rca

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
@rca
rca / flush_dns
Created Feb 5, 2019
Flushes local DNS cache on MacOS X
View flush_dns
#!/bin/bash
set -e
sudo killall -HUP mDNSResponder
@rca
rca / rancher-exec
Created Jan 25, 2019
Execute a command within a container running in Rancher k8s
View rancher-exec
#!/bin/bash
set -e
set -x
SCRIPT_NAME=$(basename $0)
if [ -z "$4" ]; then
echo "${SCRIPT_NAME} <env> <namespace> <pod name> <command> [args]" 1>&2
exit 1
fi;
View gist:07cb74c350d6be278249db6136faa7f7
class Foo:
def __init__(self, x=[]):
self.x = x
f = Foo()
f.x.append(1)
@rca
rca / docker-service-ports
Created Mar 21, 2018
Script to list service ports and get next available port
View docker-service-ports
#!/usr/bin/env python3.6
import argparse
import logging
import re
import shlex
import sh
PORT_RE = re.compile(r':(?P<port>\d+)->')
@rca
rca / docker-networks
Last active Jul 13, 2018
Lists all docker networks sorted by their subnet address
View docker-networks
#!/usr/bin/env xonsh
import json
import re
import sys
from tabulate import tabulate
# https://arcpy.wordpress.com/2012/05/11/sorting-alphanumeric-strings-in-python/
# https://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python
def sorted_alnum(l, key=None):
@rca
rca / git_whitespace
Created Feb 13, 2018
get rid of whitespace in your uncommitted work
View git_whitespace
#!/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
View r-rreboto.com.asc
-----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 Aug 25, 2017
MySQL and Apache configuration on a small DigitalOcean Droplet for a low-traffic Wordpress site
View mpm_prefork.conf
# /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 Apr 5, 2017
embed.js file for grafana dashboard embedding
View embed.js
/*! 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 Jul 10, 2015
init info for debian based /etc/init.d script
View gist:c312ffd1a13fcf70338e
### 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
You can’t perform that action at this time.