Skip to content

Instantly share code, notes, and snippets.

@piotrkochan
piotrkochan / Makefile
Last active August 21, 2019 19:37
Simple Makefile which builds Symfony 4 App and make it easier to deploy via FTP or similar method.
DIST = dist
clean:
rm -rf $(DIST)/
mkdir $(DIST)/
copy:
cp -r assets bin config src templates tests translations $(DIST)/
cp composer.json composer.lock package.json symfony.lock yarn.lock $(DIST)/
cp webpack.config.js $(DIST)/
@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
@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.
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 / 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"
#
# INPUT - Logstash listens on port 8514 for these logs.
#
input {
udp {
port => "8514"
type => "syslog-cisco"
}
@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
@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 / 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.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