Skip to content

Instantly share code, notes, and snippets.

View davidruffner's full-sized avatar

David Ruffner davidruffner

View GitHub Profile
@davidruffner
davidruffner / rockPaperScissors.py
Last active November 14, 2019 16:05
Python Exercise: Rock, Paper, Scissors
# A python exercise from [Practice Python](http://www.practicepython.org/exercise/2014/03/26/08-rock-paper-scissors.html).
throwNames = {
0: 'Rock',
1: 'Paper',
2: 'Scissors',
}
def twoPlayerRockPaperScissors():
@davidruffner
davidruffner / Example.py
Last active February 6, 2019 18:58 — forked from LegoStormtroopr/Example.py
'FingerTabs' - Horizontal Text, Horizontal Tabs in PyQt Forked from [LegoStormtroopr's gist](https://gist.github.com/LegoStormtroopr/5075267).
from PyQt4 import QtGui, QtCore
from FingerTabs import FingerTabWidget, FingerTabBarWidget
import sys
app = QtGui.QApplication(sys.argv)
tabs = QtGui.QTabWidget()
tabBar = FingerTabBarWidget(width=100,height=25)
tabs.setTabBar(tabBar)
digits = ['Thumb','Pointer','Rude','Ring','Pinky']
@davidruffner
davidruffner / producer.py
Last active July 18, 2023 05:37
Piping data between processes (Python and Nodejs)
import sys
import numpy as np
im = np.random.randint(0, 255, size=(1024, 1024)).astype(np.uint8).ravel()
f = sys.stdout.buffer
while True:
f.write(im.tobytes())
f.flush()
@davidruffner
davidruffner / README.md
Last active September 4, 2017 23:07
Scrabble Word Finder

Scrabble Word Finder

This little utility finds words that can be formed from your letters. You can specify what the word starts with and what it ends with, and the length of the gap in between.

It can by called on the terminal

$ python scrabbleWordFinder.py -m LARJ -e L
AL
#!/usr/bin/env python
"""Convert a master latex file,
into a single document by including
automatically all the LaTeX documents
which are arguments of
\include or \input
ignoring any \includeonly
"""
import sys
if len(sys.argv)==3: