Skip to content

Instantly share code, notes, and snippets.

View DaWe35's full-sized avatar

DaWe DaWe35

View GitHub Profile
@DaWe35
DaWe35 / srt_to_txt.sh
Created October 14, 2024 07:43
SRT to TXT converter (removes lines 1, 2, 4)
#!/bin/bash
# Input and output files
input_file="input.txt"
output_file="output.txt"
# Initialize line counter
line_counter=0
# Remove output file if it exists
@DaWe35
DaWe35 / keygen.js
Created October 1, 2024 15:13
Generate Ethereum Wallet with NodeJS
const ethers = require('ethers');
function generateEthereumKeyPair() {
// Generate a random wallet
const wallet = ethers.Wallet.createRandom();
// Get the private key
const privateKey = wallet.privateKey;
// Get the public key
@DaWe35
DaWe35 / play.sh
Created July 31, 2024 14:22
Play random songs from a folder with VLC
#!/bin/bash
# Directory containing your music files
# It will NOT search subfolders, you can change that by removing -maxdepth 1
MUSIC_DIR="/you/music/folder"
# Number of random songs to play
NUM_SONGS=100
# Check if VLC is installed

Download Backblaze snapshot to remote with cURL cli.

Since the download URL is only accessible if you are signed in, and accessing the snapshot with s3 is also not possible for some reason, your only option is to make a request to the download URL with the same authentication headers you have on your personal computer. In this example we'll copy the whole download request as a cURL command from the Chrome inspector:

  1. Log in to Backblaze in your browser, and head to the Snapshots page.

  2. Open the inspector (F12) and go to the "network" tab.

  3. Start downloading the file (you can cancel it immediately)

@DaWe35
DaWe35 / stable-diffusion-gc.md
Created March 3, 2024 03:43
Stable diffusion setup on Google Cloud Instances

Install

  • Get a Gcloud instance with GPU and Debian 12 (spot instances are cheaper but can be interrupted)

  • Add a VPC firewall rule to enable 7860 port. Add this rule to the Compute Instance (edit -> networking)

  • Open a screen: screen. It is always a good idea to use screen, because if the connection interrupts, it will preserve the opened process. Next time when you connect, type screen -r to reopen or screen -rd to force reopen after an interruption.

  • Install and verify GPU driver:

@DaWe35
DaWe35 / monerod-sync.md
Last active November 6, 2024 19:13
Monero sync modes

Sync modes

Full node

Download, verify, and store the whole blockchain

monerod --fast-block-sync=0

Fast sync

@DaWe35
DaWe35 / ssh-push.txt
Created January 17, 2024 06:17
Git push with SSH key
# generate an SSH key pair
cd repository
git config --add --local core.sshCommand 'ssh -i /home/user/.ssh/ssh_key'
git push
@DaWe35
DaWe35 / SCP and rsync commands.md
Last active July 10, 2023 13:55
SCP and rsync commands

Copy local file to remote server using SSH key

rsync --compress --archive --partial --append-verify --verbose --progress -e "ssh -i ~/SSH_KEY" LOCAL_FILE.zip REMOTE_USER@REMOTE_IP:REMOTE_FILE.zip

scp -i ~/SSH_KEY LOCAL_FILE REMOTE_USER@REMOTE_IP:REMOTE_FILE.zip

@DaWe35
DaWe35 / Win11-context.md
Last active February 15, 2023 12:50
Windows 11 new context menu customization

If you like the design and the speed of the new context menu, but you find it useless, I have good news for you: you can customize it and make the new Win11 context more personalized.

Remove unused items

To remove unused items, you must remove items from the registry. You'll find some items in these folders, but you can also search for specific items you see in the context menu.

HKEY_CLASSES_ROOT\Folder\shell\ (Do NOT remove opennewwindow - it is required for file explorer to work on your windows tray.)

HKEY_CLASSES_ROOT\exefile\shellex\ContextMenuHandlers\

@DaWe35
DaWe35 / Debug metamask communications.js
Last active June 8, 2022 23:01
Open a web3 webpage, open console and enter this listener so it will log the communication between the site and Metamask.
onmessage = event => {
console.error('Metamask:', event.data.data.data)
}