Skip to content

Instantly share code, notes, and snippets.

View brenttaylor's full-sized avatar

Ryan Brent Taylor brenttaylor

  • San Lorenzo, California
View GitHub Profile
@brenttaylor
brenttaylor / roll.py
Last active September 24, 2017 14:16
A tabletop dice roller in python that horribly abuses the language.
import random
import re
import sys
from functools import lru_cache
@lru_cache()
def generate_die(sides):
return list(range(1, sides + 1))
@brenttaylor
brenttaylor / build-godot.ps1
Created October 28, 2016 08:31
Crappy base godot build script
param(
[string] $target="templates",
[string] $platform="x64"
)
# 32-bit compile or 64-bit compile
if ($platform -eq "x64") {
Write-Host "Configuring for 64-bit..."
vcvarsall x86_amd64
@brenttaylor
brenttaylor / test.py
Last active October 19, 2016 05:05
Total bastardry
class MetaModel(type):
def _get_count(self):
# just do db lookup here
return 5
count = property(_get_count)
class Model:
__metaclass__= MetaModel
DATA_FILE = 'input.txt'
class BoxWrappingDimensions:
def __init__(self, length, width, height):
self.length = length
self.width = width
self.height = height
def _build_sides(self):
: <<TRAMPOLINE
@echo off
"C:\Program Files\Oracle\VirtualBox\vboxmanage.exe" list runningvms>NUL | findstr /B \"LocalLinuxServer\"
IF %ERRORLEVEL% EQU 1 (
C:\Users\BTaylor\Dropbox\Apps\HStart\hstart.exe /NOCONSOLE "C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe -s LocalLinuxServer"
start "" "C:\Program Files (x86)\Xming\Xming.exe" :0 -clipboard -multiwindow
)
set PATH=C:\cygwin\bin;%PATH%
bash "%~f0" "%*" > nul 2>&1
@brenttaylor
brenttaylor / gist:4357359
Created December 22, 2012 03:26
Doesn't work
def RegisterHotkeys(self, Hotkeys):
for Hotkey in Hotkeys:
ID = wx.NewId()
self.RegisterHotKey(ID, Hotkey["Modifiers"], Hotkey["Key"])
self.Bind(wx.EVT_HOTKEY, lambda Event: Hotkey["Function"](self.Controller),
id=ID)
self.EventIDs.append(ID)
def RegisterHotkeys(self, Hotkeys):
def RegisterHotkey(Hotkey):
ID = wx.NewId()
self.RegisterHotKey(ID, Hotkey["Modifiers"], Hotkey["Key"])
self.Bind(wx.EVT_HOTKEY, lambda Event: Hotkey["Function"](self.Controller),
id=ID)
self.EventIDs.append(ID)
for Hotkey in Hotkeys:
RegisterHotkey(Hotkey)
Name:
task
Program:
C:/Python27/pythonw.exe
Arguments:
G:/Projects/Current/CLTask/CLTask.py $$
import smtplib, sys
from email.mime.text import MIMEText
Username = "me@email.com"
Password = "MyPassword"
SMTPServer = "smtp.gmail.com:587"
Sender = "me@email.com"
Recipient = "me@wunderlist.com"
Task = ' '.join(sys.argv[1:])
Bucket = "Inbox"
int main(int argv, char **args) {
EnumWindows(MyEnumProc, 0);
WunderlistWebCtrl = GetWindow(Wunderlist, GW_CHILD);
SetForegroundWindow(Wunderlist);
SetActiveWindow(Wunderlist);
SetFocus(WunderlistWebCtrl);
//Simulate a Ctrl+N keyboard shortcut
PostMessage(WunderlistWebCtrl, WM_KEYDOWN, VK_CONTROL, 0x001D0001);