Skip to content

Instantly share code, notes, and snippets.

View leotm's full-sized avatar

LeoTM leotm

View GitHub Profile
@leotm
leotm / generate-php-redirections.sh
Created March 29, 2017 11:27
A shell script that creates an associate array and generates prefixed php files that redirect to the matching URLs
# How to iterate over associate arrays in Bash
# To generate PHP redirection files with prefixes
declare -A array
array["uk"]="https://www.google.co.uk"
array["fi"]="https://www.google.fi"
array["es"]="https://www.google.es"
for i in "${!array[@]}"
@leotm
leotm / remove_letsencrypt_all.sh
Created July 12, 2017 20:13
Remove all traces of Let's Encrypt
rm -rf /path/to/your/git/clone/directory
rm -rf ~/.local/share/letsencrypt
rm -rf /etc/letsencrypt
rm -rf /var/log/letsencrypt
rm -rf /var/lib/letsencrypt
rm -rf ~/letsencrypt.log
rm -rf ~/.local/share/letsencrypt
@leotm
leotm / ghost
Created July 24, 2017 14:30
Original file which worked with HTTPS before went down
# /etc/nginx/sites-available/ghost
server {
listen 80;
server_name blog.netsca.pe;
location ~ ^/.well-known {
root /var/www/ghost;
}
@leotm
leotm / restartGhost.sh
Created September 21, 2017 13:39 — forked from hyharryhuang/restartGhost.sh
Restart Ghost Blog
sudo service nginx restart
sudo service ghost restart
PODS:
- boost-for-react-native (1.63.0)
- CocoaAsyncSocket (7.6.4)
- CocoaLibEvent (1.0.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.62.2)
- FBReactNativeSpec (0.62.2):
- Folly (= 2018.10.22.00)
- RCTRequired (= 0.62.2)
- RCTTypeSafety (= 0.62.2)
@leotm
leotm / registerServiceWorker.ts
Created November 19, 2021 15:09
Register a service worker
navigator.serviceWorker
.register('/sw.js')
.then((reg) => console.log('SW registered', reg))
.catch((err) => console.log('rip', err))
@leotm
leotm / reinstall_brew.sh
Created November 19, 2021 15:12
Re-install Brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
@leotm
leotm / symlink.sh
Created November 19, 2021 15:17
Create a hard link or a symbolic link
@leotm
leotm / logServiceWorkers.ts
Created November 19, 2021 15:20
Log service worker registrations to the console
navigator.serviceWorker.getRegistrations().then((registrations) => {
for (const registration of registrations) {
console.log(registration)
}
})
@leotm
leotm / langMarkdown.url
Created November 21, 2021 12:15
lang markdown
https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md