Skip to content

Instantly share code, notes, and snippets.

View ssokolow's full-sized avatar

Stephan Sokolow ssokolow

View GitHub Profile
@ssokolow
ssokolow / Makefile
Last active August 29, 2015 14:00
Makefile for compiling unxwb on non-Windows platforms rather than using the provided Windows binary in Wine
# Makefile for unxwb from http://aluigi.altervista.org/papers.htm
# NOTE: You must have the zlib development headers installed
#
# Instructions:
# - `make` or `make build` to build a native binary.
# - `make multiarch` to build 64-bit and 32-bit binaries on a 64-bit system
# - `make dist` to produce an optimized zip file from "make multiarch"
# (Also requires `advzip` from AdvanceCOMP installed)
CC = gcc
@ssokolow
ssokolow / crontab
Last active August 29, 2015 14:05
Simple GTK+ update notifier for apt-get which doesn't nag about restarting your PC
# Add this to your USER (not root) crontab for daily update checks
0 6 * * * DISPLAY=:0 ~/bin/update_check.sh
@ssokolow
ssokolow / task_skip_daily
Created August 10, 2014 02:42
Expect script for deleting all missed instances of TaskWarrior tasks which recur daily
#!/usr/bin/expect --
spawn task "( recur.is:1d or recur.is:daily )" due.before:now status:pending delete
for {} 1 {} {
expect {
"Permanently delete task" { send "y\n"}
"This is a recurring task. Do you want to delete all pending recurrences of this same task? (yes/no)" { send "n\n"}
eof { exit }
}
}
@ssokolow
ssokolow / battery_monitor.py
Last active August 29, 2015 14:14
Low-Battery Warning Monitor for GTK+ 3.x desktops
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""Simple, efficient low battery monitor
By: Stephan Sokolow (deitarion/SSokolow)
Written for Guest2587 @ FreeNode
Released under the MIT license
Dependencies:
- python-gi
@ssokolow
ssokolow / check_desura_in_coll.py
Created June 8, 2015 06:05
Quick script to filter an IsThereAnyDeal.com JSON collection dump for Desura-only entries
#!/usr/bin/env python2
# To use: Place in same folder as collection.json and run in terminal
import json
SAFE_STORES = ['GOG', 'Humble Store', 'IndieGameStand', 'ShinyLoot']
data = json.load(file('collection.json'))
desura_only, desura_other = [], []
for row in data.values():
stores = [x['shop'] for x in row['details']]
@ssokolow
ssokolow / snippet.sh
Created June 24, 2009 04:21 — forked from ches/snippet.sh
ches's github alias modified for Linux
# Bash alias to open Github page for project in current working directory.
# Will use the current active branch if it exists remotely, or falls back to master.
alias github='br=$(git branch --contains HEAD | sed -rn "s/^\* //p"); if ! git ls-remote . | grep -q -e "refs/remotes/.*/${br}"; then br="master"; fi; xdg-open $(git config -l | sed -rn "s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p")'
@ssokolow
ssokolow / saver_disabler.sh
Created June 25, 2009 02:56
xkill-style screensaver-disabling which won't leave it disabled by accident
#!/bin/sh
# A simple little script which prompts you to click a window and then disables
# the screensaver until it goes away.
WID=`xwininfo -int | awk '/Window id/ {print $4}'`
xdg-screensaver suspend "$WID"
@ssokolow
ssokolow / radiobuttons_with_none_selected.py
Created June 25, 2009 03:01
How to fake a gtk.RadioToolButton group where you can set all buttons inactive
# PyGTK doesn't let you set_active(False) on all radio buttons.
# You can work around that by adding a button to the group which will never
# be made visible to the user. (Don't add it to any window)
self.zoom_100 = self.wTree.get_widget("zoom_100")
self.zoom_fit = self.wTree.get_widget("zoom_fit")
self.zoom_manual = gtk.RadioToolButton(self.zoom_100)
@ssokolow
ssokolow / get_selection_html.coffee
Created June 25, 2009 03:09
How to get the current selection in HTML rather than plaintext
getSelectionHTML = ->
# Everyone but IE supports DOM selections
if window.getSelection
sel = window.getSelection()
# IE Selections (Must come last to avoid messing with Opera)
else if document.selection
return document.selection.createRange().htmlText
# Fail safely
else
return ""
@ssokolow
ssokolow / LCDd.conf
Created November 3, 2009 06:48
LCDd.conf for PCIDEA 20x4 USB LCD
[server]
Driver=CFontzPacket
## CrystalFontz packet driver (for CF631, CF633 & CF635) ##
[CFontzPacket]
# Select the LCD model [default: 633; legal: 631, 633, 635]
Model=631
# Select the output device to use [default: /dev/lcd]
Device=/dev/ttyUSB0