Skip to content

Instantly share code, notes, and snippets.

@mandre00
mandre00 / Proxmox-Cloudinit.sh
Created April 18, 2024 15:08 — forked from chris2k20/Proxmox-Cloudinit.sh
Proxmox Cloud-Init Template Creation Bash-Script (Ubuntu)
#!/bin/bash
# Creates a Ubuntu Cloud-Init Ready VM Template in Proxmox
#
# Update the image name and URL for Ubuntu 22.04 LTS
export IMAGENAME="jammy-server-cloudimg-amd64.img"
export IMAGEURL="https://cloud-images.ubuntu.com/jammy/current/"
export STORAGE="local-zfs-cache"
export VMNAME="ubuntu-2204-cloudinit-template"
export VMID=902204
@mandre00
mandre00 / prepare_ubuntu_template.sh
Created April 12, 2024 15:51 — 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.
@mandre00
mandre00 / git-squash.sh
Created May 16, 2023 06:50 — forked from favila/git-squash.sh
git-squash: script to create a squashed patch from a branch.
#! /bin/sh
# Produce a squash-commit patch from a branch of changes
MASTER=$1
PATCHBRANCH=$2
SQUASHBRANCH="$PATCHBRANCH-squash"
MESSAGE=$3
git checkout -b $SQUASHBRANCH $MASTER &&
git merge --squash $PATCHBRANCH &&
git commit -a -m "$MESSAGE" &&
@mandre00
mandre00 / main.c
Created April 13, 2022 11:02 — forked from mokumus/main.c
C printf macro to add timestamp at each print
#include <stdio.h>
#include <time.h>
#include <string.h>
char * timestamp();
#define print_log(f_, ...) printf("%s ", timestamp()), printf((f_), ##__VA_ARGS__), printf("\n")
@mandre00
mandre00 / socat-manager.sh
Created April 8, 2022 09:27
Socat Manager
#!/bin/bash
# SOCAT Port Forwarder Management Script
# Created By Dimas Restu Hidayanto ([email protected])
IS_NUMBER='^[0-9]+$'
if [ $UID != 0 ]; then
echo "Administrator Previlege Needed. Please Run This Program As An Administrator/Root User!"
exit 1
fi
@mandre00
mandre00 / ddns_provider.conf
Created May 15, 2021 13:49 — forked from superbob/ddns_provider.conf
Namecheap Synology DSM DDNS provider
#Insert this at the end of /etc.defaults/ddns_provider.conf
[Namecheap]
modulepath=/usr/syno/bin/ddns/namecheap.php
queryurl=https://dynamicdns.park-your-domain.com/update
@mandre00
mandre00 / cloudflareddns6.sh
Created May 15, 2021 13:07 — forked from cmer81/cloudflareddns6.sh
dynamic dns IPV6 script for Synology
#!/bin/sh
# cloudflareddns6.sh - dynamic dns IPV6 updater module for Synology
#
# Author:
# Cedric Mercier
#
# Version:
# 0.1
#
#--------- Docker Install -------------
sudo apt-get update
sudo apt-get install curl apt-transport-https ca-certificates software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

SSH into AWS ec2/ Digitalocean droplet/ or else other PAAS, linux machine

  1. Install Docker
$sudo apt install docker.io
$sudo usermod -aG docker $USER

I already installed docker

@mandre00
mandre00 / gitlab-to-bitbucket.py
Created June 9, 2018 14:18 — forked from danhper/gitlab-to-bitbucket.py
Script to migrate repositories from GitLab to Bitbucket
import os
import re
import subprocess
import requests
GITLAB_ENDPOINT = os.environ["GITLAB_ENDPOINT"]
GITLAB_TOKEN = os.environ["GITLAB_TOKEN"]