Skip to the content.

CheatSheet

Some references for tools.

The Missing Semester of Your CS Education

This is a good collections of lectures on tools that will get you started.

Scoop

This is quite cool to get unix cmds into windows 10 without a lof of unix knowledge. Using powershell felt as if a unix shell. Highly recommended for windows user. Some recommended packages:

~ $ scoop list
Installed apps:

  7zip 19.00
  anaconda3 2019.10 [extras]
  aria2 1.35.0-1
  dark 3.11.2
  gopass 1.8.6
  gpg 2.2.19
  grep 2.5.4
  lessmsi 1.6.91
  pshazz 0.2019.08.07
  vim 8.2
  which 2.20

if you install anaconda with scoop, run activate to activate the vistual python environment.

SSH

ssh -i ~/.ssh/mykey user@host

Git

git clone --recursive [URL to Git repo]
git submodule update --init
git submodule update --init --recursive
git pull --recurse-submodules
git submodule update --remote
git checkout --orphan temp_branch
git add -A
git commit -am "the first commit"
git branch -D master
git branch -m master
git push -f origin master
git rebase -i --root
git push --force

Learn Git

git diff master origin/master

Dotnet CLI and Paket

dotnet tool install paket --global
paket install
paket update
paket clear-cache
dotnet restore
dotnet build -c Release
dotnet vstest Test.dll #run test on a prebuilt test dll
dotnet test --filter DisplayName~getPrice #run XunitTest with a filter
dotnet publish -c Release -o outputdir

For people familiar with jupyter notebook/lab, you can follow this guide and enable F# for it.

dotnet tool install --global Microsoft.dotnet-interactive
dotnet interactive jupyter install #from Anaconda console
jupyter kernelspec list

PowerShell

(type .\navdb.csv | Select-String "," ) | ConvertFrom-Csv | select "Path","Frequency"
$CurrentPath = [Environment]::GetEnvironmentVariable('Path','User')
$TargetPath = $CurrentPath+";path1"
$SplittedPath = $TargetPath -split ';'
$CleanedPath = $SplittedPath | Sort-Object -Unique
$NewPath = $CleanedPath -join ';'
[Environment]::SetEnvironmentVariable('Path', $NewPath,'User')
rm -r -fo somedir

or

xcopy /S src des

or

cp -Recurse -Force src dst

WSL

certmgr -ssl https://nuget.org
certmgr -ssl https://github.com
sudo mkdir /mnt/f
sudo mount -t drvfs F: /mnt/f

Unix commands

find -iregex '.*\.\(sh\|vim\|py\)$' -exec dos2unix {} \;
grep -rl PATTERN  . | xargs ls -l

GPG

A useful cheat sheet

Selected common comands:

gpg --list-secret-keys 
gpg --export -a $ID > my-pub-key.asc
gpg --export-secret-keys -a $ID > my-private-key.asc
gpg --export-secret-subkeys -a $ID > my-private-subkey.asc
gpg --import private_or_pub_key.asc
gpg --delete-key 
gpg --delete-secret-key
#extend expiry requires secret key
gpg --edit-key $id
gpg> expire #key n
gpg> save
gpg> trust 
#encrypt file
gpg -ers $id file

GoPass

gopass some_entry
gopass clone git_repo

wget

wget -r -A .jpy url

imagemagick

magick convert test.jpg info:
magick convert test.jpg -thumbnail 300 -crop 300x100+0+150 -quality 82 test1.jpg