This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
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() |