Skip to content

Instantly share code, notes, and snippets.

View Cloudef's full-sized avatar

Jari Vetoniemi Cloudef

View GitHub Profile
@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 / 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
######################################
## 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 / 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
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 / smscat.sh
Last active December 10, 2015 16:08
# sms through android
# $1 = phone number
# $@ = message
function sms() {
[[ -n "$1" ]] || { echo "no number given"; return; }
local num="$1"; shift 1;
[[ -n "$@" ]] || { echo "no message given"; return; }
ssh -q root@hack-ANDROID "am start -a android.intent.action.VIEW -d sms:$num --es sms_body \"$@\" --ez exit_on_sent true"
}
@Cloudef
Cloudef / gist:4971329
Last active December 13, 2015 20:38
vsm glhck shader
Basic VSM shadow mapping shader
-- GLhck.DepthRender.Unpacking.Fragment
void main() {
float Depth = glhckUnpackHalf(texture2D(GlhckTexture0, GlhckFUV0).st);
GlhckFragColor = vec4(Depth, Depth, Depth, 1.0);
}
-- GLhck.Depth.Packing.Fragment
void main() {
@Cloudef
Cloudef / gist:5735519
Created June 8, 2013 15:31
Spacerocks score decryptor/encryptor
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv)
{
FILE *f; char buf, buf2[255], read = 0, isScore = 0, *s;
if (argc < 1) return EXIT_FAILURE;
if (!(f = fopen(argv[1], "rb"))) return EXIT_FAILURE;
while (fread(&buf, 1, 1, f) == 1) {
@Cloudef
Cloudef / pandorahck.c
Last active December 18, 2015 13:18
Uh....
/* gcc -std=c99 -shared -Wl,-soname,libpandorahck.so pandorahck.c -o libpandorahck.so
*
* Hacks for Open Pandora that should not be normally needed
* Will be compiled with glhck if PANDORA option is specified when built with cmake
* You can then copy it to your project and launch with LD_PRELOAD=/path/to/libpandorahck.so ./project
*
* Hacks:
* 1. Report that pandora doesn't support libxi to avoid crash on any mouse event.
* 2. Grab all input to window to avoid popular Openbox PND keybind conflicts.
* (can be disabled with PANDORAHCK_NO_GRAB)
/* gcc `pkg-config --cflags --libs libsystemd-login` systemd-active-user.c -o systemd-active-user
* get current active user id that has process in 'foreground' according to documentation */
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
uid_t *uids = NULL, uactiveid = 0;
int i, num = sd_get_uids(&uids);