Skip to content

Instantly share code, notes, and snippets.

@fcrespo82
fcrespo82 / progressbar.py
Last active January 3, 2016 08:49
Progress bar module for python. Super simple to use.Any questions find me @fcrespo82 on twitter and app.net
#!/usr/bin/env python
def progressbar(total, value, size=70, fill_char="#", empty_char="-"):
if value > total:
raise Exception("'value' must be <= 'total'")
multiplier = (size*1.0)/total
fill=int(round(value*multiplier))
empty=int(round((total-value)*multiplier))
print("[{}{}]".format(fill_char*fill, empty_char*empty))
import contacts
import webbrowser, urllib
from seamless_dropbox import open
import console
DRAFTS_ACTION = "Backup Contacts"
VCARD = ""
people = contacts.get_all_people()
i = 0
@fcrespo82
fcrespo82 / .bash_completion
Last active August 29, 2015 13:57
A shell completion for Brett Terpstra's doing command line utility http://brettterpstra.com/projects/doing/
_doing()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(doing help -c)" -- $cur) )
}
complete -F _doing doing
@fcrespo82
fcrespo82 / new_gist_file.py
Created March 22, 2014 01:09
Pure anonymous lambda recursive function in python
import urllib
a=['<','<','<','<']
[ (lambda a:lambda t,v:a(t,a,v))(lambda t,s,x:t if x==0 else s(urllib.quote(t),s,x-1))(x,idx+1) for idx,x in enumerate(a) ]
#!/usr/bin/env python
# wol.py
import socket
import struct
def wake_on_lan(macaddress):
""" Switches on remote computers using WOL. """
# Check macaddress format and try to compensate.
@fcrespo82
fcrespo82 / clockface
Last active August 29, 2015 14:04 — forked from drdrang/clockface
I don't know why I did it, but this version shows the minutes past the represented in the emoji
#!/usr/bin/python
# -*- coding: utf-8 -*-
from sys import argv
from time import strftime
from math import floor
clocks = {'12:00': 'πŸ•›', '12:30': 'πŸ•§', '1:00': 'πŸ•', '1:30': 'πŸ•œ',
'2:00': 'πŸ•‘', '2:30': 'πŸ•', '3:00': 'πŸ•’', '3:30': 'πŸ•ž',
'4:00': 'πŸ•“', '4:30': 'πŸ•Ÿ', '5:00': 'πŸ•”', '5:30': 'πŸ• ',
@fcrespo82
fcrespo82 / count_quotation_mark.py
Created February 9, 2015 20:14
Script to count quotation marks in jsp
import os
import re
with open("/home/fxcrespo/workspaces/workspace_siga/count.log", "w") as thelog:
for path, dirs, files in os.walk("/home/fxcrespo/workspaces/workspace_siga"):
for thefile in files:
thepath = os.path.join(path, thefile)
if thepath.endswith("jsp"):
thecount = len(re.findall("\"", "".join(open(thepath).readlines())))
if thecount > 0 and (thecount % 2 != 0):
@fcrespo82
fcrespo82 / remove.md
Last active May 20, 2016 21:44
Remove all files from a make install that do not provide a make uninstall

You can use make install and DESTDIR to get a clean tree of the files in the kit. The following (untested script) should delete all the files of the SVN source kit.

BE CAREFUL WITH THIS COMMAND SINCE IT USES sudo rm AND COULD DAMAGE YOUR SYSTEM.

YOU HAVE BEEN WARNED!

make install DESTDIR=/tmp/qqq
cd /tmp/qqq
@fcrespo82
fcrespo82 / safesign.md
Created August 19, 2016 21:18 — forked from jonasmalacofilho/safesign.md
Instalando o SafeSign Crypto USB Token no Firefox/Linux

Instalando o SafeSign Crypto USB Token no Firefox/Linux

Hardware: Giesecke & Devrient SafeSign Crypto USB Token

Sistema operacional: Ubuntu 14.04 LTS AMD 64

  1. DependΓͺncias: libccid, pcscd e libpcsclite1. Adicionalmente, Γ© interessante instalar o pacote pcsc-tools e executar pcsc_scan para verificar a visibilidade do token.
@fcrespo82
fcrespo82 / Rules.md
Created November 14, 2017 02:39
Wall Monster (game instructions)

At least 5 people:

  • Narrator
  • Normal person (crew)
  • 2 lovers (crew) (optional?)
  • Security camera (crew)
  • Baby wall monster (optional?)
  • Bodyguard (crew)
  • Wall monster

Bodyguard can choose 1 person to defend per night. If chooses a wall monster he is dragged out of the space station.