This script was made for personal purposes, but it can still be useful to many. You NEED to change variables inside the script, like the SSH public key.
On a new Ubuntu server, run the following command:
| package main | |
| import ( | |
| "fmt" | |
| "strings" | |
| ) | |
| func main() { | |
| // ! Edit grammar | |
| cfg := NewGrammar('S', map[byte]Rule{ |
| #!/bin/bash | |
| set -e | |
| # | |
| # Whitelist config file. | |
| # | |
| # Make sure | |
| # include /etc/nginx/conf.d/*.conf; | |
| # is present inside the http {} block of |
| #!/bin/bash | |
| # | |
| # RESTORE COMMANDS | |
| # | |
| # Database: | |
| # cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| # | |
| # Files: | |
| # JOIN parts with cat filename.tar.gz.* > filename.tar.gz |
| #!/bin/env python3 | |
| ''' | |
| Super simple script to set chmod 644 to every file and 755 to every directory. | |
| Useful, for instance, when moving files (in WSL) from the Windows Host to the Linux machine. | |
| As we know, files in /mnt/c/ have the eXecute permission flagged, which is not desiderable. | |
| ''' | |
| import os, sys |
| ''' | |
| Based on https://math.stackexchange.com/a/1080170 | |
| ''' | |
| from functools import lru_cache, reduce | |
| import operator | |
| @lru_cache() | |
| def fact(n): | |
| assert n >= 0 |
| #!/bin/bash | |
| cd /sdcard/Android/media/com.whatsapp/WhatsApp/Media | |
| while read path; do f=$(basename "$path"); touch -d "${f:4:4}-${f:8:2}-${f:10:2}T12:00:00z" "${path}"; done < <(find . -regextype posix-extended -regex ".*/[[:alpha:]]{3}-[[:digit:]]{8}-.*") |