Skip to content

Instantly share code, notes, and snippets.

View DaWe35's full-sized avatar

DaWe DaWe35

View GitHub Profile

Source: https://www.thomasmartens.eu/contabo-dns-lookup-timeouts/

I got a ton of getaddrinfo EAI_AGAIN (alpine) and getaddrinfo ENOTFOUND (debian) errors in my nodejs app, running in docker. Also sometimes curl fails with curl: (6) Could not resolve host: ...

Turns out contabo DNS servers are unreliable.

  1. Check default DNS servers: resolvectl status | grep 'DNS Servers' -A2 or cat /etc/resolv.conf

Steps to install and use a model in Ollama with Open WebUI in Docker:

  1. Run Ollama container:

    docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
  2. Run Open Web UI container:

@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
Last active November 27, 2024 22:09
Git push with SSH key
# useful for aur arch
# 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 January 7, 2025 23:32
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