Skip to content

Instantly share code, notes, and snippets.

@Darkhogg
Darkhogg / raspberry-wifi-disconnect-fix.PKGBUILD
Last active August 29, 2015 14:11
Small package to fix WiFi disconnection problems on the Raspberry Pi
# Maintainer: Daniel Escoz <darkhogg+aur at gmail dot com>
pkgname=raspberrypi-wifi-disconnect-fix
pkgver=20141222
pkgrel=1
arch=(any)
license=('custom:WTFPL')
package() {
install -Ddm755 "$pkgdir/etc/modprobe.d/"
echo 'options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1' >"$pkgdir/etc/modprobe.d/8192cu.conf"
@Darkhogg
Darkhogg / dhg.zsh-theme
Created March 21, 2014 19:37
A theme for oh-my-zsh
local _c_reset="$reset_color"
local _c_user="$fg_bold[green]"
local _c_host="$fg_bold[yellow]"
local _c_path="$fg_bold[blue]"
local _c_git_branch="$fg_bold[magenta]"
local _c_git_dirty="$fg_bold[cyan]"
local _c_prompt="$fg_bold[white]"
local ret_status="%(?::
%{$fg_bold[red]%}%?%s)"
@Darkhogg
Darkhogg / okko.sh
Last active December 19, 2015 07:09
A shell function that executes a command and tells if it succeeded or failed with customizable output.
#$ okko [opts] message command [args]*
#
# This shell function provides a way to run a command and present its result
# in a user-friendly way.
#
# The provided message is initially printed to the screen, then the command is
# run with the given arguments. After command completion, 'ok' is printed if
# the command exited with a tatus of 0, else 'err(N)' is printed, where N is
# the error code.
#
@Darkhogg
Darkhogg / PeriodicScrot
Last active October 3, 2015 08:38
A small script that uses `scrot` to periodically save screenshots from the desktop.
./capture [-h] [-p period] [-d directory]
* Use **-h** to print the above usage line.
* Use **-p period** to specify the period of the screenshots, in seconds. The *period* argument must be a positive integer. Defaults to *15* seconds.
* Use **-d directory** to specify the directory where the screenshots will be saved. The specified directory must exist and be writable. Defaults to the current working directory (which may be not writable, which won't cause an immediate error, but will make scrot fail).
In order to this script to work, you need to have the `scrot` command installed on your PATH.
The script may be paused by sending an interrupt signal (`SIGINT`), typically by pressing the `CTRL-C` key combination. When the script is paused, you may resume it by pressing `ENTER` or end it with another `CTRL-C`.
@Darkhogg
Darkhogg / Slick2D-Scaffolding
Last active September 28, 2015 16:48
Scaffolding for a Slick2D game for Ludum Dare
Generic scaffolding for fast deploying of Slick2D games.
* Includes a `Main` class with a `main` method that serves as an entry point for applications.
* Includes a class within `Main`, `Main$WrapperGame`, which wraps the actual `Game` implementation for use with the Slick2D `AppletLoader` class, which also serves as a common starting point for the `main` method.
* Includes an automatic modification of the `java.library.path` system property which *adds* the path `lib/natives-*system*` to the path, where *system* is one of `linux`, `windows`, `mac` or `solaris`.
* Includes a basic class `MyGame` ready to be filled with the game implementation.
* Includes an HTML file with an applet ready to be used.
* Includes an Ant buildfile ready to be executed, which generates an executable JAR file, a ZIP containing that JAR and the `lib` folder, and a `README.txt` file, if present; and another ZIP file with the `src`, `res` and `lib` folders.
To start working with this, you will need to refactor the included classes.