This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .... | |
alias sudo="sudo -A" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
NewerOlder