Skip to content

Instantly share code, notes, and snippets.

View dotancohen's full-sized avatar

Dotan Cohen dotancohen

View GitHub Profile
@dotancohen
dotancohen / svn-diff-ignore
Last active November 9, 2020 21:38
Show diff for files not in .svnignore file. BE CAREFUL TO SPECIFY FILENAMES WHEN COMMITTING!
#!/bin/bash
# BE CAREFUL TO SPECIFY FILENAMES WHEN COMMITTING!
IGNORE_FILENAME=.svnignore
svn status | awk '{print $2}' | while read FILE ; do
grep -x $FILE $IGNORE_FILENAME > /dev/null
STATUS=$?
if ! $(exit $STATUS) ; then
@dotancohen
dotancohen / db-get-column-names-common
Created February 14, 2022 09:43
Get most common column names from SQL dump file.
grep -P "^\s+\`" foo.sql | \
sed -E 's/\([0-9]*/(/' | \
awk '{print $1 "\t" $2}' | \
sort | \
uniq -c | \
sort -n -r > db-common-column-names
# 300 MiB SQL file: 0.4 seconds