sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh
# | |
# Powershell script for adding/removing/showing entries to the hosts file. | |
# | |
# Known limitations: | |
# - does not handle entries with comments afterwards ("<ip> <host> # comment") | |
# | |
$file = "C:\Windows\System32\drivers\etc\hosts" | |
function add-host([string]$filename, [string]$ip, [string]$hostname) { |
MAC_ADDR=`curl -s http://169.254.169.254/latest/meta-data/mac` | |
CIDR_FULL=`curl -s http://169.254.169.254/latest/meta-data/network/interfaces/macs/${MAC_ADDR}/vpc-ipv4-cidr-block` | |
CIDR_BASE=`echo ${CIDR_FULL} | cut -d/ -f1 | cut -d\. -f1-3` | |
LAST_OCTET=`echo ${CIDR_FULL} | cut -d/ -f1 | cut -d\. -f4` | |
DNS_OCTET=`expr ${LAST_OCTET} + 2` | |
DNS_IP="${CIDR_BASE}.${DNS_OCTET}" | |
echo $DNS_IP |
git log --pretty=format:'"%h","%an","%aD","%s",' --shortstat --no-merges | paste - - - > log.csv |
sudo su | |
cd /root/ | |
wget https://www.softether-download.com/files/softether/v4.34-9745-rtm-2020.04.05-tree/Linux/SoftEther_VPN_Server/32bit_-_ARM_EABI/softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-arm_eabi-32bit.tar.gz | |
tar xzf softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-arm_eabi-32bit.tar.gz && rm softether-vpnserver-v4.34-9745-rtm-2020.04.05-linux-arm_eabi-32bit.tar.gz | |
cd vpnserver && sudo make | |
cd .. | |
sudo mv vpnserver /usr/local && cd /usr/local/vpnserver/ | |
sudo chmod 600 * |
#!/bin/bash | |
# Add to instance metadata with `gcloud compute instances add-metadata \ | |
# instance-name --metadata-from-file startup-script=idle-shutdown.sh` and reboot | |
# NOTE: requires `bc`, eg, sudo apt-get install bc | |
# Modified from https://stackoverflow.com/questions/30556920/how-can-i-automatically-kill-idle-gce-instances-based-on-cpu-usage | |
threshold=0.1 | |
count=0 | |
wait_minutes=60 | |
while true |
# DANGER. DON'T RUN UNLESS YOU REALLY WANT TO DELETE ALL YOUR AWS CONFIG RULES. | |
$deserialized = aws configservice describe-config-rules | ConvertFrom-Json | |
$arr = $deserialized.ConfigRules | select -ExpandProperty ConfigRuleName | |
foreach($x in $arr) { | |
# if your API keys aren't setup you may want to add them in the script | |
aws configservice delete-config-rule --config-rule-name $x | write-host | |
} |
function Use-RunAs { | |
# Check if script is running as Administrator or with elevated privilege, if not use RunAs | |
# Use Check Switch to check if admin | |
param([Switch]$Check) | |
# Detecting OS Platform, win32nt for Windows or unix for Linux/Unix | |
$OSPlatform = (([System.Environment]::OSVersion.Platform).ToString()).ToLower() | |
if ($OSPlatform -eq "unix") { | |
Write-Warning "Detected Linux/Unix OS, you don't need this, use sudo" | |
exit # Quit this session of powershell |
# Minecraft Server deployment for Kubernetes clusters via Ansible's Helm module. | |
# | |
# The Helm module is part of the Kubernetes collection. Install it with: | |
# | |
# ansible-galaxy collection install community.kubernetes | |
# | |
# Then run the playbook: | |
# | |
# ansible-playbook main.yml | |
# |
FROM ubuntu:latest | |
ENV DEBIAN_FRONTEND=noninteractive | |
# INSTALL SOURCES FOR CHROME REMOTE DESKTOP AND VSCODE | |
RUN apt-get update && apt-get upgrade --assume-yes | |
RUN apt-get --assume-yes install curl gpg wget | |
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \ | |
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - |