Skip to content

Instantly share code, notes, and snippets.

View Zaxuhe's full-sized avatar

Vicente Benavent Valenzuela Zaxuhe

View GitHub Profile
#!/bin/bash
# prune include files one at a time, recompile, and put them back if it doesn't compile
# arguments are list of files to check
removeinclude() {
file=$1
header=$2
perl -i -p -e 's+([ \t]*#include[ \t][ \t]*[\"\<]'$2'[\"\>])+//REMOVEINCLUDE $1+' $1
}
replaceinclude() {
file=$1
@Zaxuhe
Zaxuhe / gist:dba572bd7951ba16b8a9
Created January 11, 2015 04:37
brick breaker
local img_fondo;
local img_guante;
local img_pelota;
local pelota_y;
local pelota_x;
local guante_x;
local speed;
local f_guante;
local f_pelota;
@Zaxuhe
Zaxuhe / gist:8866087
Created February 7, 2014 16:19
bb10 avoid screen sleep
int idle_mode = SCREEN_IDLE_MODE_KEEP_AWAKE;
screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_IDLE_MODE, &idle_mode);
@Zaxuhe
Zaxuhe / focusonclick.diff
Created February 13, 2013 20:24
dwm focusonclick patch
diff -up dwm-6.0/config.def.h dwm-6.0-focusonclick/config.def.h
--- dwm-6.0/config.def.h 2011-12-19 09:02:46.000000000 -0600
+++ dwm-6.0-focusonclick/config.def.h 2012-11-24 17:48:19.867072611 -0600
@@ -13,6 +13,9 @@ static const unsigned int snap = 32
static const Bool showbar = True; /* False means no bar */
static const Bool topbar = True; /* False means bottom bar */
+/* False means using the scroll wheel on a window will not change focus */
+static const Bool focusonwheelscroll = False;
+
@Zaxuhe
Zaxuhe / linux clock.cpp
Last active December 12, 2015 10:09
Linux get time sample, using CLOCK_MONOTONIC_RAW
/**
* Created by Zaxuhe
**/
#include <iostream>
#include <time.h>
#define SEC2NANO 1000000000.0f
using namespace std;
@Zaxuhe
Zaxuhe / opengles.cpp
Created May 28, 2012 18:43
opengl es functions
#define glOrtho(a,b,c,d,e,f) glOrthof(a,b,c,d,e,f)
#define glOrtho(a,b,c,d,e,f) glOrthof(a,b,c,d,e,f)
#define glColor3f(r,g,b) glColor4f(r,g,b,1.0)
void gluPerspective(double fovy, double aspect, double zNear, double zFar)
{
// Start in projection mode.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
double xmin, xmax, ymin, ymax;