Skip to content

Instantly share code, notes, and snippets.

View slashtechno's full-sized avatar
🚀
Floating through space 🌌 🌎

slashtechno

🚀
Floating through space 🌌 🌎
View GitHub Profile
@slashtechno
slashtechno / Dockerfile.devenv
Last active August 21, 2023 00:20
Dockerfile to create a Ubuntu container with zsh and shellinabox
# docker build --file Dockerfile-devenv.txt -t devenv .
# docker run -it --name devenv -p 4200:4200 -d devenv zsh
FROM ubuntu:latest
ARG USERNAME=user
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
@slashtechno
slashtechno / README.md
Last active September 18, 2022 17:01
HTML meant to be set as a redirect URI for OAuth2 in order to display the authorization code

OAuth Code Viewer

A simple website to extract the code from an OAuth2 callback.
If state exists, output the URL instead

from python_on_whales import docker
output = docker.run(image="ubuntu", detach=True, tty=True, interactive=True, publish=[(80, 80), (8080, 8080)], name = "hello", remove=True)
# Both are equal
print(output)
print(docker.container.inspect(output))
docker.container.execute(container = output, command = "bash", tty=True, interactive=True)
docker.container.remove(output, force=True)
@slashtechno
slashtechno / .vimrc
Created June 19, 2022 23:09
Prevent Vim from creating backup files in the working directory
set backupdir=$HOME/vimfiles/tmp/
set undodir=$HOME/temp/vimfiles/tmp/
@slashtechno
slashtechno / crossCompileGo.sh
Last active June 16, 2022 20:57
Script to cross compile a Go file
#!/usr/bin/bash
# Edited code from https://opensource.com/article/21/1/go-cross-compiling
# xgo (https://github.com/techknowlogick/xgo) is a better solution for programs which use more than one Go file
archsLinux=(amd64 arm64 arm)
archsWindows=(amd64 arm arm64 386)
programName=
for arch in ${archsLinux[@]}
do
env GOOS=linux GOARCH=${arch} go build -o ../binaries/${programName}_linux_${arch} main.go
@slashtechno
slashtechno / alias-change-directory.sh
Created May 14, 2022 19:16
Function to quickly change to a specific directory in a drive (bash, zsh, etc)
x() {
cd /media/<user>/<drive>/"${1:-}"
}
@slashtechno
slashtechno / install_rpiplay.sh
Created December 29, 2021 00:12
RpiPlay install script for Raspberry Pi OS Bullseye
git clone https://github.com/FD-/RPiPlay.git
cd RPiPlay
sudo apt-get install cmake -y
sudo apt-get install libavahi-compat-libdnssd-dev -y
sudo apt-get install libplist-dev -y
sudo apt-get install libssl-dev -y
sudo apt-get install libx264-dev libjpeg-dev -y
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-tools gstreamer1.0-gl gstreamer1.0-gtk3 --fix-missing -y
mkdir build
@slashtechno
slashtechno / mc-server.service
Last active May 1, 2022 21:18
systemd service to run MC server
[Unit]
Description= minecraft server service
[Service]
User=pi
WorkingDirectory=/home/pi/minecraft-servers/survival-1.18.2
ExecStart=/usr/bin/java -Xms512M -Xmx2048M -jar /home/pi/minecraft-servers/survival-1.18.2/spigot-1.18.2.jar nogui
[Install]
WantedBy=multi-user.target
@slashtechno
slashtechno / simple-service.service
Created November 7, 2021 16:18
Simple Systemd Script
# How to create systemd services: http://neilwebber.com/notes/2016/02/10/making-a-simple-systemd-file-for-raspberry-pi-jessie/
[Unit]
Description= Hello, world!
[Service]
User= <put user here>
WorkingDirectory=<put directory the command should be run in>
ExecStart=<path to command>
[Install]
WantedBy=multi-user.target
@slashtechno
slashtechno / mc-server-install.sh
Last active October 17, 2021 22:49
Minecraft Server install script (tested on Pi 4, 4gb ram)
#!/bin/bash
mkdir minecraft
cd minecraft
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
# java -Xmx1024M -jar BuildTools.jar for the latest version
java -Xmx2024M -jar BuildTools.jar --rev 1.16.5 #java -Xmx1024M -jar BuildTools.jar --rev 1.16.5
java -Xms512M -Xmx2024M -jar minecraft/spigot* nogui #java -Xms512M -Xmx2016M -jar minecraft/spigot* nogui
rm eula.txt
wget https://gist.githubusercontent.com/slashtechno/7fc6225d3b0023a7b1be7da49e0ca4ce/raw/1ec68a713c7ff8a336d1cc5ad683e80a3ca20b9b/eula.txt
echo run "java -Xms512M -Xmx20242M -jar spigot* nogui" inside the directory "minecraft" to run the server # java -Xms512M -Xmx2016M -jar spigot* nogui