Skip to content

Instantly share code, notes, and snippets.

@akesterson
akesterson / gist:9556321
Created March 14, 2014 20:38
Per-user mock build chroot
# Add this code to your /etc/mock/site-defaults.cfg file, and then
# all of your mock builds will take place in ${HOME}/.mockbuild/CONFIG.
# This will allow many users to build the same package config (-r)
# at any given time; so john, tom, dick and harry can build epel-5-noarch
# at the same time, and john can build epel-5-noarch, epel-6-x86_64,
# and fedora-13-x86_64 at the same time, because they all have their own
# build basedir.
# Note that this is very linux specific, YMMV on other platforms.
if [ ... ]; then
do some shit
....
....
....
....
....
if [ ... ]; then
do more shit
...
>>> def wat():
... raise Exception("ARGH")
... yield 0
... yield 1
... yield 2
...
>>> wat()
<generator object wat at 0x2e62500>
Using flask-sqlalchemy 2.0 with sqlalchemy 0.9.6, and cx_Oracle 5.1.3.
The sqlalchemy engine works 100% for the other bind I'm using (a MySQL database). But I'm only using ORM on the Oracle bind.
When declaring a ORM class like this (names are redacted):
class ORMObject(db.Model):
__bind_key__ = 'bind_name'
__table_args__ = {'schema': 'SPACE'}
__tablename__ = 'TABLE_NAME'
@akesterson
akesterson / gist:ff7bcfe925b9621e47e5
Created April 23, 2015 06:05
Convert Keeper CSV exports to Lastpass CSV import
This isn't 100%, but it will get you most of the way there (assumes bash 4+):
(\
echo 'url,type,username,password,hostname,extra,name,grouping' ; \
cat KEEPER_BACKUP_FILE | sed -e s/' '/'|'/g -e s/','//g | (\
while read LINE; do \
IFS='|' read -r -a fields <<< "$LINE"; \
type="server"; \
if [[ "${fields[4]}" == "" ]]; then \
type=''; \
akesterson@ATLPTLBS3TWW1 ~/source/xml2json
$ ./xml2json.py -t xml2json test.xml |\
head -n 1 |\
python -c 'import dpath.util; import json; import sys; print json.dumps(dpath.util.search(json.loads(sys.stdin.read()), "/ListHostedZonesResponse/HostedZones/HostedZone/[0-3]/Id"), indent=4, sort_keys=True)' 2>&1
{
"ListHostedZonesResponse": {
"HostedZones": {
"HostedZone": [
{
"Id": "/hostedzone/ZM0TA3Q0DI8S1"
[root@failwhale: lib]$ cat ~/.ssh/config
Host github-automation-alias
IdentityFile ~/.ssh/automation.pem
HostName github.com
User git
BatchMode yes
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
[root@failwhale: lib]$ ssh github-automation-alias
#!/bin/bash
cd ..
GIT_DIR=.git
if ! [ -t 0 ]; then
read -a ref
fi
IFS='/' read -ra REF <<< "${ref[2]}"
BRANCH="${REF[2]}"
akesterson@ATLPTLBS3TWW1 ~/source/vocalocity/machinist
$ tracert 50.19.32.70
Tracing route to ec2-50-19-32-70.compute-1.amazonaws.com [50.19.32.70]
over a maximum of 30 hops:
1 2 ms 2 ms 2 ms 192.168.43.1
2 315 ms 50 ms 32 ms 180.sub-66-174-175.myvzw.com [66.174.175.180]
3 59 ms 69 ms 62 ms 82.sub-69-83-57.myvzw.com [69.83.57.82]
4 47 ms 39 ms 39 ms 225.sub-69-83-57.myvzw.com [69.83.57.225]
root@radar:~# nagios3 -v /etc/nagios3/nagios.cfg
Nagios Core 3.2.3
Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 10-03-2010
License: GPL
Website: http://www.nagios.org
Reading configuration data...