Skip to content

Instantly share code, notes, and snippets.

View kellyjf's full-sized avatar

John Kelly kellyjf

  • Gogo Business Aviation
  • Broomfield, CO
View GitHub Profile
Russian adoption
Did he pay Stormy Daniels or not?
My tax returns are under audit
Obama tapped my wires
Melania Trump tweet of 5/30
Misspoke my only sentence of criticism to Putin
@kellyjf
kellyjf / pyroute2 point-to-point
Created October 11, 2017 17:49
pyroute2 point-to-point
ip.addr('add', index=idx,
address='10.1.1.2',
mask=24,
local='10.1.1.1')
@kellyjf
kellyjf / Python Combinatorics
Created January 23, 2017 18:10
Python Combinatorics
import operator as op
def ncr(n, r):
r = min(r, n-r)
if r == 0: return 1
numer = reduce(op.mul, xrange(n, n-r, -1))
denom = reduce(op.mul, xrange(1, r+1))
return numer//denom
@kellyjf
kellyjf / gist:bb6a1e0ec45c7425132c
Created October 1, 2015 13:24
Setting terminal window size
# set window size appropriately
resize() {
local IFS='[;' escape geometry x y
echo -en '\e7\e[r\e[999;999H\e[6n\e8'
read -sd R escape geometry
x=${geometry##*;} y=${geometry%%;*}
stty cols ${x} rows ${y}
}
case "$-" in
224 sudo yum install python-urllib3
225 sudo pip install docker-py
232 sudo yum install -y python-six
233 sudo pip install --upgrade six
234 python
@kellyjf
kellyjf / Signals from a thread
Last active August 29, 2015 14:25
Signals from a thread
from PyQt4 import QtCore
import time
import sys
from subprocess import call, Popen, PIPE, STDOUT
class SomeObject(QtCore.QObject):
finished = QtCore.pyqtSignal()
progress = QtCore.pyqtSignal(['QString'])
@kellyjf
kellyjf / gist:517dcfbc2fa6d4c9bb1b
Created July 18, 2015 01:00
Populate a QComboBox
app = QtGui.QApplication(sys.argv)
db = QSqlDatabase.addDatabase("QSQLITE")
db.setDatabaseName("stest.sqlite")
model = QSqlTableModel(app);
model.setTable("test")
model.setFilter("key like '%1'")
Dialog = QtGui.QDialog()
ui = Ui_Dialog()
ui.setupUi(Dialog)
ui.comboBox.setModel(model)
You can't speak matter of factually about things you can't measure.
$TTL 604800
@ IN SOA localhost. root.localhost. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS dns.generic.com.
250 IN PTR dns.generic.com.