Using https://github.com/dandavison/delta
~/.gitconfg
[core]
pager = delta
[interactive]
diffFilter = delta
| # Based on https://gist.github.com/kmatt/71603170556ef8ffd14984af77ff10c5 | |
| # prompt ">" indicates Powershell commands | |
| # prompt "$" are Linux shell commands | |
| # https://docs.microsoft.com/en-us/windows/wsl/install-win10 | |
| > dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart | |
| > dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart | |
| # install https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi |
| # dump | |
| pg_dump testdb | pv -c -s $(psql -tc "SELECT pg_database_size('testdb')") -N dump | gzip > testdb.sql.gz | |
| # restore | |
| pv testdb_20120501.sql.gz | zcat | psql testdb |
| " Based on https://thegreata.pe/articles/2020/07/11/vim-syntax-highlighting-for-sql-strings-inside-python-code/ | |
| if exists('g:enable_sql_python_string') && g:enable_sql_python_string | |
| let s:bcs = b:current_syntax | |
| unlet b:current_syntax | |
| syn include @SQL syntax/sql.vim | |
| syntax region sqlPythonString | |
| \ matchgroup=SpecialComment | |
| \ start=~\z('''\|"""\)\_s*\(ALTER\|BEGIN\|CALL\|COMMENT\|COMMIT\|CONNECT\|CREATE\|DELETE\|DROP\|END\|EXPLAIN\|EXPORT\|GRANT\|IMPORT\|INSERT\|LOAD\|LOCK\|MERGE\|REFRESH\|RENAME\|REPLACE\|REVOKE\|ROLLBACK\|SELECT\|SET\|TRUNCATE\|UNLOAD\|UNSET\|UPDATE\|UPSERT\|WITH\)~ |
| # Warning | |
| Clear-Host | |
| Write-Output "Run this script on the computer you want to access via RDP" | |
| Write-Output "" | |
| # Ask | |
| Write-Output "Remote address can be an IP address or network with CIDR" | |
| Write-Output "Example: 192.168.0.5 or 192.168.0.0/24" | |
| Write-Output "" | |
| $RemoteAddress = Read-Host "Remote Address" |
Using https://github.com/dandavison/delta
~/.gitconfg
[core]
pager = delta
[interactive]
diffFilter = delta
| #!/bin/bash | |
| if [ "$#" -eq 0 ]; then | |
| echo "Usage: $0 FILENAME | 'WILDCARD' (in single quotes)" | |
| exit | |
| fi | |
| slug() { | |
| # Replace non-alpha characters and rename file | |
| f=$(basename "$1") |
| # This will likely become unneeded with https://fedoraproject.org/wiki/Changes/FedoraWSL | |
| ## From https://fedoramagazine.org/wsl-fedora-33/ | |
| ## prompt ">" indicates Powershell commands | |
| # https://docs.microsoft.com/en-us/windows/wsl/install-win10 | |
| > dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart | |
| > dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart |
| # Download all Gists | |
| for i in $(gh gist list -L 1000 | cut -f1); do echo "ID: $i"; gh gist view $i > $i; done | |
| # Rename each file with a slug of the first line / description | |
| for f in *; do mv -v $f $(gawk 'NR==1{gsub(/[^[:alnum:]]/, "-"); gsub(/-+/, "-"); print $0 "_" FILENAME}' $f); done |
| # | |
| # This shell prompt config file was created by promptline.vim | |
| # | |
| function __promptline_host { | |
| local only_if_ssh="0" | |
| if [ $only_if_ssh -eq 0 -o -n "${SSH_CLIENT}" ]; then | |
| if [[ -n ${ZSH_VERSION-} ]]; then print %m; elif [[ -n ${FISH_VERSION-} ]]; then hostname -s; else printf "%s" \\h; fi | |
| fi | |
| } |