Skip to content

Instantly share code, notes, and snippets.

View hatzopoulos's full-sized avatar

Anthony Hatzopoulos hatzopoulos

View GitHub Profile
@hatzopoulos
hatzopoulos / talks.md
Last active August 29, 2015 14:17
Talks by Anthony Hatzopoulos #wpo
# Safer pushes. Other values: nothing, matching, upstream, simple
git config --local push.default current
# colorize output (Git 1.5.5 or later)
git config --local color.ui auto
# and from 1.5.4 onwards, this will works:
git config --local color.interactive auto
# better colors for spotting whitespace
@hatzopoulos
hatzopoulos / linux-bash-and-git-tricks.md
Last active August 29, 2015 14:24
linux bash and git tricks
# find and group by extension
# http://serverfault.com/a/183432/128858
find ./ -type f -not -path "./.git/*" | grep -E ".*\.[a-zA-Z0-9]*$" | sed -e 's/.*\(\.[a-zA-Z0-9]*\)$/\1/' | sort | uniq -c | sort -n
      1 .GIF
      1 .JPG
 1 .bash
@hatzopoulos
hatzopoulos / image-optimization-tools.md
Last active April 23, 2023 03:47
WPO : Image Performance Optimization
#!/bin/bash
set -e
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
@hatzopoulos
hatzopoulos / rewrite-history.bash
Last active August 29, 2015 14:27
rewrite-history.bash
#!/bin/bash
# usage:
# cd ~/your-repo
# git filter-branch --prune-empty --tree-filter ~/rewrite-history.bash
if [[ ! -e httpdocs ]]; then
mkdir -p httpdocs
git ls-tree --name-only $GIT_COMMIT | grep -v ^'.gitignore\|.gitattributes'$ | xargs -I files mv files httpdocs
fi
@hatzopoulos
hatzopoulos / web-dev-kits.md
Last active September 5, 2015 14:30
web development kits