Skip to content

Instantly share code, notes, and snippets.

@luizirber
luizirber / aperture.py
Last active December 16, 2015 13:18 — forked from ivanov/aperture.py
I liked the idea, so I used img2xterm to create a version using ANSI escape codes. Let's see if pasting it here works... (Now in blue)
# -*- coding: utf-8 -*-
''' 
 ▄ ▄▄▄▄
▄▄ ▄▄ ▀▀  ▄▄
▄▄ ▄▄ ▀▄ ▄ ▄ ▄▄
▄▄ ▄▄ ▀▄     ▄▄
▄ ▄▄▄▄ ▀▄ ▄ ▀ ▄
▀▀▀▀▀▀▀▀▀▀ ▀▄  [
@luizirber
luizirber / input
Last active December 20, 2015 03:49
Quick and dirty parser
chr10_0 CTCTGCCCTGGGGTTTGAGATCCGCGGGTGCTTACTGACCCTTTTGGGTTGGAGTTAGCTCAAGCGGTTACCTCCTCAGGCTGGACTTTCTATCTGTCCAAAGCCAACtg
---------------------CCGCGGGTGCTTACTGACCCTTTT----------------------------------------------------------------- 1 teste
chr10_0 CTCTGCCCTGGGGTTTGAGATCCGCGGGTGCTTACTGACCCTTTTGGGTTGGAGTTAGCTCAAGCGGTTACCTCCTCAGGCTGGACTTTCTATCTGTCCAAAGCCAACtg
----------------------CGCGGGTGCTTACTGACC---------------------------------------------------------------------- 129 teste
chr10_0 CTCTGCCCTGGGGTTTGAGATCCGCGGGTGCTTACTGACCCTTTTGGGTTGGAGTTAGCTCAAGCGGTTACCTCCTCAGGCTGGACTTTCTATCTGTCCAAAGCCAACtg
----------------------CGCGGGTGCTTACTGACCC--------------------------------------------------------------------- 56 teste
chr10_10 CCTTGCCCGTCACGCAATGGAAGTTCGTGGGGAACCTGGCGCTAAACCATTCGTAGACTATCTGCTTCTGGGTCGGGGTT
@luizirber
luizirber / ccat
Created November 14, 2013 14:46
Colorized cat! Uses pygmentize to output colorized output
#!/bin/bash
if [ ! -t 0 ];then
file=/dev/stdin
elif [ -f $1 ];then
file=$1
else
echo "Usage: $0 code.c"
echo "or e.g. head code.c|$0"
exit 1
fi
@luizirber
luizirber / alg3.py
Created March 25, 2014 19:14
Fluctuating environment
import random
RESOURCES = [0, 1]
GENE_MUTATION_RATE = .05
POPULATION_SIZE = 20
NUMBER_OF_GENERATIONS = 100
class Org(object):
def __init__(self, genes):
@luizirber
luizirber / brace_expand.py
Created August 7, 2014 04:42
Basic bash brace expansion exercise
def brace_expand(expr):
expansions = []
for block in expr.split('{'):
if '}' in block:
expansion, remainder = block.split('}')
expanded = []
for piece in expansions:
for component in expansion.split(','):
expanded.append("".join((piece, component, remainder)))
expansions = expanded
@luizirber
luizirber / timings.ipynb
Created September 30, 2014 23:24
Empty list and appending, or list(convert_str)?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luizirber
luizirber / gist:3f7f09e5144f3506207152fae6d4b06f
Created May 5, 2016 16:45
A canção do programador (Lightning talk na Python Brasil 2013 -> https://youtu.be/_-AHNX-TYks )
Eu nunca quis ser um barbeiro… Eu sempre quis ser… Um programador!
Seja sozinho ou pareado, eu iria programar, programar, programar!
Eu sou programador, que maravilha!
Programo de noite, café de dia!
(ele é programador, que maravilha!
Programa de noite, café de dia!)
Programo pra web, pra desktop, programo para celular
hospedo tudo na nuvem, pra disponibilizar

Keybase proof

I hereby claim:

  • I am luizirber on github.
  • I am luizirber (https://keybase.io/luizirber) on keybase.
  • I have a public key ASDsj5v-XomuzwQ-xjEdfyM0dVXLdrX8SHWo_5nseZ55Rgo

To claim this, I am signing this object:

@luizirber
luizirber / README.md
Last active November 13, 2016 01:56 — forked from ctb/README.md
Cython maps

Here, the .get function on maps is about 1m times slower than the .getitem function. Why?

To run (requires Python 3, Cython, and a C/C++ build environment):

python setup.py build_ext -i
python test.py
@luizirber
luizirber / convert.py
Created November 29, 2017 00:21
A small Python script to convert lastpass CSV files to a format that Password Gorilla can import
#!/usr/bin/env python
"""
A small Python script to convert lastpass CSV files to a format that Password Gorilla can import.
Usage:
python convert.py lastpass.csv output.csv
output.csv can now be imported into Password Gorilla
"""