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 / 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 / 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)

Python Number Conversion Chart

From To Expression
@LuRsT
LuRsT / size.py
Created May 3, 2013 14:26
Get files if their size is bellow 1K
import os
for dirpath, dirnames, filenames in os.walk('.'):
for f in filenames:
fp = os.path.join(dirpath, f)
size = os.path.getsize(fp)
if size < 1024:
print f
# coding=UTF-8
from __future__ import division
import re
# This is a naive text summarization algorithm
# Created by Shlomi Babluki
# April, 2013
class SummaryTool(object):
@LuRsT
LuRsT / git.pl
Last active December 20, 2015 07:49
Add the alias fffuuuuuuuuu to git
#!/usr/bin/perl
use strict;
use warnings;
if ($ARGV[0] =~ /^f+uu+$/) {
print qx{git reset --hard HEAD^};
}
else {
my $args = join(' ', @ARGV);
@LuRsT
LuRsT / .vimrc
Created August 21, 2013 13:43
Basic vim config file
syntax on
colorscheme desert
filetype plugin indent on
" 256 colors
set t_Co=256
set backspace=indent,eol,start
set cmdheight=2
set fileencodings=ucs-bom,utf-8,default,latin1