Skip to content

Instantly share code, notes, and snippets.

View Cloudef's full-sized avatar

Jari Vetoniemi Cloudef

View GitHub Profile
glhckObject *ground2 = glhckObjectNew();
unsigned int rows = 16, cols = 16, i, i2, vi, ii;
glhckImportVertexData v[rows*cols];
glhckImportIndexData id[rows*cols*2];
memset(id, 0, rows*cols*2*sizeof(glhckImportIndexData));
memset(v, 0, rows*cols*sizeof(glhckImportVertexData));
for (vi = 0, ii = 0, i = 0; i != rows; i++) {
id[ii++] = i*cols;
for (i2 = 0; i2 != cols; ++i2) {
id[ii++] = i*cols+i2;
@Cloudef
Cloudef / gist:3260717
Created August 5, 2012 00:08
quick dirty color for -Ss
#!/bin/sh
# color output of -Ss
[[ -n "$PACMAN" ]] || {
PACMAN="pacman"
}
C[0]="\033[33m" # core
C[1]="\033[34m" # extra
C[2]="\033[32m" # community
######################################
## 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..