Skip to content

Instantly share code, notes, and snippets.

Avatar
👋
Learning new things

Rmly Rmlyy

👋
Learning new things
View GitHub Profile
@Rmlyy
Rmlyy / install-discord
Created Apr 24, 2022
Script to install Discord on Debian 11
View install-discord
#!/bin/bash
if [ $EUID -ne 0 ]
then
echo "This script must be run as root"
exit
fi
if ! grep -q 11 '/etc/debian_version'
then
@Rmlyy
Rmlyy / ddns
Created Mar 12, 2022
Minimal Cloudflare Dynamic DNS
View ddns
#!/bin/bash
ip=$(curl -s myipv4.r0.al)
date=$(date +'[%m.%d.%Y %r]:')
api_key=""
zone_id=""
dns_identifier=""
name=""
curl -s -f -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records/$dns_identifier" \
-H "Authorization: Bearer $api_key" \
@Rmlyy
Rmlyy / game.py
Created Jan 31, 2022
Guessing game in Python
View game.py
from random import randint
min = 1
max = 10
number = randint(min, max)
tries = 1
while True:
print(f'Try {tries}')
answer = input(f'Guess the number between {min} and {max}: ')
@Rmlyy
Rmlyy / brightness
Created Dec 17, 2021
Change screen brightness by 10%
View brightness
#!/bin/sh
brightness="/sys/class/backlight/intel_backlight/brightness"
current=$(cat $brightness)
if [ $1 -eq 0 ]; then
new=$(( current + 10000 ))
else
new=$(( current - 10000 ))
fi
@Rmlyy
Rmlyy / allow.sh
Created Nov 19, 2021
Allow connections on port 80 from Cloudflare
View allow.sh
#!/bin/sh
for ip in $(curl -s https://www.cloudflare.com/ips-v4)
do
sudo ufw allow from $ip to any port 80 proto tcp
done
@Rmlyy
Rmlyy / start.sh
Created Jul 12, 2021
Auto-restart shell script
View start.sh
#!/bin/sh
while true
do
java -Xms512M -Xmx512M -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -jar waterfall.jar
for s in 5 4 3 2 1
do
echo "Restarting in ${s} second(s)..."
sleep 1
done
@Rmlyy
Rmlyy / screenshot
Last active Mar 24, 2022
Flameshot upload script
View screenshot
#!/bin/bash
# Base: https://github.com/notmeta/flameshot-s3-uploader
url="url"
key="secretkey"
temp_file="/tmp/screenshot.png"
flameshot gui -r > $temp_file
if [[ $(file --mime-type -b $temp_file) != "image/png" ]]; then
rm -rf $temp_file
@Rmlyy
Rmlyy / upload
Created Jun 20, 2021
Command line upload script
View upload
#!/bin/bash
file=$1
if [[ -z $1 ]]; then
echo "Please specify a file."
exit
fi
if [[ ! -f "$file" ]]; then
echo "$file does not exist."