Skip to content

Instantly share code, notes, and snippets.

View 641i130's full-sized avatar
🦀
Rewrite it in rust!

Caret 641i130

🦀
Rewrite it in rust!
View GitHub Profile
@641i130
641i130 / main.cpp
Created September 20, 2023 16:06
Simple curl download example
View main.cpp
#include <iostream>
#include <fstream>
#include <curl/curl.h>
// g++ -o test test.cpp -lcurl
// Callback function to write data to a file
size_t WriteCallback(void* contents, size_t size, size_t nmemb, void* userp)
{
size_t totalSize = size * nmemb;
std::ofstream* fileStream = static_cast<std::ofstream*>(userp);
@641i130
641i130 / wallpaper-single-monitor.sh
Created August 19, 2023 05:34
Randomly shuffle over 20 images script
View wallpaper-single-monitor.sh
#!/bin/bash
# Assuming this Wallpapers folder is a nas mount
IMAGE_DIR="/home/user/Wallpapers/cats/"
TMP_DIR="/tmp/wallpapers"
NUM_IMAGES=20
# Create temporary directory if it doesn't exist
mkdir -p $TMP_DIR
# Check if the temporary directory is empty
@641i130
641i130 / README.md
Created August 19, 2023 05:33
Minecraft SSH Port Tunnel
View README.md

MC Port Tunnel SSH Service

Usecase -> not able to port forward in your network.

Assumptions: 12345 is the mc server's port that its opening on the remote server (25565). User mc is the user on the minecraft server. User minecraft is the user on the cloud SSH server.

If you have fail2ban installed, make sure to add the following to /etc/fail2ban/jail.local:

@641i130
641i130 / README.md
Last active June 21, 2023 00:10
Dataset Workflow
View README.md

Dataset Workflow

This assumes you're using a Linux system (or WSL) with modern python3 and sox.

  1. First, download the stream(s) you want to use for the dataset. The requirements are, it must be as clean as possible, and primarily the target voice talking a ton. Streams like Minecraft streams tend to be ideal. (This uses yt-dlp) Use the command below to download the stream(s): yt-dlp -f ba -x --audio-format "wav" --audio-quality 0 --embed-metadata https://youtu.be/omegalul

  2. Once you have the stream, you'll need to split it into multiple files because it's too computationally hard to process a 3 hour stream. Use the command below to split the file based off of the silence it detects. This may result in longer files if the background sounds/music are as loud as the speech in the source. This command assumes the input stream is input.wav: sox -V3 input.wav split.wav silence 1 5.0 0.1% 1 0.3 0.1% : newfile : restart

@641i130
641i130 / main.rs
Created May 30, 2023 20:02
rsa decrypt rust lang example
View main.rs
[package]
name = "rsa-decrypt"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
openssl = "0.10.53"
@641i130
641i130 / Cargo.toml
Created May 29, 2023 05:42
JSON Serialize Aes 128 Cfb Rust Example
View Cargo.toml
[package]
name = "aes-json"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
aes = "0.8.2"
cfb-mode = "0.8.2"
@641i130
641i130 / shuffle.sh
Last active January 13, 2023 00:43
Cycle through multiple wallpaper folders for a proper shuffled feel. Will re-shuffle once it has done a cycle. This was written using ChatGPT and further cleanup by me.
View shuffle.sh
#!/bin/bash
# Directories containing the images for both landscape and portrait
p_pics="$HOME/Pictures/Wallpapers/portrait"
l_pics="$HOME/Pictures/Wallpapers/landscape"
# File to store the shuffled images for both landscape and portrait
p_pics_shuf="$HOME/.p_pics_shuf"
l_pics_shuf="$HOME/.l_pics_shuf"
@641i130
641i130 / wallpaper.sh
Created January 3, 2023 05:36
Set random wallpaper with given folders
View wallpaper.sh
feh --bg-fill "$(find /landscape/images/path/ -regextype posix-extended -regex '.*\.(png|jpg|jpeg)$' -print0 |shuf -z -n 1)" "$(find /portrait/images/path/ -regextype posix-extended -regex '.*\.(png|jpg|jpeg)$' -print0 |shuf -z -n 1)"
@641i130
641i130 / song-sync.sh
Created January 3, 2023 05:35
Sync music folder with android device running SSH
View song-sync.sh
#!/bin/bash
# FOR USE WITH THIS APP:
# https://play.google.com/store/apps/details?id=com.arachnoid.sshelper&gl=US&pli=1
echo "Syncing music dump to phone!!!"
echo "Press enter to continue!"
read
folder_name=$(date +%d%m%Y)
cd /home/rei/ytdl/ && mkdir $folder_name || echo "Folder was made already!!"
mv *.mp3 $folder_name
read -p "Enter IP address: " ip
@641i130
641i130 / Cargo.toml
Created November 7, 2022 18:41
check if ip / port is up as fast as possible
View Cargo.toml
[package]
name = "ip-up"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
port_check = "0.1.5"