Skip to content

Instantly share code, notes, and snippets.

@lunitrixx
lunitrixx / remove_gui_from_debian.sh
Created May 16, 2025 05:19 — forked from gismo141/remove_gui_from_debian.sh
Remove all GUI-related Packages from Existing Debian-Installation
apt-get remove -y --purge x11-common
apt-get autoremove -y --purge
apt-get install -y deborphan
deborphan | xargs dpkg -P # do this a bunch of times
@lunitrixx
lunitrixx / noinspection.php
Created April 25, 2025 00:47 — forked from gskema/noinspection.php
PhpStorm @noinspection list of all tags
<?php
/** @noinspection ? */
// PhpUndefinedGotoLabelInspection Undefined goto label
// PhpUndefinedVariableInspection Undefined variable
// PhpUndefinedMethodInspection Undefined method
// PhpUndefinedNamespaceInspection Undefined namespace
// PhpUndefinedClassInspection Undefined class
// PhpUndefinedFunctionInspection Undefined function

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@lunitrixx
lunitrixx / delete-thumbnails.php
Created September 19, 2024 08:39 — forked from chandrapatel/delete-thumbnails.php
WP-CLI command to delete all the thumbnails.
<?php
/**
* WP-CLI command to delete all the thumbnails.
*
* Note: First do dry-run, verify log and then do actual run.
*
* @package delete-thumbnails
*/
if ( defined( 'WP_CLI') && WP_CLI ) {
@lunitrixx
lunitrixx / .stglobalignore
Created July 26, 2024 20:21 — forked from jult/.stglobalignore
syncthing ignore file(s) .stglobalignore and .stignore
// .stglobalignore
// These prevent SyncThing from trying to sync data that's locked, constantly changing, going to be thrown out, unimportant, etc.
// Lots of conflicts/issues disappeared using these ignores, but do check to prevent major disappointment!
// *.log and *cache* are in there, just so you know.. but firefox' startupCache and offlineCache will be synced.
// Ignores are case sensitive.
// Put both .stignore and this .stglobalignore in the root of your sync folder(s) (where .stfolder resides)
$RECYCLE.BIN
$WINDOWS.~BT
@lunitrixx
lunitrixx / csp-mu-plugin.php
Created July 14, 2024 20:15 — forked from joshuafredrickson/csp-mu-plugin.php
Add CSP to WordPress, including nonces for inline scripts
<?php
/**
* Plugin Name: Content Security Policy
* Version: 1.0.0
* Description: Adds a Content-Security-Policy header to all non-admin requests.
* License: GNU General Public License v2
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Original Inspiration: https://gist.github.com/westonruter/c8b49406391a8d86a5864fb41a523ae9
*/
@lunitrixx
lunitrixx / nonce.php
Created July 14, 2024 20:13 — forked from johanguse/nonce.php
Add nonce to script and styles on WordPress
add_action( 'template_redirect', function () {
ob_start( function ( $output ) {
$nonces = [];
$output = preg_replace_callback( '#<script.*?\>#', function ( $matches ) use ( &$nonces ) {
$nonce = wp_create_nonce( $matches[0] );
$nonces[] = $nonce;
@lunitrixx
lunitrixx / docker-compose.yml
Created July 12, 2024 05:36 — forked from benoitpetit/docker-compose.yml
complete Gitlab installation and a runner with docker
version: '4.5'
services:
# GITLAB
gitlab-web:
image: 'gitlab/gitlab-ce:latest'
restart: always
container_name: gitlab-web
hostname: '192.168.0.14'
environment:
@lunitrixx
lunitrixx / macos-bitwarden-cli-ssh.md
Created July 11, 2024 05:41 — forked from mietzen/macos-bitwarden-cli-ssh.md
How to use use Bitwarden CLI for SSH-Keys in macOS

How to use use Bitwarden CLI for SSH-Keys in macOS

If you want to use Touch ID have a look at: How to use use Bitwarden CLI with macOS Touch ID

Wirtten and tested on macOS Ventura

Add SSH-Keys to Bitwarden

Before you can use Bitwarden CLI for your SSH private keys you have to add them to your Bitwarden account. Just create a normal login. The name, username and URI fields doesn't matter for my functions.

@lunitrixx
lunitrixx / zfs_cleanup.sh
Created May 19, 2024 19:52 — forked from jstutters/zfs_cleanup.sh
Find and delete multiple ZFS snapshots
zfs list -t snapshot -H -o name | grep "201509[0-9].*" | xargs -n1 echo
# zfs list -t snapshot -H -o name | grep "201509[0-9].*" | xargs -n1 zfs destroy