This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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'}, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"" 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet date "use tab to insert date" w | |
`date +%Y-%m-%d\ %H:%M` ${0] | |
endsnippet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" this code implements seven new text objects on vim: ":",".","|" . . . | |
" source: https://www.youtube.com/watch?v=0F4FgiVWvB8 | |
let pairs = { ":" : ":", | |
\ "." : ".", | |
\ "/" : "/", | |
\ '\|' : '\|', | |
\ "*" : "*", | |
\ "-" : "-", | |
\ "_" : "_" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |