Skip to content

Instantly share code, notes, and snippets.

View rsgalloway's full-sized avatar

Ryan Galloway rsgalloway

View GitHub Profile
@rsgalloway
rsgalloway / namecheap-ddns
Last active September 22, 2018 06:21
Simple Namecheap Dynamic DNS client
#!/bin/sh
set -eu
#
# https://www.namecheap.com/support/knowledgebase/article.aspx/43/11/how-do-i-set-up-a-host-for-dynamic-dns
#
#FETCH="fetch -qo -"
# or for curl:
FETCH="curl -s"
# $1: your domain
# $2: subdomain to update use @ for TLD
@rsgalloway
rsgalloway / git-server-setup.md
Last active September 21, 2018 23:28
Instructions for setting up remote git server

Instructions for setting up remote git server

setup a new git repo on server:

  • repo name can be anything (but usually they end in .git)

for synology NAS diskstations, you probably want your git repos under /volume1

#!/bin/bash
##
#<UDF name="ssuser" Label="New user" example="username" />
#<UDF name="sspassword" Label="New user password" example="Password" />
#<UDF name="hostname" Label="Hostname" example="examplehost" />
#<UDF name="website" Label="Website" example="example.com" />
# <UDF name="db_password" Label="MySQL root Password" />
# <UDF name="db_name" Label="Create Database" default="" example="Create database" />
@rsgalloway
rsgalloway / abcbuild.csh
Last active August 20, 2019 07:45
Alembic OSX Build
# tool chain
xcode-select --install
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# required libs
brew doctor
brew install boost --with-python
brew install boost-python
@rsgalloway
rsgalloway / dotdictify.py
Created January 17, 2015 02:41
dotdictify.py
class dotdictify(dict):
"""
life = {
'bigBang': {
'stars': {
'planets': {}
}
}
}
@rsgalloway
rsgalloway / stdout.py
Created August 1, 2014 21:06
redirect stdout
# open our log file
so = se = open("stdout.log", 'a', 0)
# re-open stdout without buffering
sys.stdout = os.fdopen(sys.stdout.fileno(), 'a', 0)
# redirect stdout and stderr to the log file opened above
os.dup2(so.fileno(), sys.stdout.fileno())
os.dup2(se.fileno(), sys.stderr.fileno())
@rsgalloway
rsgalloway / elidedlabel.py
Created March 12, 2014 19:35
PyQt Elided QLabel
import sys
from PyQt4.QtCore import Qt
from PyQt4.QtGui import *
class ElidedLabel(QLabel):
def paintEvent(self, event):
painter = QPainter(self)
metrics = QFontMetrics(self.font())
elided = metrics.elidedText(self.text(), Qt.ElideRight, self.width())
class QCheckableHeaderView(QtGui.QHeaderView):
'''
Checkable QHeaderView. Column 0 contains a checkbox that emits
a signal when it's check state is updated.
'''
is_on = True
signal_checked = QtCore.pyqtSignal(bool)
def __init__(self, *args, **kwargs):
super(QCheckableHeaderView, self).__init__(*args, **kwargs)
@rsgalloway
rsgalloway / gist:6692410
Created September 24, 2013 22:47
Simple utility to parse the __doc__, __name__ and __author__ values from a Python module.
#!/usr/bin/env python
"""
Simple utility to parse the __doc__, __name__ and __author__ values from
a Python module.
"""
import sys
import ast
m = ast.parse(''.join(open(sys.argv[1])))
@rsgalloway
rsgalloway / gist:5835065
Last active June 3, 2016 08:07
Alembic Build Notes

Alembic Build Notes

Alembic 1.5.1 Boost 1.49 OpenEXR 2.0.1 HDF5 1.8.9