Skip to content

Instantly share code, notes, and snippets.

View alesegdia's full-sized avatar
😸

Alejandro Seguí alesegdia

😸
View GitHub Profile
@alesegdia
alesegdia / usefulbash.sh
Last active August 29, 2015 14:07
Useful bash commands
# sort folders/files by disk usage
du -hc . | grep [.]/[^/]*$ | sort -h
# replace in all files
grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'
# script to rename in all files:
#!/usr/bin/env bash
if [ $# -ne 3 ]; then
@LPGhatguy
LPGhatguy / demo.lua
Last active August 29, 2015 14:02
OpenGL function loader for LuaJIT. This is a fixed up version of slime73's original code. See demo.lua for usage.
local glfw = require("glfw3") --Let's say we have a magic GLFW3 binding there!
local openGL = require("opengl")
openGL.loader = glfw.GetProcAddress
openGL:import()
--and somewhere else
local vbo = ffi.new("GLuint[1]")
gl.GenBuffers(1, vbo)
gl.BindBuffer(GL.ARRAY_BUFFER, vbo[0])
gl.BufferData(GL.ARRAY_BUFFER, ffi.sizeof(vertices), vertices, GL.STATIC_DRAW)
@keitheis
keitheis / color_picker.py
Created June 25, 2012 02:59
A Sample Color Picker by Python
#!/usr/bin/python
import gtk, sys
def tohex(c):
#Convert to hex string
#little hack to fix bug
s = ['#',hex(int(c[0]*256))[2:].zfill(2),hex(int(c[1]*256))[2:].zfill(2),hex(int(c[2]*256))[2:].zfill(2)]
for item in enumerate(s):
if item[1]=='100':
s[item[0]]='ff'
print s
@perky
perky / ProFi.lua
Created May 30, 2012 20:32
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()