This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# replace the id_rsa.pub with your key file and enter the correct HOSTNAMEANDCONFIG information | |
cat ~/.ssh/id_rsa.pub | ssh HOSTNAMEANDCONFIG "mkdir .ssh 2>/dev/null; cat >> ~/.ssh/authorized_keys" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# redirect input in gawk and count unique lines | |
SOMETHING > gawk '{print $1}' | sort | uniq -c | sort -bgr > counted_lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name localhost domain.io *.domain.io; | |
location / { | |
proxy_pass http://localhost:3001; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'upgrade'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#notes how to run apps docker | |
#dockerize a single node app without dockerfile | |
docker run -p 7777:2368 --rm --name ghostdemo -v "$PWD":/usr/src/app -w /usr/src/app node:0.10 node index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# play around with fg and bg command the & char | |
# watch out for any respondes of the script. All respones will be saved in the nohup.log file | |
nohup rsync --partial --progress --rsh=ssh [email protected]:~/fileonhost.tar . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@see http://stackoverflow.com/a/8248281 | |
SET FOREIGN_KEY_CHECKS = 0 | |
SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') FROM information_schema.tables WHERE table_schema = 'MyDatabaseName'; | |
SET FOREIGN_KEY_CHECKS = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# linux | |
find -name "* *" -type f | rename 's/ /_/g' | |
# mac with zsh | |
#In zsh, this is easily done with the zmv function. Put autoload -U zmv in your ~/.zshrc, or run this once in your shell, then: | |
# @see http://unix.stackexchange.com/questions/71690/delete-whitespace-in-filenames-in-directory | |
zmv '* .pdf' '${f// /}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @see https://josephscott.org/archives/2011/10/timing-details-with-curl/ | |
# do a request curl -w "@timeMeassure.txt" -o /dev/null -s "http://wordpress.com/" | |
\n | |
time_namelookup: %{time_namelookup}\n | |
time_connect: %{time_connect}\n | |
time_appconnect: %{time_appconnect}\n | |
time_pretransfer: %{time_pretransfer}\n | |
time_redirect: %{time_redirect}\n | |
time_starttransfer: %{time_starttransfer}\n | |
----------\n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
# Author: David Underhill | |
# @see http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/ | |
# Script to permanently delete files/folders from your git repository. To use | |
# it, cd to your repository's root and then run the script with a list of paths | |
# you want to delete, e.g., git-delete-history path1 path2 | |
if [ $# -eq 0 ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -name *.json* | while IFS= read -r f ; do rm $f; done |
NewerOlder