Skip to content

Instantly share code, notes, and snippets.

View beatorizu's full-sized avatar
🤓
Focusing

beatorizu

🤓
Focusing
  • São José dos Campos, SP Brazil
  • 19:42 (UTC -03:00)
View GitHub Profile
@omariosouto
omariosouto / ButtonLink.js
Last active April 9, 2024 17:17
Aula 01 - Códigos Extras
const matrizInimigoGrande = [
[0,0],
[400,0],
[800,0],
[1200,0],
[1600,0],
[0,400],
[400,400],
[800,400],
[1200, 400],
ogr2ogr -s_srs EPSG:4326 -t_srs "+proj=latlong +pm=0" paises_0.shp paises.shp
ogr2ogr -s_srs EPSG:4326 -t_srs "+proj=latlong +pm=-360" paises_360.shp paises.shp
ogr2ogr -update -append paises_360.shp paises_0.shp
@lisawolderiksen
lisawolderiksen / git-commit-template.md
Last active April 22, 2024 13:01
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@beatorizu
beatorizu / init.vim
Last active September 23, 2020 22:02
neovim config file
" Specify a directory for plugins
call plug#begin('~/.local/share/nvim/plugged')
" Colorizer A plugin to color colornames and codes
Plug 'chrisbra/Colorizer'
" vim-markdown-composer An asynchronous markdown preview plugin for Vim and Neovim
function! BuildComposer(info)
if a:info.status != 'unchanged' || a:info.force
if has('nvim')
@amelieykw
amelieykw / How to decrypt hash stored by bcrypt?.md
Created July 27, 2018 14:38
[Python - decrypt hash stored by bcrypt] #Python #Bcrypt #decrypt

You're HASHING, not ENCRYPTING!

What's the difference?

The difference is that hashing is a one way function, where encryption is a two-way function.

So, how do you ascertain that the password is right?

Therefore, when a user submits a password, you don't decrypt your stored hash, instead you perform the same bcrypt operation on the user input and compare the hashes. If they're identical, you accept the authentication.

Should you hash or encrypt passwords?

@jonathan-kosgei
jonathan-kosgei / timer.py
Last active June 14, 2021 05:01
Python Decorator to Time a Function
""" A simple decorator that times the duration of a function's execution. More info on Decorators at https://pythonconquerstheuniverse.wordpress.com/2009/08/06/introduction-to-python-decorators-part-1/"""
import timeit
def timer(function):
def new_function():
start_time = timeit.default_timer()
function()
elapsed = timeit.default_timer() - start_time
print('Function "{name}" took {time} seconds to complete.'.format(name=function.__name__, time=elapsed))
return new_function()
@beatorizu
beatorizu / find_git.py
Last active June 2, 2019 16:39
Python scripts with regex powers to find files XD
#!/opt/anaconda2/envs/py360/bin/python
from datetime import datetime
from json import dump
from os import walk
from os.path import join
import logging
import re
def search_dir(root, target='.git', pattern=re.compile(r'^\.git|[\w\d\s!@#$%^&*()_+\-=\[\]{};\':"\\|,<>\/?]+$'),
@jakebrinkmann
jakebrinkmann / connect_psycopg2_to_pandas.py
Created July 3, 2017 14:19
Read SQL query from psycopg2 into pandas dataframe
import pandas as pd
import pandas.io.sql as sqlio
import psycopg2
conn = psycopg2.connect("host='{}' port={} dbname='{}' user={} password={}".format(host, port, dbname, username, pwd))
sql = "select count(*) from table;"
dat = sqlio.read_sql_query(sql, conn)
conn = None
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 4, 2024 17:49
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example