Skip to content

Commit 5d42b59

Browse files
author
fabiantheblind
committed
added some utils
1 parent 224a74d commit 5d42b59

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

create_toc_of_folder.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
# create list with the first 7 lines of all scripts in markdown
3+
# author: @fabiantheblind
4+
# the headlines are formated to point to github raw files
5+
# TODO:
6+
# make a interface to add raw links right now it points to a fixed location
7+
# should maybe be a python script
8+
#touch overview.md
9+
if [ -e "TOC.md" ]; then
10+
echo "\"TOC.md\" already exists. I will remove it"
11+
rm TOC.md
12+
fi
13+
numfiles=(*)
14+
numfiles=${#numfiles[@]}
15+
echo "There are $numfiles .jsx / .txt / .sh files in this directory"
16+
#echo ls -l | grep -c "^-.*"
17+
echo "##Autogenerated TOC " >> TOC.md;
18+
for file in *.{jsx,json,txt,sh}; do
19+
if [ -e "$file" ]; then
20+
echo "###[${file}](https://raw.github.com/fabiantheblind/auto-typo-adbe-id/master/fabiantheblind/${file}) " >> TOC.md;
21+
#echo " \n" >> TOC.md;
22+
head -7 "${file}" >> TOC.md;
23+
#echo " \n" >> TOC.md;
24+
echo " \\n-------------- \\n " >> TOC.md;
25+
fi
26+
done
27+
open TOC.md

removefromhistory.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -o errexit
3+
4+
# Author: David Underhill
5+
# Script to permanently delete files/folders from your git repository. To use
6+
# it, cd to your repository's root and then run the script with a list of paths
7+
# you want to delete, e.g., git-delete-history path1 path2
8+
9+
# found here http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/
10+
11+
if [ $# -eq 0 ]; then
12+
exit 0
13+
fi
14+
15+
# make sure we're at the root of git repo
16+
if [ ! -d .git ]; then
17+
echo "Error: must run this script from the root of a git repository"
18+
exit 1
19+
fi
20+
21+
# remove all paths passed as arguments from the history of the repo
22+
files=$@
23+
git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch $files" HEAD
24+
25+
# remove the temporary history git-filter-branch otherwise leaves behind for a long time
26+
rm -rf .git/refs/original/ && git reflog expire --all && git gc --aggressive --prune

0 commit comments

Comments
 (0)