Skip to content

Instantly share code, notes, and snippets.

@giig982
giig982 / install_ha_vb.sh
Created February 19, 2025 10:33 — forked from Jelle-S/install_ha_vb.sh
Install Home Assistant on VirtualBox
# Installs Home Assistant on VirtualBox following https://www.home-assistant.io/installation/linux
# Install VirtualBox
sudo apt-get -y install virtualbox
# Create a new VM
VBoxManage createvm --name homeassistant --register
# Select OS type "Other Linux (64-bit)"
VBoxManage modifyvm homeassistant --ostype Linux_64
# Set RAM to 6GB (modify to your needs, TODO: make this an option, default value 2GB), video memory to 16MB (TODO: make this an option, default value 16MB)
VBoxManage modifyvm homeassistant --memory 6144 --vram 16
# 2 vCPUs (TODO: make this an option, default value 2)
@giig982
giig982 / .zshrc
Created November 8, 2024 15:20 — forked from matfax/.zshrc
Sudo authentication with Windows 1Password CLI on Ubuntu WSL
# ....
alias sudo="sudo -A"
@giig982
giig982 / pingcheck.sh
Created July 2, 2024 11:21 — forked from moozer/pingcheck.sh
ping check - simple bash script to ping host list from file
#!/bin/bash
# googling
# "bash read line by line from file"
# gave me this:
# http://stackoverflow.com/questions/10929453/bash-scripting-read-file-line-by-line
# file which contains one hostname or ip per line
FILENAME="hosts"
@giig982
giig982 / new-wireguard-peer.sh
Created April 2, 2024 13:50 — forked from stenehall/new-wireguard-peer.sh
Script to automatically add configration for a new peer to a wireguard server. It will then print a QR code to the console that can be used to add the config to the Android or OS X wireguard client.
#!/bin/bash
readonly INTERFACE="wg0"
# Generate peer keys
readonly PRIVATE_KEY=$(wg genkey)
readonly PUBLIC_KEY=$(echo ${PRIVATE_KEY} | wg pubkey)
readonly PRESHARED_KEY=$(wg genpsk)
# Read server key from interface
@giig982
giig982 / Setting_Up_Tomcat .txt
Last active October 18, 2023 09:04 — forked from s-v-z/gist:4f30862349c9b33c7b8cb8371ee5ca23
Setting Up Tomcat For Remote Debugging
Tomcat can be configured to allow a program such as eclipse to connect remotely using JPDA and see debugging information.
To configure tomcat to allow remote debugging, start tomcat using the catalina startup script (from your tomcat home) instead of the normal startup script like so (tomcat must be stopped before you can change over):
WIN:
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
bin/catalina.bat jpda start
UNIX:
export JPDA_ADDRESS=8000
@giig982
giig982 / parse-xml.js
Created November 18, 2022 16:48 — forked from arafathusayn/parse-xml.js
Postman Test Script - Parse XML API response & set environment variables from the parsed data
var parseString = require("xml2js").parseString;
var xml = pm.response.text();
parseString(xml, (err, data) => {
if (err) throw err;
// traverse and set env variable
pm.environment.set("ENV_NAME_HERE", data.whatever);
});
@giig982
giig982 / resize-image-keep-aspect-ratio.py
Last active March 7, 2022 15:01 — forked from tomvon/resize-image-keep-aspect-ratio.py
Python script to resize an image if bigger than maxWidth, while keeping the original aspect ratio.
#Resizes an image and keeps aspect ratio. Set mywidth to the desired with in pixels.
import PIL
from PIL import Image
def resizeImageIfNeeded(file_path):
maxWidth = 3000
img = Image.open(file_path)
imgWidth = img.size[0]
@giig982
giig982 / curl-websocket.sh
Created May 3, 2021 10:12 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@giig982
giig982 / disable_vim_auto_visual_on_mouse.txt
Created March 12, 2021 09:10 — forked from u0d7i/disable_vim_auto_visual_on_mouse.txt
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a
@giig982
giig982 / SSLPoke.java
Created November 25, 2020 16:10 — forked from bric3/SSLPoke.java
The famous SSLPoke from Atlassian : establish a TLS connection but support http proxy and updated to Java 11
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;