Skip to content

Instantly share code, notes, and snippets.

View alesegdia's full-sized avatar
😸

Alejandro Seguí alesegdia

😸
View GitHub Profile
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get build-dep vim-gnome
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev mercurial libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev
sudo rm -rf /usr/local/share/vim
sudo rm /usr/bin/vim
@alesegdia
alesegdia / gist:256b3bdb941ed1c4bed9
Created September 24, 2014 21:23
vala workarounds
# Example file (GTK3 VERSION): https://wiki.gnome.org/Projects/Vala/CairoSample#Shaped_Window_Example
# My system had no default -lm addition with valac, options are:
# 1. Directly compiling with valac passing compiler linker flags:
valac -X -lm --pkg gtk+-3.0 --pkg cairo --pkg gdk-3.0 cairo-shaped.vala
# 2. Using valac to generate .c and compile
valac -C --pkg gtk+-3.0 --pkg cairo --pkg gdk-3.0 cairo-shaped.vala
gcc cairo-shaped.vala `pkg-config glib-2.0 --cflags --libs` `pkg-config gtk+-3.0 --cflags --libs` `pkg-config gdk-3.0 --cflags --libs` -lm
@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
@alesegdia
alesegdia / demo.lua
Last active August 29, 2015 14:07 — forked from LPGhatguy/demo.lua
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)
@alesegdia
alesegdia / gist:bbe411623e15fc6aa67d
Last active August 29, 2015 14:08
Compiling Doom Starter Kit (by Blendo, and IDSoftware, of course) issues on 64 bits. http://blendogames.com/news/?p=844
# you can have permission issues when it starts compiling libcurl, just chmod it
# libcurl test fails on a sizeof test
sudo apt-get install libssl-dev:i386
# it doesn't find -lXext and -lXxf86vm
sudo ln -s /usr/lib/i386-linux-gnu/libXxf86vm.so.1 /usr/lib/i386-linux-gnu/libXxf86vm.so
sudo ln -s /usr/lib/i386-linux-gnu/libXext.so.6 /usr/lib/i386-linux-gnu/libXext.so
# then you need doomstarterkit/base in the same folder as doomx86 executable, and
@alesegdia
alesegdia / gist:9fd6cd186744b6cf43c9
Last active August 29, 2015 14:09
Get (lat,lon) from address using Nominatim and OSM in Python.
import urllib2
import json
import sys
def addr_to_url(addr):
return "http://nominatim.openstreetmap.org/?format=json&addressdetails=1&q=" + addr.strip().replace(" ", "+") + "&format=json&limit=1"
def addr_to_geo(addr):
url = addr_to_url(addr)
jsonreq = urllib2.urlopen(url).read()
@alesegdia
alesegdia / .bashrc
Created November 19, 2014 21:32
~/.bashrc stuff
export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h: \[\e[33m\]\w\[\e[0m\]\n\$ '
@alesegdia
alesegdia / gist:6a5c9c0ee921c6086e93
Last active August 29, 2015 14:10
AwesomeWM background cycler.
local lfs = require "lfs"
-- get all images in a path (there should be only images in this path)
wp_files = {}
wp_path = "/EDIT/THIS/PATH/"
for file in lfs.dir(wp_path) do
if file:sub(1,1) ~= '.' then
table.insert(wp_files,file)
end
@alesegdia
alesegdia / .vimrc
Created November 19, 2014 21:41
My little dirty .vimrc
"http://nvie.com/posts/how-i-boosted-my-vim/
" load plugins
call pathogen#infect()
set guifont=Consolas\ 10
set nocp
filetype on
filetype plugin on
@alesegdia
alesegdia / gist:a3a810548ebda5ee372b
Created November 20, 2014 14:49
Using python request with curl.
# python
somevar = request.META.get('HTTP_AUTH', None)
# curl
curl -H 'AUTH:1234' http://127.0.0.1:8000/some/url/