Skip to content

Instantly share code, notes, and snippets.

View danielbene's full-sized avatar

Dániel Bene danielbene

  • Hungary
View GitHub Profile
@danielbene
danielbene / run_backup.bat
Last active May 7, 2023 15:33
Windows backup script with restic and rclone to a Backblaze B2.
@echo off
setlocal
: --------------------------------------------------
: Avoiding the built in B2 backend according to the docs, and I could not make pruning work with the S3 api (lifecycle delete rule did absolutely nothing).
: It's a bit clunky, but wokrs for me. Check this for more info: https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html#backblaze-b2.
: You have to create the bucket and initialize the repository before running the script.
: --------------------------------------------------
@danielbene
danielbene / pop-os_shortcuts.ahk
Last active August 23, 2022 15:37
AHK implementation of Pop_OS hotkeys (with extras)
#SingleInstance, Force
SendMode Input
SetWorkingDir, %A_ScriptDir%
#F::
Run, Explorer
return
#S::
ComplexRunner("Code.exe", "C:\path\to\Code.exe")
@danielbene
danielbene / fingerprint.sh
Last active October 15, 2021 14:13
TLS fingerprint generation on linux (eg for esp8266 https connections)
#!/bin/bash
url="raw.githubusercontent.com"
echo "$(openssl s_client -connect $url:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'| openssl x509 -noout -fingerprint -sha1)" | sed "s/:/ /g"
@danielbene
danielbene / nas_free_discord.py
Created July 25, 2021 10:14
Reporting NAS drive free space after server startup via discord messages.
# automate reporting after homlab starts with below cronjob:
# @reboot sleep 60 && python3 <path_to_script>
import logging
import requests
import shutil
from datetime import datetime
target = '<mount_path>'
ts_format = '%Y.%m.%d %H:%M:%S'
@danielbene
danielbene / vlc_build_steps
Last active September 24, 2021 04:57
VLC 3.x cross-compilation steps in 2020 Q4
I had to build VLC 3.x from src, and the below steps was the only way that I could achieve this in late 2020.
After many hours, I faced the problem that most of the tutorials out there are so outdated that they just cant work nowdays.
I builded it for Windows x64, on a Pop_os 20.04 VM using a builder container.
I don't know if it works with dev or not, and I can't even trust it to work after like half year, but here it is.
Tip: check build.sh manual for options.
BUILD STEPS:
1. install docker (https://gist.github.com/danielbene/98d7a5b08fd5c2c18d4883f250e4b6c6)
2. cd ~
3. mkdir win64
@danielbene
danielbene / mysql-docker.sh
Created September 9, 2020 15:56 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@danielbene
danielbene / docker_install.sh
Last active November 18, 2023 19:20
Docker install script for linux.
#!/bin/bash
DIST_BASE="ubuntu"
apt update
apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/$DIST_BASE/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
@danielbene
danielbene / sublime_install.sh
Created January 5, 2020 18:19
Sublime-text install script for linux.
#!/bin/bash
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
apt-get update
apt-get install sublime-text