Skip to content

Instantly share code, notes, and snippets.

View mijndert's full-sized avatar
💻
Remote

Mijndert mijndert

💻
Remote
View GitHub Profile
ip route list | grep default | grep -E 'dev (\w+)' -o | awk '{print $2}'
import http.server
import socketserver
from urllib.parse import urlparse
from urllib.parse import parse_qs
PORT = 9001
class r(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
@mijndert
mijndert / set-aws-credentials.sh
Last active May 3, 2020 14:07
simple script to read credentials from ~/.aws/credentials and export it into your env vars
#!/usr/bin/env bash
echo "Enter the account for which you want to export credentials and [enter]"
read account
export AWS_ACCESS_KEY_ID=$(aws configure get $account.aws_access_key_id)
export AWS_SECRET_ACCESS_KEY=$(aws configure get $account.aws_secret_access_key)
export AWS_REGION=$(aws configure get $account.region)
1. Create and start an EC2 instance with the same OS (+version)
2. Create a snapshot of the original root volume
3. Create a new volume from the snapshot (source)
4. Create a new larger/smaller volume (target)
5. Connect the source as xvdf
6. Connect the target as xvdg
Run these commands:
e2fsck -f /dev/xvdf1
UPDATE wp_options SET option_value = replace(option_value, 'http://www.example.com', 'https://www.example.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.example.com','https://www.example.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.example.com', 'https://www.example.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.example.com','https://www.example.com');
profiles > general > send text at start
tmux ls && read tmux_session && tmux attach -t ${tmux_session:-default} || tmux new -s ${tmux_session:-default}
docker run -d \
--name watchtower \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/timezone:/etc/timezone:ro \
containrrr/watchtower --cleanup --no-startup-message --schedule "0 0 * * *"
docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
docker run -d \
--name statping \
-p 8181:8080 \
-v /home/mijndert/statping:/app \
--restart always \
statping/statping
@mijndert
mijndert / install-vim-plugins.md
Last active December 23, 2020 17:34
Setup vim8 plugins

Install editorconfig

mkdir -p ~/.vim/pack/local/start
cd ~/.vim/pack/local/start
git clone https://github.com/editorconfig/editorconfig-vim.git

Install dracula

mkdir -p ~/.vim/pack/themes/start
cd ~/.vim/pack/themes/start