Skip to content

Instantly share code, notes, and snippets.

View purpleidea's full-sized avatar

James purpleidea

View GitHub Profile
@purpleidea
purpleidea / systemd-start-and-wait.go
Created May 4, 2018 13:51 — forked from ghedo/systemd-start-and-wait.go
Start a systemd unit and wait until it stops
package main
import "log"
import "os"
import "github.com/docopt/docopt-go"
import "github.com/godbus/dbus"
const target string = "org.freedesktop.systemd1";
const object string = "/org/freedesktop/systemd1";
#!/bin/bash
# James Shubin, 2018
# run `make` in the first directory (or its parent recursively) that it works in
# https://purpleidea.com/blog/2018/03/10/running-make-from-anywhere/
MF='Makefile' # looks for this file, could look for others, but that's silly
CWD=$(pwd) # starting here
while true; do
if [ -e "$MF" ]; then
FIRST install steam controller driver in retropie setup menu...
IN: /etc/udev/rules.d/99-steam-controller.rules
# This rule is needed for basic functionality of the controller in
# Steam and keyboard/mouse emulation
SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666"
# This rule is necessary for gamepad emulation
KERNEL=="uinput", MODE="0660", GROUP="james", OPTIONS+="static_node=uinput"
#!/bin/bash
# watch your irssi fnotify file for new messages to notify you of...
# Copyright (C) 2012-2013 James Shubin
# Written by James Shubin <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Droopy (http://stackp.online.fr/droopy)
# Copyright 2008-2012 (c) Pierre Duquesne <[email protected]>
# Copyright (C) 2012-2013 James Shubin <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
commit b870395fe3f82eaab7c146d83b3a3f0cab2b63f6
Author: James Shubin <[email protected]>
Date: Mon Jan 28 04:44:59 2013 -0500
Inline image display and storage
This patch adds two forms of inline image storage.
1) Inline storage of a png file within the python source code. This is
especially useful so that the user can offer a pretty front end, without
having to clutter their ~/bin with additional files.
# -*- coding: utf-8 -*-
"""
HTTPDaemon simple non-blocking, threaded HTTPD server
Example:
serveraddr = ('', 8000)
server = MultiThreadedHTTPServer(serveraddr, SimpleHTTPServer.SimpleHTTPRequestHandler)
server.serve_forever() # blocks here
print 'Server has quit.'
#!/bin/bash
# Simple script to count the number of $pattern in each file
# Copyright (C) 2013+ James Shubin
# Written by James Shubin <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
use strict;
use vars qw($VERSION %IRSSI);
#use Data::Dumper;
#local $Data::Dumper::Terse = 1;
use Irssi;
$VERSION = '0.0.4';
%IRSSI = (
name => 'fnotify',
authors => 'James Shubin',
#!/bin/bash
# james shubin, agplv3+
# pause until key press and then continue
# https://ttboj.wordpress.com/2017/01/06/ten-minute-hacks-process-pause-resume
if [ ! "$#" -eq 1 ]; then
echo "Usage: `basename $0` <process>"
echo "Pauses process until key press and then continues!"
exit 1
fi