Last active
January 3, 2026 14:24
-
-
Save miron/4997128 to your computer and use it in GitHub Desktop.
Revisions
-
miron revised this gist
Feb 12, 2023 . 2 changed files with 9 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ git push --force (or git push -f) # all commits after reset will be deleted from git stash pop # reapply git rm #remove file from repository git svn clone ... ... # get the latest source from SVN ... git checkout master # ... git svn rebase # ... git diff master # check differencies between modified and remote @@ -14,12 +14,12 @@ git revert HEAD # revert to previous, new commit git revert --no-commit 0766c053..HEAD # revert to commit ... git commit # and commit as HEAD ... git grep -z --full-name -l '.' | xargs -0 sed -i -e 's/old-text/new-text/ig' # find and replace text in all files of a repository git branch -m old_branch new_branch # Rename branch locally ... git push origin :old_branch # Delete the old branch ... git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote ... gitk # gui for git # If you worked in wrong branch git stash git checkout main git stash apply 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ ## VIM ## :grep -Rn TODO . "grep through all TODOs and open first occurence :cn "switch to next occurence of TODO :cp "switch to previous occurence of TODO :make|!./%< "compile and execute programm :vsplit | ctrl+w+v "split verticaly :split | ctrl+w+s "split horizontaly @@ -113,11 +116,10 @@ NVAC (MCP79/MCP7A) #codename graphic card for nouveau driver # Win-` to open quake mode windows terminal # Delete windows installed keyboard: # https://superuser.com/questions/957552/how-to-delete-a-keyboard-layout-in-windows-10 # use US international keyboard for umlauts: # " is dead key, use for ä,ü,ö,Ä,Ü,Ö, # right Alt-s for ß and right Alt-5 for € # Disable Zone Identifier # gpedit.msc User Configuration/Administrative Templates/Windows Components/Attachment Manager # "Do not preserve zone information in file attachments", Enabled # cmd-shift-` to switch between app-windows (german keyboard) -
miron revised this gist
Jul 10, 2022 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,4 +17,9 @@ git grep -z --full-name -l '.' | xargs -0 sed -i -e 's/old-text/new-text/ig' # f git branch -m old_branch new_branch # Rename branch locally ... git push origin :old_branch # Delete the old branch ... git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote ... gitk #gui for git If you worked in wrong branch git stash git checkout main git stash apply -
miron revised this gist
Jun 17, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ git update-git-for-windows # update to newest version on windows git stash # save local modifications git reset --hard 26b6d18 # hash before commit, destroys any local modifications! git push --force (or git push -f) # all commits after reset will be deleted from history -
miron revised this gist
May 27, 2022 . 13 changed files with 119 additions and 113 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,8 @@ help #brief summaries of builtin commands fc #open last commandline in editor kill -HUP $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }') #kill zombie processes echo $0 #show if login shell or not, login shell has -bash rm ./-somefileordir #remove file with hyphen cd ./-somefileordir #change into dir with hyphen type #type of command type -a program #show path to all versions of program export HISTTIMEFORMAT="%h/%d - %H:%M:%S " #shows date in historyfile @@ -30,7 +31,7 @@ yes foo > bar.txt #repeat some text (default is y) infinetly and save it to a fi strings #find the printable strings in a object, or other binary, file mkfifo --mode=0666 /tmp/namedPipe #load SQL commands ... gzip --stdout -d file.gz > /tmp/namedPipe #from gzipped file ... LOAD DATA INFILE '/tmp/namedPipe' INTO TABLE tableName; #into database ... java -version #java version javac -version #java compiler version ant -version #java make tool version 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 charactersOriginal file line number Diff line number Diff line change @@ -1,84 +0,0 @@ File renamed without changes.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 charactersOriginal file line number Diff line number Diff line change @@ -14,4 +14,4 @@ gh issue create -R owner/repo # create issue in specified repository gh issue create -m <name> # Add issue to a milestone by name # Automated in powershell for ($num =1 ; $num -le 365 ; $num++){ sleep 10 ; gh issue create -t 'learn python' -b ' ' -m python } gh issue list --search 'sort:created-asc' # list issues in ascending order gh issue close <number> # close issue 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 charactersOriginal file line number Diff line number Diff line change @@ -16,4 +16,4 @@ git grep -z --full-name -l '.' | xargs -0 sed -i -e 's/old-text/new-text/ig' # f git branch -m old_branch new_branch # Rename branch locally ... git push origin :old_branch # Delete the old branch ... git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote ... gitk #gui for git File renamed without changes.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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,88 @@ ## VIM ## :make|!./%< "compile and execute programm :vsplit | ctrl+w+v "split verticaly :split | ctrl+w+s "split horizontaly ctrl+w+J,r,L "switch splits :so $MYVIMRC "reload .vimrc :so % "if editing :terminal "start terminal in vim :vertical terminal "start terminal in vertical split :term ./%< "run sourcecode in terminal :%s/foo/bar/g "substitute :ls "list buffers :buffers "list buffers :b "switch to buffer :bnext "switch to buffer :bprevious "switch to buffer :buffer <number> "switch to buffer :buffer <tab> "switch to buffer ctrl-w s ctrl-w T "buffers to tabs :tab ba "buffers to tabs :bufdo tab split "buffers to tabs gt "switch tabs :w !sudo tee % "write to read only :E rename files inside vim :set invlist #invisible characters in vim %s/ /^M/g #replace space with newline in vim (^M is Control-V Enter) C-v I# ESC #comment block C-o #paste in insert mode :Ex[plore] #open current file's directory in vim :noh #unhighlight search in vim :term # ctrl-w N terminal scrollback buffer! vim -c ':term ++curwin' #start vim as terminal in full screen ## VIM INSERT IN VSCODE AND PYCHARM ## # Ctrl-o h move cursor left # Ctrl-o l move cursor right # Ctrl-o j move cursor down # Ctrl-o k move cursor up # Ctrl-h backspace/delete # Ctrl-o x delete # Ctrl-o R replace mode # Ctrl-c or Esc exit replace mode # Ctrl-t indent # Ctrl-d unindent # VIM NORMAL IN VSCODE # f find forward, also works with df # F find backward, also works with dF # Ctrl-o, Ctrl-i jumplist (Ctrl-i brings you back) # Ctrl-/ to quickly comment/uncomment in vscode ## VSCODE ## # %% to create a notebook like cell in a python file in vscode, create new cell with Shift+Enter # ctrl-1 focus editor # ctrl=w j focus terminal (vim keybindings) # "justMyCode": false, to step into external modules # "cwd": "${fileDirname}", run debugger in directory of script # "stopOnEntry": true, break at entry point of script # Ctrl+Shift+P toggleVim temporaly disable Vim keybindings # Ctrl+Shift+V render markdown, double click to switch back. disable vim keybindings first # Ctrl+K V view rendered markdown side by side ## PYCHARM ## Alt+4 # Focus Run window Ctrl-0 (mapped) # Run File Alt-= (mapped) # Focus Terminal Alt-Shift-E # execute curent line in terminal Ctrl+TAB # Focus and switch through open files... ## EMACS ## C-s #incremental search C-g #quit menu C-x b #switch buffer q #quit undo-tree C-x C-b #list buffers C-x 1 #close windows except cursor TAB #select from completion C-TAB #view list of M-x commands C-x k #kill buffer C-x o #switch to other window of buffers M-b #vims *, beginning of word C-s C-w #select word C-w #further selection of word if underscore C-s # ... ## BASH ## ctrl-r #search history ctrl-r #cycle @@ -16,4 +101,23 @@ ctrl+arrow up/down #pan in feh ^a [ #scroll buffer (vim style navigation) screen ^ l #clearscreen (cmd-k clears every region) screen ^b :set -g status off #disable statusbar in tmux ## MAC OS ## cmd shift . #show hidden files in open dialog NVAC (MCP79/MCP7A) #codename graphic card for nouveau driver ## Windows ## # starting/switching windows with Win-<num> in the order pinned to your taskbar # Win-` to open quake mode windows terminal # Delete windows installed keyboard: # https://superuser.com/questions/957552/how-to-delete-a-keyboard-layout-in-windows-10 # use us international keyboard for umlauts: # " is dead key, use for ä,ü,ö,Ä,Ü,Ö, # right Alt-s for ß and right Alt-5 for € # Disable Zone Identifier # gpedit.msc User Configuration/Administrative Templates/Windows Components/Attachment Manager # "Do not preserve zone information in file attachments", Enabled cmd-shift-` #_switch between app-windows (german keyboard) 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 charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ brew install bash #enable autocd in macos ... echo /usr/local/bin/bash >> /etc/shells # ... chsh #change login shell #New shell: /usr/local/bin/bash ... mysql.server start #start mysql xcrun -find #show path of commands inside Xcode /System/Library/Extensions/TMSafetyNet.kext/Helpers/bypass <cmd> #operate on files in Timemachine cd /private/var/log/asl #speed up terminal in osx ... @@ -52,5 +52,4 @@ sips -g pixelWidth -g pixelHeight [image-file] #get picture dimensions /Applications/Utilities/Network Utility.app/Contents/Resources/stroke #mac os built-in port scanner defaults -currentHost write -globalDomain AppleFontSmoothing -int 2 #font smoothing defaults write com.apple.finder AppleShowAllFiles TRUE #show hidden files in finder and timemachine ... killall Finder # ... File renamed without changes.File renamed without changes.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 charactersOriginal file line number Diff line number Diff line change @@ -21,14 +21,11 @@ kali run vi /mnt/c/Users/<user>/<file> # Edit file in powershell with vi in kali # Powershell in Linux # In /etc/ssh/sshd_config: # Subsystem powershell /usr/bin/pwsh --sshs -NoLogo -NoProfile New-PSSession -hostname <IP address> -username <username> # In PS on Windows Enter-PSSession <Sessionnumber> # Enter Session Stop-Process -Id <ProcessId> # Close Session Invoke-Command -Session(Get-PSSession <Sessionnumber>) -ScriptBlock { uname -a } # Remote Command Expand-Archive <drive>\<path>\<file>.zip -DestinationPath <drive>\<path>\<directory> # unzip docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id #get IP address of container 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 charactersOriginal file line number Diff line number Diff line change @@ -35,8 +35,7 @@ dpkg-query -W -f='${Status} ${Version}\n' ... #check if package is installed or cat /etc/issue #show linux distro lsb_release -a #show linux distro debconf-show #show configuration ps -p $$ #display current shell name lsblk #list partition inside WSL bpf_probe_read() #protects Linux from arbitrary memory 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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +0,0 @@ -
miron revised this gist
May 27, 2022 . 2 changed files with 28 additions and 33 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,6 @@ shopt #shell options bind -P #print keybindings bash -x #print shellscript before executing, execute commands from file help #brief summaries of builtin commands fc #open last commandline in editor kill -HUP $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }') #kill zombie processes echo $0 #show if login shell or not, login shell has -bash @@ -31,8 +26,6 @@ man std::-->tab #c++ manpages base64 #encode and decode using base64 representation jq -r 'map(.Value | @base64d)' < file.json #decode base64 string of Value object pdftotext my.pdf - | grep 'pattern' #grep through pdfs without writing txt file yes foo > bar.txt #repeat some text (default is y) infinetly and save it to a file strings #find the printable strings in a object, or other binary, file mkfifo --mode=0666 /tmp/namedPipe #load SQL commands ... @@ -52,33 +45,16 @@ xpath #xml parser xmllint #xml parser locate -r "^\(.*/\)*header\.inc\.php$" #exact match sqlite3 #sqlite cli interface ... .databases #view databases ... .open FILENAME #connect to database file ... .tables #show tabes ... .mode html #switch to html mode ... .once FILENAME.html #query output to file ... SELECT * FROM TABLE; # write content from table to FILENAME.html... .quit #quit sqlite database ... project.cj add overtone dep #overtone audio live coding lein deps # ... gibber #audiovisual live coding framework in javascript xclip -sel clip < ~/.ssh/id_rsa.pub #copy from file to clipboard sudo service start ssh start # start ssh daemon on WSL client and remotely connect to it apt install <packet> # install gh in Kali, download deb: https://github.com/cli/cli/releases/latest 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ ## BASH ## ctrl-r #search history ctrl-r #cycle ctrl-g #quit search arrow up/down #zoom in feh ctrl+arrow up/down #pan in feh #screen ^a | #split verticaly in screen ^a TAB #switch region screen ^a c #create session screen ^a " #choose session screen ^a X #close region screen ^a Q #close all regions beside actual one screen ^a [ #scroll buffer (vim style navigation) screen ^ l #clearscreen (cmd-k clears every region) screen ^b :set -g status off #disable statusbar in tmux -
miron revised this gist
May 22, 2022 . 1 changed file with 5 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -61,10 +61,11 @@ vim -c ':term ++curwin' #start vim as terminal in full screen # Ctrl+K V view rendered markdown side by side ## PYCHARM ## Alt+4 # Focus Run window Ctrl-0 (mapped) # Run File Alt-= (mapped) # Focus Terminal Alt-Shift-E # execute curent line in terminal Ctrl+TAB # Focus and switch through open files... ## EMACS ## C-s #incremental search -
miron revised this gist
May 21, 2022 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ git stash # save local modifications git reset --hard 26b6d18 # hash before commit, destroys any local modifications! git push --force (or git push -f) # all commits after reset will be deleted from history git stash pop # reapply git rm #remove file from repository git svn clone ... ... # get the latest source from SVN ... -
miron revised this gist
May 21, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ git reset --hard ABC # hash before commit, destroys any local modifications! git push --force (or git push -f) # all commits after reset will be deleted from history git rm #remove file from repository -
miron revised this gist
May 8, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ git reset --hard ABC # hash before commit git push --force (or git push -f) # all commits after reset will be deleted from history git rm #remove file from repository git svn clone ... ... # get the latest source from SVN ... -
miron revised this gist
May 7, 2022 . 7 changed files with 22 additions and 25 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,2 +0,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 charactersOriginal file line number Diff line number Diff line change @@ -65,4 +65,20 @@ gibber #audiovisual live coding framework in javascript xclip -sel clip < ~/.ssh/id_rsa.pub #copy from file to clipboard # Start an ssh-server on a WSL client and remotely connect to it: sudo service start ssh start # on your wsl machine, starts the ssh daemon # Install gh in Kali, download deb: https://github.com/cli/cli/releases/latest apt install <packet> #screen ^a | #split verticaly in screen ^a TAB #switch region screen ^a c #create session screen ^a " #choose session screen ^a X #close region screen ^a Q #close all regions beside actual one screen ^a [ #scroll buffer (vim style navigation) screen ^ l #clearscreen (cmd-k clears every region) screen ^b :set -g status off #disable statusbar in tmux 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +0,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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +0,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 charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,4 @@ Stop-Process -Id <ProcessId> # Remote Command: Invoke-Command -Session(Get-PSSession <Sessionnumber>) -ScriptBlock { uname -a } Expand-Archive <drive>\<path>\<file>.zip -DestinationPath <drive>\<path>\<directory> # unzip docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id #get IP address of container 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 charactersOriginal file line number Diff line number Diff line change @@ -38,4 +38,6 @@ debconf-show #show configuration cmd-shift-` #_switch between app-windows (german keyboard) NVAC (MCP79/MCP7A) #codename graphic card for nouveau driver ps -p $$ #display current shell name lsblk #list partition inside WSL bpf_probe_read() #protects Linux from arbitrary memory BPF_PROG_LOAD #verify and load a BPF program 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 charactersOriginal file line number Diff line number Diff line change @@ -7,8 +7,4 @@ # right Alt-s for ß and right Alt-5 for € # Disable Zone Identifier # gpedit.msc User Configuration/Administrative Templates/Windows Components/Attachment Manager # "Do not preserve zone information in file attachments", Enabled -
miron renamed this gist
May 7, 2022 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
miron revised this gist
May 7, 2022 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -53,11 +53,9 @@ vim -c ':term ++curwin' #start vim as terminal in full screen # %% to create a notebook like cell in a python file in vscode, create new cell with Shift+Enter # ctrl-1 focus editor # ctrl=w j focus terminal (vim keybindings) # "justMyCode": false, to step into external modules # "cwd": "${fileDirname}", run debugger in directory of script # "stopOnEntry": true, break at entry point of script # Ctrl+Shift+P toggleVim temporaly disable Vim keybindings # Ctrl+Shift+V render markdown, double click to switch back. disable vim keybindings first # Ctrl+K V view rendered markdown side by side -
miron revised this gist
May 7, 2022 . 1 changed file with 1 addition and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -63,9 +63,6 @@ project.cj add overtone dep #overtone audio live coding lein deps # ... gibber #audiovisual live coding framework in javascript xclip -sel clip < ~/.ssh/id_rsa.pub #copy from file to clipboard # Start an ssh-server on a WSL client and remotely connect to it: sudo service start ssh start # on your wsl machine, starts the ssh daemon -
miron revised this gist
May 7, 2022 . 3 changed files with 10 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ # create alias: gh alias set cheat 'gist view 4997128' # gh cheat | grep cheat -C 3, shows 3 lines before and after, # Windows Powershell: gh cheat | Select-String cheat bind -p | grep -v '^#\|self-insert\|^$' #list bash vim keybindings shopt #shell options bind -P #print keybindings @@ -62,6 +63,9 @@ project.cj add overtone dep #overtone audio live coding lein deps # ... gibber #audiovisual live coding framework in javascript xclip -sel clip < ~/.ssh/id_rsa.pub #copy from file to clipboard ^Z, fg # go from python interpreter to bash and back again. # Start an ssh-server on a WSL client and remotely connect to it: sudo service start ssh start # on your wsl machine, starts the ssh daemon 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,7 @@ Get-WmiObject Win32_DiskDrive #list available disks Select-String cheat # powershell equivalent of grep wsl --mount <DiskPath> --bare #make disk available to wsl2 $(ls dir/*.ext) # pass all files in dir as argument to cli-tools # forwards traffic from port 2222 on host to sshd port 22 on wsl client netsh interface portproxy add v4tov4 listenport=2222 listenaddress=0.0.0.0 connectport=22 connectaddress=localhost 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 charactersOriginal file line number Diff line number Diff line change @@ -38,3 +38,4 @@ debconf-show #show configuration cmd-shift-` #_switch between app-windows (german keyboard) NVAC (MCP79/MCP7A) #codename graphic card for nouveau driver ps -p $$ #display current shell name lsblk #list partition inside WSL -
miron revised this gist
May 7, 2022 . 5 changed files with 8 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ # grepable with inline comments. # create alias: gh alias set cheat 'gist view 4997128' # gh cheat | grep cheat -C 3, shows 3 lines before and after, # Windows Powershell: gh cheat | Select-String cheat bind -p | grep -v '^#\|self-insert\|^$' #list bash vim keybindings shopt #shell options bind -P #print keybindings @@ -18,10 +22,6 @@ export HISTTIMEFORMAT="%h/%d - %H:%M:%S " #shows date in historyfile printf \t \n ... #formated print with tab and newline grep -A 2 -B 3 foo README.txt # 2 lines before, 3 lines after grep -C 3 foo README.txt # 3 lines before and after xprop |grep WM_CLASS #get x11 window classname echo "scale=2; x+y" | bc #calculations from cli, 2 decimals echo "x*y" | bc -l #calculations from cli @@ -41,9 +41,6 @@ java -version #java version javac -version #java compiler version ant -version #java make tool version mvn #java project management tool rcs #revision control system tee #pipe to STDOUT and file cal #display calendar 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +0,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 charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,4 @@ readelf --debug-dump=frames a.out #show table content hexdump -C a.out #ELF string readelf -hW a.out #ELF header g++ file.cpp -v #compilation flags readelf -lW a.out #ELF segments 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 charactersOriginal file line number Diff line number Diff line change @@ -12,3 +12,4 @@ git grep -z --full-name -l '.' | xargs -0 sed -i -e 's/old-text/new-text/ig' # f git branch -m old_branch new_branch # Rename branch locally ... git push origin :old_branch # Delete the old branch ... git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote ... gitk #gui for git 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ bundle update github-pages #update to newest gems for github-pages inside repo ... gem update github-pages # dito ... bundle info --path minima #show where gem is located in project https://api.github.com/emojis # markdown emojis :om: git clone git@github.com:4997128.git #clone gist over ssh, add files like images, commit, push -
miron revised this gist
May 7, 2022 . 3 changed files with 71 additions and 70 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ bind -p | grep -v '^#\|self-insert\|^$' #list bash vim keybindings shopt #shell options bind -P #print keybindings bash -x #print shellscript before executing, execute commands from file help #brief summaries of builtin commands ctrl-r #search history ctrl-r #cycle <cr> #run ←, → #edit ctrl-g #quit search fc #open last commandline in editor kill -HUP $(ps -A -ostat,ppid | grep -e '[zZ]'| awk '{ print $2 }') #kill zombie processes echo $0 #show if login shell or not, login shell has -bash rm/cd ./-somefileordir #rm or cd file or dir with hyphen type #type of command type -a program #show path to all versions of program export HISTTIMEFORMAT="%h/%d - %H:%M:%S " #shows date in historyfile printf \t \n ... #formated print with tab and newline grep -A 2 -B 3 foo README.txt # 2 lines before, 3 lines after grep -C 3 foo README.txt # 3 lines before and after # grepable with inline comments. # create alias: gh alias set cheat 'gist view 4997128' # gh cheat | grep cheat -C 3, shows 3 lines before and after, # Windows Powershell: gh cheat | Select-String cheat xprop |grep WM_CLASS #get x11 window classname echo "scale=2; x+y" | bc #calculations from cli, 2 decimals echo "x*y" | bc -l #calculations from cli sudo -s #stay in directory when sudo man std::-->tab #c++ manpages base64 #encode and decode using base64 representation jq -r 'map(.Value | @base64d)' < file.json #decode base64 string of Value object pdftotext my.pdf - | grep 'pattern' #grep through pdfs without writing txt file arrow up/down #zoom in feh ctrl+arrow up/down #pan in feh yes foo > bar.txt #repeat some text (default is y) infinetly and save it to a file strings #find the printable strings in a object, or other binary, file mkfifo --mode=0666 /tmp/namedPipe #load SQL commands ... gzip --stdout -d file.gz > /tmp/namedPipe #from gzipped file ... LOAD DATA INFILE '/tmp/namedPipe' INTO TABLE tableName; #into database ... java -version #java version javac -version #java compiler version ant -version #java make tool version mvn #java project management tool git #version control gitk #gui for git svn #subversion rcs #revision control system tee #pipe to STDOUT and file cal #display calendar tidy #html parser fmt #format text (TEX) textutil #convert document-files xpath #xml parser xmllint #xml parser locate -r "^\(.*/\)*header\.inc\.php$" #exact match sqlite3 #sqlite cli interface ... .databases #view databases ... .open FILENAME #connect to database file ... .tables #show tabes ... .mode html #switch to html mode ... .once FILENAME.html #query output to file ... SELECT * FROM TABLE; # write content from table to FILENAME.html... .quit #quit sqlite database ... project.cj add overtone dep #overtone audio live coding lein deps # ... gibber #audiovisual live coding framework in javascript xclip -sel clip < ~/.ssh/id_rsa.pub #copy from file to clipboard # python interpreter: # ^Z, fg go to bash and back again. 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 charactersOriginal file line number Diff line number Diff line change @@ -1,23 +0,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 charactersOriginal file line number Diff line number Diff line change @@ -1,47 +1 @@ -
miron revised this gist
May 7, 2022 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -58,6 +58,9 @@ vim -c ':term ++curwin' #start vim as terminal in full screen # "cwd": "${fileDirname}", run debugger in directory of script # "stopOnEntry": true, break at entry point of script # --ignore=E731 Autopep8 Args, don't format my lambdas # Ctrl+Shift+P toggleVim temporaly disable Vim keybindings # Ctrl+Shift+V render markdown, double click to switch back. disable vim keybindings first # Ctrl+K V view rendered markdown side by side ## PYCHARM ## # Focus Run window: Alt+4 -
miron revised this gist
Apr 29, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -35,6 +35,8 @@ Enter-PSSession <Sessionnumber> Stop-Process -Id <ProcessId> # Remote Command: Invoke-Command -Session(Get-PSSession <Sessionnumber>) -ScriptBlock { uname -a } Expand-Archive <drive>\<path>\<file>.zip -DestinationPath <drive>\<path>\<directory> # unzip -
miron revised this gist
Apr 29, 2022 . 1 changed file with 0 additions and 60 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,60 +0,0 @@ -
miron revised this gist
Apr 29, 2022 . 1 changed file with 6 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -33,12 +33,12 @@ with open('filename') as f: with open('filename', 'w') as f: f.write("#First Line\n" + read_data) # insert at beginning of file @classmethod # class method constructor with cls as parameter @staticmethod # a static method with no arguments @dataclass # define fields to include parameters and methods like __init__(), __repr__, ___eq___, some default to true already. Less typing youtube-dl -f bestvideo-bestaudio "url" # download best versions of your videos print("\033c", end='') # clear screen in REPL set editing-mode vi in .inputrc, clear screen with ESC Ctrl-L in REPL # max() with lambda function as key parameter, list comprehension, str.split() and dict.get(), - before dict reverses order max([word for word in 'Who is the richest, Bill Gates, Jeff Bezos, Warren Buffet, Mark Zuckerberg or Elon Musk?'.split()], @@ -58,5 +58,3 @@ python -im pdb nul # same in powershell {str(n):n for n in range(1,11)} # generate dict of numbers with string of number as keys {**{str(n):n for n in range(2,11)},'A': [11,1], 'K': 10, 'Q': 10, 'J': 10} # unpack dict into dict {k: {'a':1, 'b':2, 'c':3, 'd':4}[k] for k in ['b','d']} # filter dict with keys in list -
miron revised this gist
Apr 29, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -57,4 +57,6 @@ python -im pdb /dev/null # just start the python debugger python -im pdb nul # same in powershell {str(n):n for n in range(1,11)} # generate dict of numbers with string of number as keys {**{str(n):n for n in range(2,11)},'A': [11,1], 'K': 10, 'Q': 10, 'J': 10} # unpack dict into dict {k: {'a':1, 'b':2, 'c':3, 'd':4}[k] for k in ['b','d']} # filter dict with keys in list -
miron revised this gist
Apr 29, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -56,3 +56,5 @@ sum([num < 0 for num in [-1, -2, 3, 4]]) # occurencies of negative numbers python -im pdb /dev/null # just start the python debugger python -im pdb nul # same in powershell {str(n):n for n in range(1,11)} # generate dict of numbers with string of number as keys {**{str(n):n for n in range(2,11)},'A': [11,1], 'K': 10, 'Q': 10, 'J': 10} # unpack dict into dict -
miron revised this gist
Apr 29, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -55,4 +55,4 @@ sum([num < 0 for num in [-1, -2, 3, 4]]) # occurencies of negative numbers python -im pdb /dev/null # just start the python debugger python -im pdb nul # same in powershell {str(n):n for n in range(1,11)} # generate dict of numbers with string of number as keys -
miron revised this gist
Apr 28, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -53,4 +53,6 @@ import string; [ord(char) for char in string.ascii_uppercase] # show unicode cod print("You have", coins:=5, f'coin{"s" if coins !=1 else ""}') # singular/plural sum([num < 0 for num in [-1, -2, 3, 4]]) # occurencies of negative numbers python -im pdb /dev/null # just start the python debugger python -im pdb nul # same in powershell -
miron revised this gist
Apr 27, 2022 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -50,6 +50,7 @@ import string; [ord(char) for char in string.ascii_uppercase] # show unicode cod (lambda p: (w := [c.lower()for c in p if c.isalpha()]).__eq__(w[::-1]))('') (lambda p: (w := [map(str.lower, (c for c in p if c.isalpha()))]) == w[::-1])('') print("You have", coins:=5, f'coin{"s" if coins !=1 else ""}') # singular/plural sum([num < 0 for num in [-1, -2, 3, 4]]) # occurencies of negative numbers -
miron revised this gist
Apr 27, 2022 . 2 changed files with 6 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -53,21 +53,18 @@ vim -c ':term ++curwin' #start vim as terminal in full screen # %% to create a notebook like cell in a python file in vscode, create new cell with Shift+Enter # ctrl-1 focus editor # ctrl=w j focus terminal (vim keybindings) # "pythonArgs: ["-i"], in launch.json launches script in interactive console # "justMyCode": false, to step into external modules # "cwd": "${fileDirname}", run debugger in directory of script # "stopOnEntry": true, break at entry point of script # --ignore=E731 Autopep8 Args, don't format my lambdas ## PYCHARM ## # Focus Run window: Alt+4 # Run File: Ctrl-0 (mapped) # Focus Terminal: Alt-= (mapped) # Alt-Shift-E execute curent line in terminal ## EMACS ## C-s #incremental search C-g #quit menu Empty file. -
miron revised this gist
Apr 27, 2022 . 3 changed files with 29 additions and 21 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,4 +17,7 @@ type -a program #show path to all versions of program export HISTTIMEFORMAT="%h/%d - %H:%M:%S " #shows date in historyfile printf \t \n ... #formated print with tab and newline grep -A 2 -B 3 foo README.txt # 2 lines before, 3 lines after grep -C 3 foo README.txt # 3 lines before and after # python interpreter: # ^Z, fg go to bash and back again. 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 charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,7 @@ vim -c ':term ++curwin' #start vim as terminal in full screen # Ctrl-c or Esc exit replace mode # Ctrl-t indent # Ctrl-d unindent # VIM NORMAL IN VSCODE # f find forward, also works with df # F find backward, also works with dF @@ -50,17 +51,35 @@ vim -c ':term ++curwin' #start vim as terminal in full screen ## VSCODE ## # %% to create a notebook like cell in a python file in vscode, create new cell with Shift+Enter # ctrl-1 focus editor # ctrl=w j focus terminal (vim keybindings) ## PYCHARM # Focus Run window: Alt+4 # Run File: Ctrl-0 (mapped) # Focus Terminal: Alt-= (mapped) # Alt-Shift-E execute curent line in terminal # "pythonArgs: ["-i"], in launch.json launches script in interactive console # "justMyCode": false, to step into external modules # "cwd": "${fileDirname}", run debugger in directory of script # "stopOnEntry": true, break at entry point of script # --ignore=E731 Autopep8 Args, don't format my lambdas ## EMACS ## C-s #incremental search C-g #quit menu C-x b #switch buffer q #quit undo-tree C-x C-b #list buffers C-x 1 #close windows except cursor TAB #select from completion C-TAB #view list of M-x commands C-x k #kill buffer C-x o #switch to other window of buffers M-b #vims *, beginning of word C-s C-w #select word C-w #further selection of word if underscore C-s # ... 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 charactersOriginal file line number Diff line number Diff line change @@ -1,14 +0,0 @@ -
miron revised this gist
Apr 27, 2022 . 2 changed files with 27 additions and 29 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ ## VIM ## :make|!./%< "compile and execute programm :vsplit | ctrl+w+v "split verticaly :split | ctrl+w+s "split horizontaly @@ -30,18 +31,36 @@ C-o #paste in insert mode :term # ctrl-w N terminal scrollback buffer! vim -c ':term ++curwin' #start vim as terminal in full screen ## VIM INSERT IN VSCODE AND PYCHARM ## # Ctrl-o h move cursor left # Ctrl-o l move cursor right # Ctrl-o j move cursor down # Ctrl-o k move cursor up # Ctrl-h backspace/delete # Ctrl-o x delete # Ctrl-o R replace mode # Ctrl-c or Esc exit replace mode # Ctrl-t indent # Ctrl-d unindent # VIM NORMAL IN VSCODE # f find forward, also works with df # F find backward, also works with dF # Ctrl-o, Ctrl-i jumplist (Ctrl-i brings you back) # Ctrl-/ to quickly comment/uncomment in vscode ## VSCODE ## # %% to create a notebook like cell in a python file in vscode, create new cell with Shift+Enter # Pycharm: # Focus Run window: Alt+4 # Run File: Ctrl-0 (mapped) # Focus Terminal: Alt-= (mapped) # Alt-Shift-E execute curent line in terminal # ctrl-1 focus editor # ctrl=w j focus terminal (vim keybindings) # python interpreter: # ^Z, fg go to bash and back again. # "pythonArgs: ["-i"], in launch.json launches script in interactive console # "justMyCode": false, to step into external modules # "cwd": "${fileDirname}", run debugger in directory of script # "stopOnEntry": true, break at entry point of script # --ignore=E731 Autopep8 Args, don't format my lambdas 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 charactersOriginal file line number Diff line number Diff line change @@ -9,27 +9,6 @@ class MyPrompt(Prompts): ip = get_ipython() ip.prompts = MyPrompt(ip) # A minimal prompt from subprocess import run, sys; run([sys.executable, '-m', 'pip', 'install', '<packagename>']) # install module from within python shell from subprocess import run; run('pip install <packagename>', shell=True) # shorter version from subprocess import run; run(['pip', 'install', '<packagename>']) # yes, shorter -
miron revised this gist
Apr 25, 2022 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,4 +24,17 @@ cd \\wsl$\kali-linux # go to directory of wsl distro kali run vi /mnt/c/Users/<user>/<file> # Edit file in powershell with vi in kali wsl # Powershell in Linux # In /etc/ssh/sshd_config: Subsystem powershell /usr/bin/pwsh --sshs -NoLogo -NoProfile # In PS on Windows: New-PSSession -hostname <IP address> -username <username> # Enter Session: Enter-PSSession <Sessionnumber> # Close Session: Stop-Process -Id <ProcessId> # Remote Command: Invoke-Command -Session(Get-PSSession <Sessionnumber>) -ScriptBlock { uname -a } -
miron revised this gist
Apr 25, 2022 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,3 +8,7 @@ # Disable Zone Identifier # gpedit.msc User Configuration/Administrative Templates/Windows Components/Attachment Manager # "Do not preserve zone information in file attachments", Enabled # Install gh in Kali, download deb: https://github.com/cli/cli/releases/latest apt install <packet>
NewerOlder