Skip to content

Instantly share code, notes, and snippets.

View Fedalto's full-sized avatar

Leonardo Fedalto Fedalto

View GitHub Profile
@Fedalto
Fedalto / upgrade-requirements.sh
Created December 28, 2017 20:52
Modify the requirements.txt file and upgrade all Python libraries to the latest version.
#!/bin/bash
pip list --format=columns --outdated | \
sed -n '3,$p' | \
while IFS=" " read -r package old_version new_version extra
do
for requirements_file in "$@"
do
if grep -q ${package} ${requirements_file}; then
echo "${package}: ${old_version} -> ${new_version}"
@Fedalto
Fedalto / py-moneyed.ipynb
Created August 3, 2017 21:35
Handling money with Python and py-moneyed
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am fedalto on github.
  • I am fedalto (https://keybase.io/fedalto) on keybase.
  • I have a public key whose fingerprint is 1FEA 06FD 6BD6 82F7 DF0B 9B9C 3304 635B 9A93 DCA8

To claim this, I am signing this object:

@Fedalto
Fedalto / pre-commit
Created December 12, 2013 18:06
Pre commit git hook. It checks and fails if finds a forbidden pattern like "pdb.set_trace". Will also fail if there's trailing spaces.
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@Fedalto
Fedalto / README.md
Last active December 27, 2015 05:09
Install python virtualenv, creates a virtualenv and install requirements passed as arguments.

I work with differents python projects and I usually create a vagrant VM to work on them.

This script is an attempt to easy the process of starting a new environment.

On Vagrantfile, put this section:

  config.vm.provision "shell" do |sh|
    sh.path = "https://gist.github.com/Fedalto/7271762/raw/setup_virtualenv.sh"
 end
@Fedalto
Fedalto / pre-commit
Created September 10, 2013 19:16
Pre-commit git hook
#!/bin/sh
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
for FILE in `git diff-index --check --name-status $against -- | cut -c3-` ; do
# Check if the file contains 'debugger'
@Fedalto
Fedalto / LICENSE
Last active January 16, 2019 07:23
The script monitor the Solr health. https://github.com/Fedalto/solr-monitor
The MIT License (MIT)
Copyright (c) 2015 Leonardo Fedalto
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
furnished to do so, subject to the following conditions:
@Fedalto
Fedalto / pre-receive
Created March 27, 2013 20:25
Git hook to make a git repository master branch read only. This should go in .git/hooks/
#!/usr/bin/env ruby
old_sha1, new_sha1, ref = gets.split
if ref == "refs/heads/master":
puts "Pushing to origin/master is not permitted."
puts "This is a read-only branch."
puts ""
puts "Create a new branch instead, or commit to SVN."
@Fedalto
Fedalto / gist:5017878
Created February 23, 2013 01:31 — forked from skhaz/gist:5017547
"""
Papo de maluco, por elcio
http://elcio.com.br/papo-de-maluco/
"""
import requests
import re
def Ed(text):
params=dict(server='0.0.0.0:8085',charset_post='utf-8',