Skip to content

Instantly share code, notes, and snippets.

Avatar

Anthony Rodriguez arodbits

View GitHub Profile
@arodbits
arodbits / s3s-deploy.sh
Created Mar 13, 2018
deploy files into an s3 bucket from the cli
View s3s-deploy.sh
#s3 server deployment
aws s3 cp --acl public-read --content-type=text/html --metadata-directive REPLACE index.html s3://bucketname/index.html
@arodbits
arodbits / copy-current-git-branch.sh
Created Mar 12, 2018
Shell profile alias to copy the current Git branch
View copy-current-git-branch.sh
alias cbranch="git rev-parse --abbrev-ref HEAD | pbcopy"
@arodbits
arodbits / delete-files-only.sh
Created Feb 21, 2018
delete all files in directory except any subdirectory
View delete-files-only.sh
find . -maxdepth 1 -type f -delete
@arodbits
arodbits / force-a-git-pull.sh
Created Nov 1, 2017
force a git pull (git clone)
View force-a-git-pull.sh
git fetch origin master
git reset --hard FETCH_HEAD
View top-bigger-files.sh
du -cks * | sort -rn | head
@arodbits
arodbits / remove-all-docker-containers.sh
Created Oct 29, 2017
Docker: remove all containers
View remove-all-docker-containers.sh
docker rm -f $(docker ps -a -q)
@arodbits
arodbits / regex-from-a-file.sh
Last active Sep 25, 2017
read regex patterns from a file
View regex-from-a-file.sh
while read line; do egrep -r -e "$line" ./extracted --color --only-matching | awk -F':' '{print $1}' >> ./useful_files_list.txt ;done < ./csv-variables-grep.csv
@arodbits
arodbits / move-files-over-ssh.sh
Last active Sep 25, 2017
move files between hosts over ssh using the secure copy command (scp)
View move-files-over-ssh.sh
scp -r /path/to/source hostname:port/path/to/destination
#if using an entity file for ssh
scp -r -i /path/to/key.pem /path/to/source hostname:port/path/to/destination
@arodbits
arodbits / copy-files-from-a-list-of-files.sh
Created Sep 22, 2017
copy files from a list of files
View copy-files-from-a-list-of-files.sh
#!/bin/sh
# list_of_useful_files.txt contains a list of files as follows.
# example1.csv\n
# example2.csv\n
# example3.csv\n
# the scrip reads the list of files and proceeds to copy them into the specified directory.
cat ~/Downloads/IPEDs/list_of_useful_files.txt | awk -F'/' '{print "cp "$0 " ~/Downloads/IPEDs/files_downloaded/"$7"-"$8 }' | sh