Skip to content

Instantly share code, notes, and snippets.

@JPLeBreton
JPLeBreton / twitch_stream.sh
Created October 21, 2012 21:47
shell script for streaming to twitch.tv
#! /bin/bash
# from
# https://gist.github.com/3178130
# gist created by brodul
# modified for http://twitch.tv/jplebreton
# originaly from http://tinyurl.com/twitch-linux from taladan
# www.youtube.com/user/taladan
@JPLeBreton
JPLeBreton / retrofilter
Created December 28, 2014 01:31
Shell script to run Retrofilter on an image, in Linux using Wine
cp "$1" /tmp
infilewithext=`basename "$1"`
infile=`basename "$1" | cut -d\. -f1`
convert /tmp/$infilewithext -type TrueColor /tmp/$infile.tga
wine ~/wine_c/retrofilter/Retrofilter.exe /tmp/$infile.tga
convert /tmp/$infile.crt.tga $infile-crt.png
@JPLeBreton
JPLeBreton / pil_test.py
Created August 11, 2015 23:55
PIL/Pillow test: crash converting transparent GIF to RGB
import os.path
from PIL import Image
# image URLs for the two images used below:
# http://vectorpoem.com/images/grad.gif
# http://vectorpoem.com/images/grad2.gif
def convert_image(src_img_filename):
# convert source image to RGB, then convert it to an arbitrary test palette
print('reading %s...' % src_img_filename)
@JPLeBreton
JPLeBreton / pb_steal.py
Created September 1, 2015 23:52
First bit of Python code I wrote, December 2nd 2004: calculate "steal chance" in Phantom Brave
charsteal = 93.0
charlev = 260.0
tarsteal = 70.0
tarlev = 477.0
if __name__ == "__main__":
newlev = raw_input("Character Level? ") # raw_input doesn't squawk at empty strings!
if newlev != "":
charlev = float(newlev)
@JPLeBreton
JPLeBreton / rot_n.py
Last active October 17, 2015 20:15
ROT-N variable-offset substitution encipher for Python3 (to decipher, enter negative offset)
from string import ascii_lowercase
def rot_n(in_string, n=13):
"returns copy of in_string shifted alphabetically by given offset N"
n %= len(ascii_lowercase)
char_shifts = ascii_lowercase[n:] + ascii_lowercase[:n]
out_string = ''
for char in in_string:
if not char.isalpha():
@JPLeBreton
JPLeBreton / binds.cfg
Created August 8, 2016 20:42
Photoshop-style keybinds for Playscii
# user keybinds file
# accepted modifiers: ctrl, alt, shift
# keys must be equivalent to output of sdl2.SDL_GetKeyName(),
# eg return, tab, backspace
self.edit_bind_src = {
'ctrl q' : 'quit',
'`' : 'toggle_console',
'ctrl m' : 'convert_image',
'ctrl e' : ('export_image', 'edit_art_for_selected_objects'),
@JPLeBreton
JPLeBreton / wadls.py
Last active March 7, 2021 23:53
wadls - list all map files within a WAD/PK3/ZIP
#!/usr/bin/python
import os, sys, zipfile, tempfile
# wadls (pronounced "waddles", thx joshthenesnerd) - list all maps in a wad/zip/pk3
# requires omgifol module, set path to it here or in env variable
OMG_PATH = os.environ.get('OMG_PATH', None) or '/home/jpl/projects/wadsmoosh'
sys.path.append(OMG_PATH)
import omg
@JPLeBreton
JPLeBreton / wadbot3_log.txt
Created August 7, 2017 06:01
wadbot3 level index dump
This file has been truncated, but you can view the full file.
WADBOT v3
=========
Updating level index...
13585 new ZIP files indexed
41467 new levels indexed in 611.6325542926788 seconds
Level list:
combos/alangnsx.zip | altaunts.WAD | MAP84
combos/alangnsx.zip | alandogunx.WAD | MAP84
combos/alangnsx.zip | alandogunx.WAD | TITLEMAP
combos/alangnsx.zip | reallight.WAD | MAP87
@JPLeBreton
JPLeBreton / playscii_pi3_crash.log
Created January 2, 2018 06:27
playscii raspberry pi3 PyOpenGL crash
pi@emulord:~/playscii $ python3 playscii.py
Playscii v0.9.9
Loading config from /home/pi/.config/Playscii/playscii.cfg...
Config loaded.
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
Detecting hardware...
CPU: armv7l
OS: Linux-4.9.35-v7+-armv7l-with-debian-8.0
@JPLeBreton
JPLeBreton / fishing.zsc
Created March 5, 2018 05:06
Fishing Rod (multi-phase fire state weapon)
class MFFishingRod : Weapon
{
States
{
Spawn:
SAWG C -1;
Stop;
Ready: