Skip to content

Instantly share code, notes, and snippets.

View psolru's full-sized avatar
No Coffee No Life

Patrick Krems psolru

No Coffee No Life
View GitHub Profile
@psolru
psolru / cli-parser.sh
Last active July 9, 2022 21:29
Little bash CLI "parser"
#!/bin/bash
FOO="foooo"
BAR="baaaaar"
BAZ="baaaazzz"
function help() {
echo "A command-line interface for foo, bar and baz."
echo
echo "Example Usage:"
@psolru
psolru / docker-compose.yml
Created May 4, 2022 23:23
Docker volume CIFS mount example w/ symlink support
---
version: "3.0"
services:
web:
image: some-image
volumes:
- cifs_share:/mnt/cifs_share
volumes:
cifs_share:
driver: local
@psolru
psolru / foobar.ps1
Last active March 25, 2023 16:45
Quick and dirty powershell (5.1) snippet to create a service for windows exporter in windows10
// remove service
($service = Get-WmiObject -Class Win32_Service -Filter "Name='Windows Exporter'") -and ($service.Delete())
// add service
New-Service -Name "Windows Exporter" -BinaryPathName '"C:\Program Files (x86)\WindowsExporter\windows_exporter.exe" --web.listen-address ":9200" --collectors.enabled "ad,adcs,adfs,cache,cpu,cpu_info,cs,container,dfsr,dhcp,dns,exchange,fsrmquota,hyperv,iis,logical_disk,logon,memory,msmq,mssql,netframework_clrexceptions,netframework_clrinterop,netframework_clrjit,netframework_clrloading,netframework_clrlocksandthreads,netframework_clrmemory,netframework_clrremoting,netframework_clrsecurity,net,os,process,remote_fx,service,smtp,system,tcp,time,thermalzone,terminal_services,textfile,vmware"'
@psolru
psolru / nmcli_create_hetzner_subnet_vswitch_bridge.sh
Last active January 1, 2024 12:38
Add network bridge to Hetzner VSwitch public subnet (VLAN) via NetworkManager on CentOS 8
# Add your real IPv4 subnet settings here
IPV4=X.X.X.X
CIDR=X.X.X.X/28
GATEWAY=X.X.X.X
DNS=1.1.1.1
# Add your real Interface settings here
INTERFACE_NAME="enp2s0"
VLAN_ID=4000
VLAN_INTERFACE_NAME="$INTERFACE_NAME.$VLAN_ID"
@psolru
psolru / README.md
Last active April 23, 2021 16:02
Openstack ussuri installation guide - basically just a reminder for me, but if you find it useful have fun ^^

Disable NetworkManager

systemctl disable --now NetworkManager

Check if NetworkManager is disabled (all of them)

systemctl list-unit-files | grep NetworkManager

Install network-scripts

yum install network-scripts -y

If dns resolving fails: Setup some nameserver and try install again

@psolru
psolru / README.md
Last active January 24, 2023 20:27
Setup Yubikey

Setup for SSH

  • Plug in the Yubikey 5 Nano and fire up the terminal.

gpg2 --edit-card
admin
key-attr

  • each "RSA" and "4096"

generate Make off-card backup of encryption key? n

  • Type in the USER default PIN: 123456
Vue.component("chosen-select",{
props: ['value', 'multiple'],
template:'<select :multiple="multiple"><slot></slot></select>',
mounted() {
var that = this
$(this.$el)
.val(this.value)
.chosen({ width: "100%" })
.on("change", function(e) {
that.$emit('input', $(that.$el).val())
@psolru
psolru / new_temp.sh
Created October 24, 2019 15:29
creating temp-directory - i use it as a starter in the whisker menu under xubuntu
#!/usr/bin/php
<?php
function tempName($ext='') {
$chars = 'qwertzuiopasdfghjklyxcvbnmQWERTZUIOPASDFGHJKLYXCVBNM1234567890';
$cl = strlen($chars);
$l = 30;
do {
@psolru
psolru / clear_temp.sh
Created October 24, 2019 15:26
quick and dirty php script for some interval clean up
#!/usr/bin/php
<?php
chdir(__DIR__);
function se($str) {
$str = preg_replace('/[\\x0-\\x1F]/', '', $str);
$str = preg_replace('/\\x7F/', '', $str);
$str = str_replace("'", '\'"\'"\'', $str);
return "'".$str."'";
@psolru
psolru / clear_recursive.php
Last active March 23, 2020 11:21
Clear directory recursive in php - low memory consumption (big directories)
<?php
function clearDirectoryRecursive($dir) {
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry == '.' || $entry == '..')
continue;
echo $entry."\n";
if (is_dir($dir.'/'.$entry)) {