Skip to content

Instantly share code, notes, and snippets.

View cssence's full-sized avatar

Matthias Zöchling cssence

View GitHub Profile
#!/bin/bash
read -p "Ensure param #1 (\"$1\") format is \"YYYY-MM-DDThh:mm:ss\", then press [ENTER] to commit..."
GIT_AUTHOR_DATE="$1" GIT_COMMITTER_DATE="$1" git commit $2
@cssence
cssence / .bash_profile snippet ~ .sh
Created June 3, 2016 06:29
Avoid history duplicates
export HISTCONTROL=ignoredups:erasedups
shopt -s histappend
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
@cssence
cssence / rrm-macdroppings.sh
Last active January 20, 2018 16:14
Recursively Remove .DS_Store
find . -name '.DS_Store' -type f -delete
#!/usr/bin/env bash
git filter-branch --env-filter '
CORRECT_NAME="$1"
OLD_EMAIL="$2"
CORRECT_EMAIL="$3"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
#export CLICOLOR=1
#export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
export PS1="\u@\H:\w \$ "
export TIME_STYLE=long-iso
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
@cssence
cssence / filesToLowerCase.sh
Last active March 9, 2016 11:21
batch rename files toLowerCase
#!/usr/bin/env bash
for a_file in *;do mv -v $a_file `echo $a_file | tr [:upper:] [:lower:]` ;done;
@cssence
cssence / 8080.sh
Created July 14, 2015 14:38
Web server
while true ; do echo ahoi | nc -l -p 8080 ; done
@cssence
cssence / listAllUsedClassNames.js
Created July 14, 2015 14:37
List all used CSS classes
(function listAllUsedClassNames () {
var classNames = {};
Array.prototype.forEach.call(document.querySelectorAll("*"), function (element) {
if (typeof element.className === "string") {
element.className.split(" ").forEach(function (className) {
if (className) {
classNames[className] = true;
}
});
};
@cssence
cssence / genisoimage.sh
Last active March 9, 2016 11:22
Favorite default parameters for genisoimage
#!/usr/bin/env bash
genisoimage -v -r -iso-level 4 $@
@cssence
cssence / utf8.sh
Last active March 9, 2016 11:22
Convert text files to UTF-8
#!/usr/bin/env bash
if [[ $1 == -f ]]; then
format="$2"
shift 2
fi
for file in $@; do
iconv -f ${format-"windows-1252"} -t "UTF-8" "$file" > "${file%.*}.utf8.$(echo $file |awk -F . '{if (NF>1) {print $NF}}')"
done