This file contains hidden or 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
#!/usr/bin/env bash | |
# Usage: ./md5sum.sh file1 file2 | |
if [ "$#" -ne 2 ]; then | |
echo -e "Too many arguments,\n\nUsage:\n$ ./check.sh file1 file2" | |
fi | |
validate_files() { | |
status=0 |
This file contains hidden or 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
git prune -n | |
# Returns a list of hashes | |
git cat-file -p HASH1 > recovered_file1.txt | |
git cat-file -p HASH2 > recovered_file2.txt | |
git cat-file -p HASH3 > recovered_file3.txt |
This file contains hidden or 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
# For this example, assume REPO_A has one file that you want to move into REPO_B along with it's commit history | |
# Clone REPO_A | |
git clone REPO_A | |
# Extract only the commit hashes for your target file and place them in a text file | |
# See this gist for more info on this line: https://gist.github.com/samsetegne/7768efe9394714c7fb5085de14f03516 | |
git log -p path/to/target/file/filename.py | grep -n "^commit" | grep -Eo "[^ ]+$" > ~/commit_hashes.txt | |
# Clone REPO_B |
This file contains hidden or 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
# The one-liner below does the following: | |
# - 1) Outputs a git log for a specific file | |
# - 2) Filters to all lines that start with commit | |
# - 3) Filters each line to only the commit hash at the end of the line | |
git log -p path/to/target/file/filename.py | grep -n "^commit" | grep -Eo "[^ ]+$" | |
########## | |
# Extras # | |
########## |
This file contains hidden or 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
# For this example, assume REPO_A has one or more files that you want to move into REPO_B along with their commit history | |
# Clone REPO_A | |
git clone REPO_A | |
# Remove all remotes | |
git remote | xargs -n1 git remote remove | |
# List all of the files (using their filepath from root) that you plan to move to REPO_B | |
FILES='filename1 filename2 folder/subfolder/filename3' |
This file contains hidden or 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
import random | |
# http://www.desiquintans.com/downloads/nounlist/nounlist.txt | |
nouns = open('nouns.txt').read().split('\n') | |
# https://raw.githubusercontent.com/janester/mad_libs/master/List%20of%20Proper%20Nouns.txt | |
proper_nouns = open('propernouns.txt').read().split('\n') | |
# https://raw.githubusercontent.com/aaronbassett/Pass-phrase/master/verbs.txt | |
verbs = open('verbs.txt').read().split('\n') |
This file contains hidden or 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
git push -f origin HEAD^:master | |
# Note that you if you just want to remove a commit locally and... | |
# ...keep the change as uncommited modifications to the local files, use the line below: | |
git reset --soft HEAD~1 |
This file contains hidden or 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
import os | |
for root, dirs, files in os.walk(".", topdown=False): | |
for name in files: | |
print(os.path.join(root, name)) | |
for name in dirs: | |
print(os.path.join(root, name)) |
This file contains hidden or 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
compgen -a # All available aliases | |
compgen -b # All available built-in commands | |
compgen -c # All available commands | |
compgen -k # All available keywords | |
compgen -A function # All available functions | |
compgen -A function -abck # Everything available that you can run |
This file contains hidden or 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
# Worked on Linux Mint 19.1 (Tessa) | |
sudo apt-get install python3-dev | |
sudo apt-get install libmysqlclient-dev | |
sudo apt-get install libssl-dev |