Skip to content

Instantly share code, notes, and snippets.

View rcoup's full-sized avatar

Robert Coup rcoup

View GitHub Profile
@rcoup
rcoup / Dockerfile
Last active August 31, 2021 12:47
Docker container for SWIG. Helpful when you need a specific version to avoid massive diffs.
# Usage
#
# To build:
# $ docker build --build-arg SWIG_VERSION=3.0.10 -t swig .
#
# To run:
# host$ docker run --rm -it -v $(pwd):/src swig
# cont$ swig ...
#
# For SWIG 4.x use bullseye, for 3.x use buster
@rcoup
rcoup / .bashrc
Created August 13, 2018 08:14
bashrc for kubernetes context & namespace
__kube_ps1()
{
# Get current context
CONTEXT="$(kubectl config current-context)"
if [ -n "$CONTEXT" ]; then
NAMESPACE="$(kubectl config view -o=jsonpath="{.contexts[?(@.name==\"${CONTEXT}\")].context.namespace}")"
echo "⎈ $CONTEXT:${NAMESPACE:-default}"
fi
}
@rcoup
rcoup / bop-mc.geojson
Last active June 8, 2018 09:02
EPSG:2106 NZGD2000 / Bay of Plenty 2000 — New Zealand - North Island - Bay of Plenty mc
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rcoup
rcoup / server_side_cursor.py
Created September 15, 2017 15:36
Server-side ORM cursors with PostgreSQL and Django 1.8
"""
Server-side ORM cursors with PostgreSQL and Django 1.8
Typically Postgres cursors fetch all results regardless of any Python-side iteration
This will fetch chunks of rows at a time from the database using a server-side cursor,
and yield them usefully for iteration.
Usage:
>>> queryset = MyModel.objects.all()
@rcoup
rcoup / standup.flow
Last active September 20, 2017 13:09
WIP Standup Plugin for Errbot
[Core]
Name = StandupFlows
Module = standup_flows.py
[Documentation]
Description = Standup Flows
[Python]
version = 3
@rcoup
rcoup / bumpme
Last active January 23, 2017 12:34
Mon Jan 23 12:34:41 UTC 2017
@rcoup
rcoup / .gammurc
Last active September 13, 2023 20:22
Gammu config and script for receiving SMS via a USB modem attached to an OSX computer and forwarding it into iMessage, where it will appear on all your devices.
[gammu]
port = /dev/tty.HUAWEIMobile-Modem
connection = at19200
model = at
synchronizetime = yes
logfile = /Users/me/.gammu/log
logformat = errorsdate
gammucoding = utf8
[smsd]
@rcoup
rcoup / docker-run-ssh
Created July 9, 2015 13:28
SSH Agent Forwarding for boot2docker
#!/bin/bash
# "docker run" with SSH Agent Forwarding for boot2docker
# QuickStart:
# 1. Download to ~/bin/docker-run-ssh and chmod +x it
# 2. docker-run-ssh [normal args to docker run...]
# Use a unique ssh socket name per-invocation of this script
SSH_SOCK=boot2docker.$$.ssh.socket
@rcoup
rcoup / lxc-config
Created June 2, 2015 23:56
Getting vagrant-lxc working on CircleCI (Ubuntu Trusty guest; Precise host). https://github.com/fgrehm/vagrant-lxc/issues/339
# Default pivot location
lxc.pivotdir = lxc_putold
# Default mount entries
lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
lxc.mount.entry = sysfs sys sysfs defaults 0 0
# Default console settings
#lxc.devttydir = lxc
lxc.tty = 4
@rcoup
rcoup / sigtstp.py
Created October 23, 2014 04:24
Send yourself SIGTSTP to take the user back to a shell, 'fg' to resume
#!/usr/bin/env python
import os, signal
print "About to pause myself, do 'fg' to resume"
os.kill(os.getpid(), signal.SIGTSTP)
print "Resumed!"