Skip to content

Instantly share code, notes, and snippets.

@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
@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
---
- hosts: localhost
connection: local
become: true
vars:
- google_file: /etc/apt/sources.list.d/google-chrome.list
tasks:
- name: base deps
apt: name={{ item }} update_cache=yes
with_items:
@dyrnq
dyrnq / 01-netcfg.yaml
Created August 13, 2022 00:16 — forked from nkabir/01-netcfg.yaml
libguestfs examples
# may be templated in the future
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
optional: true
@dyrnq
dyrnq / deployment.yaml
Last active June 30, 2022 15:12 — forked from lvthillo/deployment.yaml
Example of NodePort service in Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
selector:
matchLabels:
run: my-app
replicas: 4
template:
@dyrnq
dyrnq / script_path.sh
Created June 16, 2021 11:44 — forked from dansomething/script_path.sh
Determine the path to this Bash script
#!/usr/bin/env bash
set -eou pipefail
# Determine the path to this script...
# Short version
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Long version (handles symlinks)
SOURCE="${BASH_SOURCE[0]}"