Skip to content

Instantly share code, notes, and snippets.

View mazulo's full-sized avatar
🐍
Pythoning

Patrick Mazulo mazulo

🐍
Pythoning
View GitHub Profile
@subfuzion
subfuzion / global-gitignore.md
Last active June 11, 2025 02:02
Global gitignore

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file:

  • Create a file called .gitignore in your home directory and add any filepath patterns you want to ignore.
  • Tell git where your global gitignore file is.

Note: The specific name and path you choose aren't important as long as you configure git to find it, as shown below. You could substitute .config/git/ignore for .gitignore in your home directory, if you prefer.

@tamoyal
tamoyal / gist:2ea1fcdf99c819b4e07d
Last active February 13, 2020 11:24
Upgrade Postgres 9.3 to 9.4 on Ubuntu
# Be sure to save your config files. Optional but I do:
sudo cp /etc/postgresql/9.3/main/postgresql.conf ~
sudo cp /etc/postgresql/9.3/main/pg_hba.conf ~
# Package repo (for apt-get)
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
# Also probably optional but I like to update sources and upgrade
sudo apt-get update
@isaquealves
isaquealves / .zshrc-with-rvm
Last active January 26, 2016 15:15
Runs common rvm commands using chpwd_functions from zsh. Add this to the end of .zshrc file. Runs on 'cd <directory>'
source ~/.zshrc
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
ORIGINAL_PATH=$PATH
function dev_env_setup() {
# see http://zsh.sourceforge.net/Doc/Release/Shell-Builtin-Commands.html
emulate -L zsh
@Fawers
Fawers / app_extras.py
Last active August 29, 2015 14:24
Python (Django) snippet to update querystrings
# Python (Django) snippet to update querystrings. Can be used to:
# · Replace a value from a querystring key
# · Append a value to a querystring key
# · Remove a value from a querystring key
# · Remove all values from a querystring key
#
# Assuming:
# Python version: 3.x (tested on 3.4)
# Django version: 1.8
# App name: app
####### License: MIT
"""MIT License
Copyright (c) 2015 Aaron Hall
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
{-# LANGUAGE UnicodeSyntax #-}
module Proof where
import System.Console.ANSI
import Prelude.Unicode
import Control.Monad.Unicode
{-
Calculations and mathematical proofs of circular computations.
@author Marcelo Camargo
-}
@pavelpatrin
pavelpatrin / line_profiler_decorator.py
Last active September 6, 2023 14:49
Python line profiler decorator
def profile(func):
from functools import wraps
@wraps(func)
def wrapper(*args, **kwargs):
from line_profiler import LineProfiler
prof = LineProfiler()
try:
return prof(func)(*args, **kwargs)
finally:

Github Two-Factor Authentication (2FA) for Brazil via SMS

The Github doesn't provide country code for Brazil (+55). To add this option, just run the code below in your console. The option Brazil +55 will be the first on the list, already selected:


🇧🇷 [pt-BR]

Autenticação em dois fatores (2FA) do GitHub para o Brasil via SMS

@pgjones
pgjones / json_test_client.py
Last active July 15, 2022 14:56
A replacement flask test client that allows easy JSON API testing
import json
from flask.testing import FlaskClient
from flask.wrappers import Response
class JSONResponseWrapper(Response):
"""Extends the BaseResponse to add a get_json method.
This should be used as the response wrapper in the TestClient.
from concurrent.futures import as_completed, ThreadPoolExecutor
from urllib.request import urlopen
import re
import sys
DEFAULT_REGEX = r'<input type="text" id="nacional" value="([^"]+)"/>'
CURRENCY = {
'dolar': 'http://dolarhoje.com/',
'euro': 'http://eurohoje.com/',