Search and replace ' with " from the current cursor postion to the end of the file.
:,$s/'/"/gc
swap windows https://superuser.com/a/343574/148121
:swap-window -s 2 -t 1
Swap window 2 with target window 1.
Split a file into multiple smaller files with split
Split into smaller my_special_prefixCSV Example:
split -l 20000 my_data.csv my_special_prefix --additional-suffix=.csv
View a csv in the terminal!!!
column -s , -t < scratch/Connections.csv | less -#2 -N -S
Turn an ISO8601 date into seconds since epoch!
date -j -u -f '%Y-%m-%d' '2019-01-21' +%s
on macos
date -u -d '2019-10-24' +%s
on archlinux
using library/cli pipsi install tabulate
tabulate --header --sep ',(?=(?:[^"]*"[^"]*")*[^"]*$)' scratch/Connections.csv
clipboard
<command> | xsel -i --clipboard
Set .env variables from a file.
set -a
source .env
set +a
Concatenate csvs with the same header
i=0
num_header_lines=3
for filename in *.csv; do
if [ $i -eq 0 ]; then
cat $filename >> output.csv
else
tail -n +$num_header_lines $filename >> output.csv
fi
i=$((i+1))
done
This seems really unsafe, but i did it once and it worked out. Delete all unmerged local branches
# The grep -v is an inverted match. Everything not matching that branch name.
git branch -d $(git branch --merged | grep -v '* master')
echo '# Downloaded from: https://raw.githubusercontent.com/github/gitignore/master/Global/Emacs.gitignore' >> ~/.config/git/ignore
curl 'https://raw.githubusercontent.com/github/gitignore/master/Global/Emacs.gitignore' >> ~/.config/git/ignore
date -u -d '00:00 120 days ago' +"%s"
date -u -d @TIMESTAMP_SECONDS
Number of seconds of since epoch at midnight UTC 120 days ago.
Show the folders in the filesystem taking up the most space. Running on subfolders is useful as well.
sudo du -hsx /* | sort -rh | head -n 40