Skip to content

Instantly share code, notes, and snippets.

View LuRsT's full-sized avatar
🎲
I like dice

Gil Gonçalves LuRsT

🎲
I like dice
View GitHub Profile
@LuRsT
LuRsT / headless_slimerjs.sh
Last active August 29, 2015 13:56
How to use slimerjs headless
#!/usr/bin/sh
startx -- `which Xvfb` :1 -screen 0 1024x768x24 2>>/dev/null &
VIRTUAL_X_PID=$!
echo "Virtual X started with PID: $VIRTUAL_X_PID"
DISPLAY=:1 slimerjs script.js
@LuRsT
LuRsT / smartjump_folder.sh
Last active August 29, 2015 14:07
Jump to the first directory with the name you input
cd $(find . -type d | grep "$1$" | head -1)
@LuRsT
LuRsT / smartjump_file.sh
Last active August 29, 2015 14:07
Jump to the first directory where a file with the name you input is
find . -type f | grep "$1$" | head -1 | xargs dirname
@LuRsT
LuRsT / Dockerfile
Created September 19, 2015 10:31
Dockerfile for `hr`
FROM debian
RUN apt-get update && apt-get install -y curl
RUN curl https://raw.githubusercontent.com/LuRsT/hr/master/hr > /bin/hr
RUN chmod +x /bin/hr
@LuRsT
LuRsT / DistractionFreeWriting
Created September 5, 2012 10:01
"Distraction free" vim config for my setup
" Adapted from http://laktek.com/2012/09/05/distraction-free-writing-with-vim/
" to work with my setup, linux + xterm
function! DistractionFreeWriting()
colorscheme iawriter
set background=light
set gfn=Cousine:h14 " font to use
"set lines=40 columns=100 " size of the editable area
"set fuoptions=background:#00f5f6f6 " macvim specific setting for editor's background color·
set guioptions-=r " remove right scrollbar
@LuRsT
LuRsT / static_black.html
Created September 16, 2012 11:40
Generate cool background images ( static black ) like twitter bar
<html>
<head>
<!-- Need pnglib http://www.xarg.org/download/pnglib.js -->
<script src="pnglib.js"></script>
<script>
// Change value of textarea to previous executed code
window.onload = function () {
if ( get_cookie("code") ) {
code.value = get_cookie("code");
}
@LuRsT
LuRsT / README.md
Last active November 21, 2015 13:10
Browser script to view html code from the terminal to the browser

Browser

Inspired and based off of https://gist.github.com/defunkt/318247, since that script didn't work with my environment, I decided to improve on it.

Requirements

You need to have bash installed, but this was also tested in zsh so feel free to change the hashbang, apart from that the only thing you need to do is to set the $BROWSER environment variable.

$ export BROWSER="firefox" # or "chromium-browser" or "chrome" or any browser you want
@LuRsT
LuRsT / gist:5150934
Created March 13, 2013 10:34
Toggle between colorschemes on vim
let g:focuscolour = 0
function! ToggleFocusColor()
if (g:focuscolour)
colorscheme desert
let g:focuscolour = 0
else
colorscheme focus-dark
let g:focuscolour = 1
endif
@LuRsT
LuRsT / rosao.py
Created April 12, 2013 13:34
Script to save .cue and .mp3 files from webpages, receives the url as first argument.
import sys
from bs4 import BeautifulSoup
import requests
import urllib
try:
r = requests.get(sys.argv[1])
if r.status_code != 200:
exit('Page not found')
@LuRsT
LuRsT / btc.py
Last active December 16, 2015 04:58
Getting bitcoin prices info in the command line
import sys
import requests
def main(coin='USD'):
url = 'http://data.mtgox.com/api/2/BTCUSD/money/ticker'
if coin == 'EUR':
url = 'https://data.mtgox.com/api/2/BTCEUR/money/ticker'
r = requests.get(url)