Skip to content

Instantly share code, notes, and snippets.

@nicwest
nicwest / martingale
Created September 10, 2012 12:15 — forked from eknowles/martingale
martingale
import random
####################
# THE RULES
# 1. Play Roulette once a week for 3 hours for a year
# 2. Bring 500
# 3. Play Minimum bet on two tables on red
# 4a. If red continue to play minimum bet
# 4b. If black double bet (continue to double until red)
# 4c. If unable to double bet, reset bet to minimum
@nicwest
nicwest / gist:4233641
Created December 7, 2012 14:37
default cover generator
print "\tCover Image..."
picture_page = "http://stunjelly.com/cover/?" + urllib.urlencode({"title": bundle["name"], "author": bundle["author"]})
opener1 = urllib2.build_opener()
page1 = opener1.open(picture_page)
my_picture = page1.read()
filename_img = os.path.join(directory, "OEBPS", "Images", "stunjelly-cover.jpg")
fout = open(filename_img, "w+")
fout.write(my_picture)
fout.close()
@nicwest
nicwest / gist:7779659
Created December 3, 2013 23:32
wot famepoint checker output
/usr/bin/python /home/nic/PycharmProjects/famepoints/example.py
scrobbling page 0...
scrobbling page 1...
scrobbling page 2...
scrobbling page 3...
scrobbling page 4...
scrobbling page 5...
scrobbling page 6...
scrobbling page 7...
scrobbling page 8...
@nicwest
nicwest / gist:8562185
Created January 22, 2014 16:42
epubdiffsample
Summary:
---------------------------------
Binary File Change EPUB/images/2565514353_2ae2073e14.jpg
Text File Change (With Diff) EPUB/package.opf
Text File Change (With Diff) EPUB/script/shared.js
Text File Change (With Diff) EPUB/xhtml/p10.xhtml
Text File Change (With Diff) EPUB/css/shared-culture.css
File Removed EPUB/xhtml/cover.xhtml
#!/bin/bash
sleep 0 && # 0 good for Xfce - use 20 to 30 for Gnome
source /home/nic/Conky/conky.sh
@nicwest
nicwest / python-label-thing.vim
Last active January 2, 2019 13:13
vim function that copies a dotted python path label thing from your cursor to your clipboard for running tests
function! PythonGetLabel()
if foldlevel('.') != 0
norm! zo
endif
let originalline = getpos('.')
let lnlist = []
let lastlineindent = indent(line('.'))
let objregexp = "^\\s*\\(class\\|def\\)\\s\\+[^:]\\+\\s*:"
if match(getline('.'),objregexp) != -1
let lastlineindent = indent(line('.'))
This file has been truncated, but you can view the full file.
python runtests.py --settings=test_sqlite -v 3[?1l>
kpython\Testing against Django installed in '/Users/nic/Sideprojects/django/django'
Importing application absolute_url_overrides
Importing application admin_autodiscover
Importing application admin_changelist
Importing application admin_checks
Importing application admin_custom_urls
Importing application admin_docs
Importing application admin_filters
Importing application admin_inlines
function! templates#vars#vim_version () abort
let l:patch = filter(range(0,999), 'has("patch" . v:val)')[-1]
return string(v:version / 100.0) . '.' . l:patch
endfunction
if bufexists('DELETEME')
bw! DELETEME
endif
vert new DELETEME
let s:contents = system('curl -si http://google.com')
call append(0, ['WITH WIERD CHARS:', '-----------------', s:contents])
let s:fix_return_newline = substitute(s:contents, '\r\n', "", 'g')
"maps x to null buffer
nnoremap x "_x
vnoremap x "_x