Skip to content

Instantly share code, notes, and snippets.

View Cloudef's full-sized avatar

Jari Vetoniemi Cloudef

View GitHub Profile
######################################
## Open file inside git tree on vim ##
######################################
vimo() {
local match=
local gtdir=
local cwd=$PWD
git ls-files &>/dev/null || return # test if git
gtdir="$(git rev-parse --show-toplevel)"
[[ "$cwd" != "$gtdir" ]] && pushd "$gtdir" &> /dev/null # git root
@Cloudef
Cloudef / config.h
Created April 16, 2012 19:29
monsterwm pandora (vi mode and systray)
/* see LICENSE for copyright and license */
#ifndef CONFIG_H
#define CONFIG_H
#include <X11/XF86keysym.h>
/* handheld mode?
* Optimizes interface to small screens */
#define HANDHELD 1
@Cloudef
Cloudef / asound.conf
Created January 25, 2012 14:09
etc - system configuration
# ALSA
# /etc/asound.conf
# ipc_key must - be unique, it has no other meaning.
# ipc_key_add_uid - allows multi user audio when false.
# ipc_perm - sets permissions, may fix issues on multi user or tty playback.
# smaller buffer/period sizes can generally reduce latency and hence give better performance,
# but going too small can cause crackling or other sound issues.
@Cloudef
Cloudef / nvidia-load-settings.sh
Created January 25, 2012 13:45
Some system utilities
#!/bin/sh
# Workaround bug where nvidia-settings --load-config-only
# does not actually load any attributes.
#
# It might be related to values that have decimals such as
# RedBrightness=1.000000
# nvidia-settings will complain about (Trailing garbage), unless ran as root..
#
# However, running as root isn't really a nice thing, so this script just assign everything
# It will still give you complaints about (Trailing garbage), but at least other settings get applied.
@Cloudef
Cloudef / gist:1566795
Created January 5, 2012 19:30
Scale Katawa Shoujo
#!/bin/sh
# Katawa Shoujo
# Default setting is fullscreen for 1440x900 with black borders at side.
#
# Depends: x11vnc, Xvfb
# vncviewer comes from tightvnc, but you can alternatively use any viewer you want.
#
# To calculate the target resolution and scaler
# that matches your whole screen while maintaining aspect ratio, here's some math:
#
@Cloudef
Cloudef / gist:1503155
Created December 20, 2011 20:34
shellinabox: fix reverse proxy timeouts
AJAX_TIMEOUT 5
in session.h
@Cloudef
Cloudef / gist:1378156
Created November 19, 2011 00:01
milkyhelper, repo download
#!/bin/sh
# Install && Update everything from repo
# Virtual SD (Download directory)
# Creates pandora layout there and stores libmilky database
VD="/absolute/path/to/download/dir"
mkdir -p "$VD"
# Sync database with repo
milky -r "$VD" -Sy
@Cloudef
Cloudef / gist:1344609
Created November 7, 2011 10:17
winmm/mmio: Add extra handling for unbuffered MMIO handles
From c877ba08ee19b8b5f38ea4f37ce345208d158eba Mon Sep 17 00:00:00 2001
From: Cloudef <mailRoxas@gmail.com>
Date: Sun, 6 Nov 2011 18:57:57 +0200
Subject: winmm/mmio: Add extra handling for unbuffered MMIO handles
On non buffered mmioSeek, set the lBufOffset accordingly.
On non buffered mmioRead, seek to beginning of the file and return 0 meaning that the file ended.
I don't know if this just reveals bad programming in application,
or that native winmm likes to try handle code when it's wrongly used..
@Cloudef
Cloudef / gist:1324254
Created October 29, 2011 08:58
rtorrent-mod-v3
diff -rupN src-old/command_download.cc src/command_download.cc
--- src-old/command_download.cc 2011-06-04 07:01:19.000000000 +0300
+++ src/command_download.cc 2011-10-29 11:10:41.258332501 +0300
@@ -5,12 +5,12 @@
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
@Cloudef
Cloudef / gist:1293166
Created October 17, 2011 17:22
Menu patch for dwm-6 (hg) (Keybindings, few fixes)
changeset: 1590:260e6f30aa70
tag: tip
user: cloudef
date: Sat Dec 17 22:34:07 2011 +0200
summary: dwm-menu-patch
diff -r 40bff70c312f -r 260e6f30aa70 config.def.h
--- a/config.def.h Tue Nov 15 20:16:58 2011 +0100
+++ b/config.def.h Sat Dec 17 22:34:07 2011 +0200
@@ -36,6 +36,7 @@