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

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

Keybase proof

I hereby claim:

  • I am lurst on github.
  • I am lurst (https://keybase.io/lurst) on keybase.
  • I have a public key ASDXWVXlJS3AZTrIuy8zkphJ5t7j8pAlYdHS_KGUq_DZOAo

To claim this, I am signing this object:

@LuRsT
LuRsT / loading_bar.py
Created December 13, 2016 11:22
Loading bar in Python 3
import time
for x in range(10):
time.sleep(1)
print("Progress {:2.1%}".format(x / 10), end="\r")
@LuRsT
LuRsT / json_for_humans.py
Created February 27, 2015 12:38
Json for humans
from json import loads as json_decode
from json import dumps as json_encode
@LuRsT
LuRsT / list_comprehensions.py
Last active March 17, 2017 10:52
List Comprehensions in Python
# Why list comprehensions?
fruits = ['orange', 'apple', 'pineapple']
things = ['potato', 'orange', 'car', 'apple']
# This will filter things and will create a new list with only fruits from
# things
new_list_of_things = []
for thing in things:
if thing in fruits:
@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
@LuRsT
LuRsT / news.py
Last active May 6, 2019 19:17
Getting reuter news in a raspberry pi using Pimoroni wHAT
#!/usr/bin/env python
from PIL import Image, ImageFont, ImageDraw
from bs4 import BeautifulSoup
from font_hanken_grotesk import HankenGroteskMedium
from inky import InkyWHAT
import requests
def main():