Skip to content

Instantly share code, notes, and snippets.

View henryiii's full-sized avatar
👨‍🍼
New baby

Henry Schreiner henryiii

👨‍🍼
New baby
View GitHub Profile
@henryiii
henryiii / bstemplate.bash
Last active December 18, 2015 20:29
Bash Script Template, copy useful parts.
#!/usr/bin/env bash
# No argument version (any argument prints help)
if [ $# -gt 0 ] ; then
echo "$(echo $0 | sed "s;$HOME;~;")"
echo "Help command output"
exit 0
fi
@henryiii
henryiii / pstemplate.py
Created June 22, 2013 16:49
Python Script Template, copy useful parts.
#!/usr/bin/env python
import argparse
import os
DIR = os.path.realpath(__file__)
parser = argparse.ArgumentParser(description='Send files to web server')
parser.add_argument('-n', '--nochange',
help='make a dry run, don\'t send anything',
@henryiii
henryiii / git-all.bash
Last active April 29, 2023 15:13
Fast repository status for repos in git folder
#!/usr/bin/env bash
# This script should be named (or symbolically linked) as git-all so that
# it can be run as a git command (if it is in the path). The repo location should
# be set in REPOLOC. Can be relative if this script is also in a repo!
# Standard bash stuff to get the current directory
unset CDPATH
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@henryiii
henryiii / gist:6274508
Created August 19, 2013 21:39
pyqttemplate.py
#!\usr\bin\env python
from PyQt4 import QtCore, QtGui, uic
import sys
import os
Slot = QtCore.pyqtSlot
Signal = QtCore.pyqtSignal
LoadUI = uic.loadUi
if getattr(sys, 'frozen', None):
@henryiii
henryiii / installsympy.py
Last active August 29, 2015 13:56
installsimpy
# Install SimPy
import urllib
import tarfile
import shutil
import console
import os
name = 'sympy'
version = '0.7.5'
@henryiii
henryiii / iDG.py
Last active August 29, 2015 14:02
iDG.py
import ui
import console
#from DetGUI.connection import Detector
sz = ui.get_screen_size()
banner = 108
class MyTextFieldDelegate (object):
def __init__(self,but):
self.but = but
@henryiii
henryiii / uidir.py
Last active August 29, 2015 14:03
directory viewer for ui
# coding: utf-8
import ui
import os
import console
class MyTableViewDataSource (object):
sel = [None]
def __init__(self, base_dir = '.'):
@henryiii
henryiii / h2048.py
Last active January 17, 2022 07:06
Pythonista 2048 clone, using ui module. Also should work in any Python console. Added jsbain's swipe implementation.
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 12 09:33:29 2014
@author: henryiii
Added improvents by JonB (swipes), techteej (design), LawAbidingCactus (size)
"""
import console, random
@henryiii
henryiii / textmanipui.py
Created July 16, 2014 03:38
UI powered text manipulation
# perform actions on a selected block of text
import editor
import ui
sel = editor.get_selection()
text = editor.get_text()
if sel[0]-sel[1]:
text = text[sel[0]:sel[1]]
@henryiii
henryiii / cards.py
Last active October 13, 2022 01:18
base for card games
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 20 17:27:33 2014
@author: henryiii
"""
# http://en.wikipedia.org/wiki/Playing_cards_in_Unicode
from __future__ import unicode_literals, division