Skip to content

Instantly share code, notes, and snippets.

@arthuralvim
arthuralvim / Bibtex.sublime-build
Created Jun 1, 2012
Sublime Text 2 - build commands for bibtex and clean auxiliary files
View Bibtex.sublime-build
// It's saved under path_to_Packages/User/
{
"cmd": ["bibtex", "$file_base_name"],
"path": "$PATH:/usr/texbin:/usr/local/bin",
"file_regex": "^(...*?):([0-9]+): ([0-9]*)([^\\.]+)",
"selector": "text.tex.latex"
}
@arthuralvim
arthuralvim / monthyearfield.py
Last active Dec 16, 2015 — forked from yashh/monthyearfield.py
A MonthYearWidget forked from yashh/monthyearfield.py .
View monthyearfield.py
from django import forms
import datetime
class MonthYearWidget(forms.MultiWidget):
"""
A widget that splits a date into Month/Year with selects.
"""
@arthuralvim
arthuralvim / setas.css
Created Nov 2, 2013
Arrows without images, only CSS. (Cross Browser) Setas sem usar imagem via CSS. (pt-br)
View setas.css
.seta{
width: 0;
height: 0;
}
.seta.cima {
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #aaa;
}
@arthuralvim
arthuralvim / bootstrap.py
Created Dec 21, 2013
A virtualenv bootstrap script for a generic project in python.
View bootstrap.py
# -*- coding: utf-8 -*-
import virtualenv, textwrap
output = virtualenv.create_bootstrap_script(textwrap.dedent("""
import os, subprocess
import urllib2
# YOUR REPO URL ex:
REPO = 'https://github.com/arthuralvim/dj-kickstart.git'
@arthuralvim
arthuralvim / megasena.py
Created Dec 31, 2013
Megasena Pythônica.
View megasena.py
import random; random.sample(range(1,61),6)
@arthuralvim
arthuralvim / gen.py
Created Jan 3, 2014
Simple script to generate passwords.
View gen.py
import random
import string
def gen_pass(size=6, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
@arthuralvim
arthuralvim / saving_my_neck.ssh
Created Jan 12, 2014
I have accidentally deleted some .py untracked files. For my luck I found this project (https://github.com/wibiti/uncompyle2).
View saving_my_neck.ssh
git clone git@github.com:wibiti/uncompyle2.git
cd uncompyle2/
python setup.py install
uncompyler2 thank_goodness_this_still_exists.pyc > recovered_file.py
@arthuralvim
arthuralvim / Vagrantfile
Last active Aug 29, 2015
Playing with Docker.
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
$script = <<-SCRIPT
apt-get update
locale-gen en_US en_US.UTF-8 pt_BR pt_BR.utf8 pt_PT.utf8
dpkg-reconfigure locales
apt-get install -y --force-yes curl git
@arthuralvim
arthuralvim / provyfile-2.py
Last active Aug 29, 2015
Examples of Provyfile.
View provyfile-2.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
from provy.core import Role
from provy.more.debian import AptitudeRole
from provy.more.debian import NginxRole
from provy.more.debian import SupervisorRole
from provy.more.debian import TornadoRole
from provy.more.debian import UserRole
@arthuralvim
arthuralvim / breakpoint.less
Last active Aug 29, 2015
Bootstrap 3 Media Queries for Breakpoints.
View breakpoint.less
// Custom Iphone screen (MIN)
@screen-iphone-min: 320px !default;
// Extra small screen / phone (MIN)
@screen-xs-min: 480px !default;
// Small screen / tablet (MIN)
@screen-sm-min: 768px !default;
// Medium screen / desktop (MIN)
@screen-md-min: 992px !default;
// Large screen / wide desktop (MIN)
@screen-lg-min: 1200px !default;