Skip to content

Instantly share code, notes, and snippets.

View gfrn's full-sized avatar
🏁

Guilherme Francisco gfrn

🏁
View GitHub Profile
@gfrn
gfrn / beamng-config-update.sh
Last active May 27, 2023 10:45
Move config from previous BeamNG version to new version
#!/usr/bin/env bash
steam_folder="$HOME/.steam"
beamng_folder="steam/steamapps/compatdata/284160/pfx/drive_c/users/steamuser/AppData/Local/BeamNG.drive"
echo "Searching for BeamNG versions in ${steam_folder}/${beamng_folder}"
versions=($(ls "${steam_folder}/${beamng_folder}/" | grep -E '([0-9]{1,}\.)+[0-9]{1,}' | sort -r))
settings_target="${steam_folder}/${beamng_folder}/${versions[0]}/settings"
@gfrn
gfrn / irq.sh
Created March 25, 2022 16:09
Bind all IRQs to CPU 1
#!/bin/bash
for D in /proc/irq/*; do
if [ -d "${D}" ]; then
echo Updating ${D}...
echo 2 > ${D}/smp_affinity
cd ..
fi
done
@gfrn
gfrn / clean_up.sh
Last active March 25, 2022 17:08
Clean up Beaglebone AI (IoT image)
apt remove bonescript c9-core-installer nginx nodejs nodejs-doc npm \
bb-node-red-installer alsa-utils pastebinit nginx-full nginx-common \
bone101 mjpg-streamer javascript-common bluealsa
rm -rf /opt/cloud9/ /var/lib/cloud9/
systemctl disable bb-bbai-tether.service
systemctl disable bb-wl18xx-bluetooth.service
sed -i "s/TETHER_ENABLED=.*/TETHER_ENABLED=no/g" /etc/default/bb-wl18xx
@gfrn
gfrn / truncate.sh
Last active February 16, 2022 15:43
Shrink disk image by removing unused space
modprobe loop
losetup -f
losetup /dev/loop0 image.img
partprobe /dev/loop0
gparted /dev/loop0
fdisk -l /dev/loop0
truncate --size=$[(XXX+1)*512] image.img
losetup -d /dev/loop0
@gfrn
gfrn / discover.sh
Created November 20, 2021 18:11
Get possible IPs for new devices in network
#!/bin/bash
read -p "Enter your network mask: "
IP=${REPLY}
OLD=$(nmap -sn $IP | grep 'Nmap scan report for' | cut -f 5 -d ' ')
read -n 1 -p "Plug in the device and press enter"
NEW=$(nmap -sn $IP | grep 'Nmap scan report for' | cut -f 5 -d ' ')
echo Possible IPs:
@gfrn
gfrn / so_scrapers.txt
Last active April 28, 2022 13:51
Stack Overflow scrapers
en.stackoom.com
fix.code-error.com
progexpertos.com
techinplanet.com
www.ti-enxame.com
www.xszz.org
exceptionshub.com
www.thetopsites.net
www.titanwolf.org
flutterq.com
@gfrn
gfrn / spot_dl_youtube_dl.py
Created July 22, 2021 00:56
Download all songs from a spotdl output file using youtube-dl
import ast
import youtube_dl
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
@gfrn
gfrn / userChrome.css
Created June 3, 2021 01:29
Make the "playing audio" icon on Firefox Proton smaller
.tab-icon-sound {
width: 12px !important;
height: 12px !important;
}
@gfrn
gfrn / anonymous_msg.py
Created May 29, 2021 17:17
Discord bot that relays messages to users anonymously
import discord
from discord.ext import commands
import os
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='$', intents=intents)
@bot.command()
@gfrn
gfrn / monitor.py
Created April 3, 2021 17:59
Script to monitor changes in position availability lists in education for the Minas Gerais state
from bs4 import BeautifulSoup
from time import sleep
from telegram.ext import Updater
import requests
old_openings = []
updater = Updater("TOKEN", use_context=True)
while True:
s = requests.Session()