Skip to content

Instantly share code, notes, and snippets.

View voyeg3r's full-sized avatar

Sérgio Luiz Araújo Silva voyeg3r

View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
# Author: Sergio Araujo
# Last Change: sáb 04 mar 2017 10:31:32 BRT
# Created: sáb 04 mar 2017 10:31:32 BRT
# File: basico_decorator.py
# email: <voyeg3r ✉ gmail.com>
# Github: https://github.com/voyeg3r
# twitter: @voyeg3r
#!/usr/bin/env python
# source: https://www.youtube.com/watch?v=avthXghx0a0
students = [
{'name':'Paul Allen', 'class':'Science','grade':'A'},
{'name':'Paul Allen', 'class':'Math','grade':'C'},
{'name':'Bob Lewis', 'class':'Science','grade':'D'},
{'name':'Bob Lewis', 'class':'Math','grade':'b'},
{'name':'Bob Lewis', 'class':'History','grade':'f'},
]
arq = open('alice.txt')
texto = arq.read()
texto = texto.lower()
import string
for c in string.punctuation:
texto = texto.replace(c, ' ')
texto = texto.split()
dic = {}
for p in texto:
"" autocomands for python
augroup python
au FileType python set keywordprg=pydoc
au! BufRead *.py setlocal smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
au! BufRead,Bufnewfile *.py im :<CR> :<CR><TAB>
au! BufNewFile *.py 0r ~/.vim/skel/template.py
au BufNewFile *.py exe "1," . 10 . "s/Creation Date:.*/Creation Date: " .strftime("%d-%m-%Y")
au! BufWritePost *.py :silent !chmod a+x <afile>
autocmd FileType python set textwidth=79
autocmd FileType python filetype indent on
@voyeg3r
voyeg3r / pydelicious.py
Created January 19, 2017 18:21 — forked from takashi/pydelicious.py
pydelicious for python3
"""Library to access del.icio.us data via Python.
:examples:
Using the API class directly:
>>> a = pydelicious.apiNew('user', 'passwd')
>>> # or:
>>> a = DeliciousAPI('user', 'passwd')
>>> a.tags_get() # Same as:
snippet date "use tab to insert date" w
`date +%Y-%m-%d\ %H:%M` ${0]
endsnippet
" copy these lines to your ~/.vimrc
" Scientifc Calculator using python3 --> :Calc sin(30)
" :Calc sum([x^2 for x in range(100)])
command! -nargs=+ Calc :py print(<args>)
py from math import *
" you can also create a bash or zsh alias like:
" alias calc='python3 -ic "from math import *; import cmath"'
" the alias tip came from:
" this code implements seven new text objects on vim: ":",".","|" . . .
" source: https://www.youtube.com/watch?v=0F4FgiVWvB8
let pairs = { ":" : ":",
\ "." : ".",
\ "/" : "/",
\ '\|' : '\|',
\ "*" : "*",
\ "-" : "-",
\ "_" : "_" }
@voyeg3r
voyeg3r / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#!/bin/bash
# Arquivo: installaptfast.sh
# Criado: Qui 12/Jun/2014 hs 10:23
# Last Change: Qui 12/Jun/2014 hs 10:23
# autor: Sérgio Luiz Araújo Silva
# site: http://vivaotux.blogspot.com
# twitter: http://www.twitter.com/voyeg3r
# email: voyeg3r  gmail.com
# references: https://github.com/ilikenwf/apt-fast