Skip to content

Instantly share code, notes, and snippets.

View javiromero's full-sized avatar
💭
I may be slow to respond.

Javier Romero javiromero

💭
I may be slow to respond.
View GitHub Profile
@miohtama
miohtama / install-postgresql-client-9.5-on-ubuntu-14.04.bash
Created January 25, 2017 08:10
Upgrade PostgreSQL client to 9.5 on Ubuntu 14.04
# Ubuntu 14.04 repo
# For more repos see https://www.ubuntuupdates.org/ppa/postgresql?dist=trusty-pgdg
# Install key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# 14.04 repo
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
apt update
@hynekcer
hynekcer / post-checkout.py
Last active November 27, 2019 20:14
Git post-checkout hook for Python to remove orphan *.pyc files and empty dir
#!/bin/env python
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
A hook to git that removes orphan files "*.pyc" and "*.pyo" for "*.py"
beeing deleted or renamed by git checkout. It also removes their empty parent
directories.
Place it to "my_local_repository/.git/hooks/post-checkout" and make it executable.
Nothing is cleaned for .py files deleted manually or by "git rm" etc.
Related to http://stackoverflow.com/q/1504724/448474
@linssen
linssen / post-checkout
Last active July 22, 2018 22:37
A post checkout hook to automatically remove *.pyc files.
#! /bin/sh
green='\033[0;32m'
nc='\033[0m'
# Start from the repository root.
cd ./$(git rev-parse --show-cdup)
# Delete .pyc files and empty directories.
echo "${green}Deleting PYC files...${nc}"
find . -name "*.pyc" -delete
@joelverhagen
joelverhagen / clean_py.sh
Created October 8, 2012 16:48
Recursively removes all .pyc files and __pycache__ directories in the current directory
#!/bin/sh
# recursively removes all .pyc files and __pycache__ directories in the current
# directory
find . | \
grep -E "(__pycache__|\.pyc$)" | \
xargs rm -rf
# or, for copy-pasting:
@gurglet
gurglet / git-post-checkout.sh
Created February 9, 2012 13:55
Git post checkout hook that reminds you of South migration changes when changing branches. Can be useful when you are when you are testing out a branch from someone else that requires migrations. Put the file in .git/hooks/post-checkout
#!/bin/bash
# Git post checkout hook.
# Reminds you of South migration changes when switching branches.
# Can be useful when you are when you are testing out a branch from
# someone else that requires migrations.
# Put the file in .git/hooks/post-checkout
PREVIOUS_HEAD=$1
NEW_HEAD=$2