Skip to content

Instantly share code, notes, and snippets.

@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@email.com
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 : {
@piotrkochan
piotrkochan / cleanup_docker.sh
Created October 8, 2020 06:43 — forked from ralphtheninja/cleanup_docker.sh
Cleanup and reset docker on Jenkins workers / slaves
#!/bin/bash
# This script should be located on each Jenkins slave, and the jenkins user should have permission to run it with sudo
# Attempts to cleanly stop and remove all containers, volumes and images.
docker ps -q | xargs --no-run-if-empty docker stop
docker ps -q -a | xargs --no-run-if-empty docker rm --force --volumes
docker volume ls -q | xargs --no-run-if-empty docker volume rm
docker images -a -q | xargs --no-run-if-empty docker rmi -f
# Stops the docker service, unmounts all docker-related mounts, removes the entire docker directory, and starts docker again.
@piotrkochan
piotrkochan / Win10KeyFinder.vbs
Created May 29, 2020 19:35
Find Windows 10 Key with ease
' got from https://www.techspot.com/articles-info/1760/images/Win10KeyFinder.txt
Option Explicit
Dim objshell,path,DigitalID, Result
Set objshell = CreateObject("WScript.Shell")
'Set registry key path
Path = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Registry key value
DigitalID = objshell.RegRead(Path & "DigitalProductId")
Dim ProductName,ProductID,ProductKey,ProductData