Skip to content

Instantly share code, notes, and snippets.

@piotrkochan
piotrkochan / sync.ps1
Created July 2, 2024 17:07
Chocolatey - sync packages with github gist
# Chocolatey Package Export Script
# Get the list of installed Chocolatey packages
$chocoList = choco list --local-only --limit-output
$packageList = $chocoList -join "`n"
# GitHub Personal Access Token (replace with your own)
# https://github.com/settings/tokens?type=beta
$token = "xxxxx"
@piotrkochan
piotrkochan / choco-packages.txt
Last active September 1, 2024 18:05
chocolatey list
7zip|24.7.0
7zip.install|24.7.0
altdrag|1.461.0
androidstudio|2024.1.1.11
autodesk-fusion360|2.0.19440
bitwarden|2024.8.1
brave|1.67.123
chocolatey|2.3.0
chocolatey-compatibility.extension|1.0.0
chocolatey-core.extension|1.4.0
@piotrkochan
piotrkochan / shred.ps
Created March 9, 2023 18:48
start virtualbox hdd shred image with hdd selector
$vm_name = "shred"
$iso_path = "C:\...\shredos-2021.08.2_23_x86-64_0.34_20221231.iso"
$directory = "C:\...\VirtualBox VMs\shred\vmdks"
# Stop the virtual machine if it's running
if ((VBoxManage.exe showvminfo $vm_name | Select-String 'State' | Select-String 'running') -ne $null) {
VBoxManage.exe controlvm $vm_name poweroff -forc
}
# Remove all existing VMDK files from the directory
@piotrkochan
piotrkochan / how.sh
Created December 6, 2022 20:32
Synology - Docker Macvlan network
docker network create -d macvlan \
--subnet=192.168.30.0/24 \
--ip-range=192.168.30.192/28 \
--gateway=192.168.30.1 -o parent=ovs_eth1 \
mymacvlan0
docker network connect mymacvlan0 mycontainer
@piotrkochan
piotrkochan / main.yml
Created November 19, 2022 22:53
Ansible random string
- set_fact:
rand_str: "{{ lookup('password', '/dev/null chars=ascii_lowercase,digits length=8') }}"
@piotrkochan
piotrkochan / How to.md
Last active November 11, 2022 17:23
Synology admin account activation (to re-enable DSM access)

In some cases you may loose DSM access. To fix that enable admin account, login to DSM, assign new permissions.

ash-4.4# synouser --modify admin "admin" 0 [email protected]
ash-4.4# synouser --setpw admin <password>

Remember to deactivate admin account later.

@piotrkochan
piotrkochan / uuid.sh
Created July 29, 2022 22:36
Virtual machine, vbox, virtualbox machine id regenerate
rm -f /etc/machine-id
rm /var/lib/dbus/machine-id
dbus-uuidgen --ensure=/etc/machine-id
dbus-uuidgen --ensure
#
# INPUT - Logstash listens on port 8514 for these logs.
#
input {
udp {
port => "8514"
type => "syslog-cisco"
}
@piotrkochan
piotrkochan / Generate
Created March 28, 2022 13:33
Generate SSH key with yubikey
ssh-keygen -t ed25519-sk -i ~/.ssh/id_ed25519_sk_yb1 -C "$(hostname)-$(date +'%d-%m-%Y')-yubikey1"
ssh-keygen -t ed25519-sk -i ~/.ssh/id_ed25519_sk_yb2 -C "$(hostname)-$(date +'%d-%m-%Y')-yubikey2"
var fs = require('graceful-fs');
var path = require('path');
var pmx = require('pmx');
var pm2 = require('pm2');
var moment = require('moment-timezone');
var scheduler = require('node-schedule');
var zlib = require('zlib');
var conf = pmx.initModule({
widget : {