Skip to content

Instantly share code, notes, and snippets.

GOPROXY=https://goproxy.io,direct go install github.com/spf13/cobra-cli@latest
work_dir="$HOME/code"
app_name="myapp"
app_path="${work_dir}/${app_name}"
gh_repo="dyrnq"
mkdir -p "${app_path}"
pushd "${app_path}" || exit 1
@dyrnq
dyrnq / install-dash-to-dock.sh
Last active May 25, 2024 07:47
install-dash-to-dock.sh
#!/usr/bin/env bash
# this script for onclick install dash-to-dock
# https://extensions.gnome.org/extension/307/dash-to-dock/
# https://micheleg.github.io/dash-to-dock/
# https://micheleg.github.io/dash-to-dock/download.html
command -v jq || ( echo "need jq" && exit 1 )
command -v unzip || ( echo "need unzip" && exit 1 )
@dyrnq
dyrnq / git-ssh-error-fix.sh
Created January 17, 2024 01:19 — forked from Tamal/git-ssh-error-fix.sh
Solution for 'ssh: connect to host github.com port 22: Connection timed out' error
$ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj
Cloning into 'my-awesome-proj'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
$ # This should also timeout
$ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection timed out
$ # but this might work
#!/usr/bin/env bash
iptables -t filter -N KUBE-FIREWALL
iptables -t filter -N KUBE-FORWARD
ipset create KUBE-HEALTH-CHECK-NODE-PORT bitmap:port range 0-65535
iptables -t filter -N KUBE-KUBELET-CANARY
iptables -t filter -N KUBE-NODE-PORT
iptables -t filter -A INPUT -j KUBE-FIREWALL
iptables -t filter -A OUTPUT -j KUBE-FIREWALL
@dyrnq
dyrnq / prepare_ubuntu_template.sh
Created January 6, 2023 05:05 — forked from reluce/prepare_ubuntu_template.sh
Prepare Ubuntu 22.04 Cloud Image and Template for Proxmox
# All commands will be executed on a Proxmox host
sudo apt update -y && sudo apt install libguestfs-tools -y
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
# Install qemu-guest-agent on the image. Additional packages can be specified by separating with a comma.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --install qemu-guest-agent
# Read and set root user password from file.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --root-password file:password_root.txt
# Create an additional user.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --run-command "useradd -m -s /bin/bash myuser"
# Set password for that user.
@dyrnq
dyrnq / lvm-update.sh
Created December 11, 2022 02:14 — forked from vzaicevs/lvm-update.sh
LVM add new disk and transfer data (draft notes)
#initial mounts and lv:
######################################################################################
#/dev/vg1/var /var ext4 defaults 0 0
#/dev/vg1/dokku /var/lib/dokku ext4 defaults 0 0
# # lvdisplay
# --- Logical volume ---
# LV Path /dev/vg1/dokku
# LV Name dokku
@dyrnq
dyrnq / make-swap.sh
Created November 30, 2022 02:50 — forked from omartrigui/make-swap.sh
Create 4G swap file in Linux
#!/bin/bash
dd if=/dev/zero of=/swapfile bs=1024 count=$((1024 * 1024 * 4))
chown root:root /swapfile
chmod 0600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
@dyrnq
dyrnq / sakura_init.sh
Created November 29, 2022 12:51 — forked from marcy-terui/sakura_init.sh
Disable PasswordAuthentication and Enable PubkeyAuthentication on Sakura VPS.
USER_NAME=marcy
sed -i "s/.*RSAAuthentication.*/RSAAuthentication yes/g" /etc/ssh/sshd_config
sed -i "s/.*PubkeyAuthentication.*/PubkeyAuthentication yes/g" /etc/ssh/sshd_config
sed -i "s/.*PasswordAuthentication.*/PasswordAuthentication no/g" /etc/ssh/sshd_config
sed -i "s/.*AuthorizedKeysFile.*/AuthorizedKeysFile\t\.ssh\/authorized_keys/g" /etc/ssh/sshd_config
sed -i "s/.*PermitRootLogin.*/PermitRootLogin no/g" /etc/ssh/sshd_config
echo "${USER_NAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
service sshd restart
cat > /lib/systemd/system/foo.service <<EOF
[Unit]
Description=Setup lo:0
After=network.target
[Service]
Type=oneshot
ExecStart=ifconfig lo:0 192.168.55.100 broadcast 192.168.55.100 netmask 255.255.255.255 up
RemainAfterExit=true
ExecStop=ifconfig lo:0 down
@dyrnq
dyrnq / envoy_static.yaml
Created September 22, 2022 06:12
envoy tcp_proxy
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 10000
filter_chains:
- filters:
- name: envoy.filters.network.tcp_proxy