Skip to content

Instantly share code, notes, and snippets.

View radamhu's full-sized avatar
🎯
Focusing

Ádám Roland radamhu

🎯
Focusing
View GitHub Profile
import json
from typing import List
def run(args: List[str]):
filename = args[0]
with open(filename, "r") as f:
data = json.loads(f.read())
original_entries = data['items']
#!/bin/bash
# source : https://www.howtogeek.com/442332/how-to-work-with-variables-in-bash/
echo "There were $# command line parameters"
echo "They are: $@"
echo "Parameter 1 is: $1"
echo "The script is called: $0"
# any old process so that we can report on the exit status
pwd
echo "pwd returned $?"
@radamhu
radamhu / wsl2-network.ps1
Last active July 28, 2022 05:18 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
@radamhu
radamhu / ansible-find-filenames.yml
Created June 24, 2022 19:24 — forked from Finkregh/ansible-find-filenames.yml
ansible: get files from directory - only names without path
- name: "get files from dir"
find:
paths: "/some/dir/foo"
register: found_files
- name: print file names without path
debug:
msg: "{{ found_files['files'] | map(attribute='path') | map('regex_replace','^.*/(.*)$','\\1') | list }}"
@radamhu
radamhu / dailyBackupMySQL.sh
Last active July 15, 2022 14:16 — forked from AlexPashley/dailyBackup.sh
SHELL: Simple Shell Script to create database backups
# Backup mysql databases into seperate files
USER="mysql-username"
PASSWORD="mysql-password"
OUTPUTDIR="/path/to/db/backup/dir"
MYSQLDUMP="/usr/bin/mysqldump"
MYSQL="/usr/bin/mysql"
NOW=$(date +"%m-%d-%Y")
MSG="Just to let you know that a full backup of db has been made onto the VPS.Kind Regards"
# Remove previous backups
@radamhu
radamhu / linux_screen_cheatsheat.txt
Created February 17, 2022 05:49
linux_screen_cheatsheat
* SSH with Putty to RaspberryPi
- sudo apt-get install screen
- screen -t SSH2Syno
- ssh -l admin synohostname -p 44344 ( I use a different port than the industry standard of 22 - for security purposes )
* Now, you're terminal is what you're doing on the Synology
- do what commands you wish
- Ctrl-A Ctrl-D (to detach - put screen in background)
* Now you're back on the Raspberry Pi
# $credentials="<github_access_token>"
$repo = "fusioninventory/fusioninventory-agent"
$file = "fusioninventory-agent_windows-x64_*.exe"
$latestRelease = Invoke-WebRequest https://github.com/$repo/releases/latest -Headers @{"Accept"="application/json"}
$json = $latestRelease.Content | ConvertFrom-Json
$latestVersion = $json.tag_name
$latestVersionFile = "fusioninventory-agent_windows-x64_$latestVersion.exe"
@radamhu
radamhu / synology-blocklist-update
Created April 7, 2021 08:00 — forked from olbat/synology-blocklist-update
Synology DonwloadStation blocklist update script
#!/bin/bash
set -euo pipefail
BLOCKLIST_URL='https://list.iblocklist.com/?list=bt_level1&fileformat=p2p&archiveformat=gz'
BLOCKLIST_FILE=/var/packages/DownloadStation/etc/download/blocklists/level1
echo "Clean old blocklist"
rm -f $(dirname $BLOCKLIST_FILE)/*
echo "Download new blocklist"
@radamhu
radamhu / gist:5fe6f0b8980f530dd29e7045e77bcbed
Last active September 6, 2020 08:44 — forked from okor/gist:4236979
Git Cheat Sheet

lazygit "My commit msg"

function lazygit() {
    git add .
    git commit -a -m "$1"
    git push
}

How do I reduce the pack file size?

@radamhu
radamhu / stars
Created July 17, 2020 09:07 — forked from kensoh/stars
TagUI flow to print the list of your starred repos
// created this flow file to archive my starred repos
// it prints the list of starred repos by github user
// you can get TagUI here (macOS / Windows / Linux)
// https://github.com/kelaberetiv/TagUI#set-up
// usage #1 - copy or download this file, then run
// tagui stars github_userid quiet chrome
// usage #2 - if you want to run this gist directly