Skip to content

Instantly share code, notes, and snippets.

View rcoup's full-sized avatar

Robert Coup rcoup

View GitHub Profile
@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 / 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 / .gammurc
Last active May 23, 2024 16:59
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 / bumpme
Last active January 23, 2017 12:34
Mon Jan 23 12:34:41 UTC 2017
@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 / 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 / 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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 / git_revparse_single.cflow.txt
Created June 27, 2019 12:13
cflow trace for git_revparse_single()
$ cflow -T --brief --main=git_revparse_single refs.c revparse.c
+-git_revparse_single() <int git_revparse_single (git_object **out, git_repository *repo, const char *spec) at revparse.c:854>
+-git_revparse_ext() <int git_revparse_ext (git_object **object_out, git_reference **reference_out, git_repository *repo, const char *spec) at revparse.c:828>
| +-revparse__ext() <int revparse__ext (git_object **object_out, git_reference **reference_out, size_t *identifier_len_out, git_repository *repo, const char *spec) at revparse.c:663>
| | +-assert()
| | +-ensure_base_rev_loaded() <int ensure_base_rev_loaded (git_object **object, git_reference **reference, const char *spec, size_t identifier_len, git_repository *repo, bool allow_empty_identifier) at revparse.c:610>
| | | +-object_from_reference() <int object_from_reference (git_object **object, git_reference *reference) at revparse.c:596>
| | | | +-git_reference_resolve() <int git_reference_resolve (git_reference **ref_out, const git_reference *ref) at ref