Skip to content

Instantly share code, notes, and snippets.

@igorepst
Last active May 17, 2018 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igorepst/78ad49271112950ebf6db3e10255a2f1 to your computer and use it in GitHub Desktop.
Save igorepst/78ad49271112950ebf6db3e10255a2f1 to your computer and use it in GitHub Desktop.
various
SVN ignore:
svn propedit svn:ignore .
PostgreSQL:
Copy data from your CSV file to the table
COPY zip_codes FROM '/path/to/csv/ZIP_CODES.txt' WITH (FORMAT csv);
Save select to CSV
Copy (Select * From foo) To '/tmp/test.csv' With CSV DELIMITER ',';
Recursive find/replace of text:
grep -rl oldtext . --exclude-dir=.svn | xargs sed -i 's/oldtext/newtext/g'
Find PID of process bound on port X:
fuser X/tcp
Check in script whether connected output is terminal (or pipe/redirection, etc.)
if [ -t 1 ]; then
# Output is tty
...
fi
Strip colors from output:
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"
yum: download all dependencies:
yum install --downloadonly --installroot=/var/tmp/httpd-installroot --releasever=7 --downloaddir=/var/tmp/httpd httpd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment