Skip to content

Instantly share code, notes, and snippets.

View kwmiebach's full-sized avatar

kwmiebach kwmiebach

View GitHub Profile
@kwmiebach
kwmiebach / Makefile
Last active January 1, 2025 16:05
Demo Makefile: 'Make help' with awk. Targets source .env and pass vars to docker compose. Vars are escaped with '$$'. Instructions: save and run 'make help'.
.PHONY: help
help:
# Keep this comment line, it is imortant so awk ignores the help target.
@echo "Available targets:"
@echo " help\t\t Show this help message"
@awk '/^[^.][a-zA-Z0-9_-]+:/{t=$$1;getline;if($$0~"@echo"){gsub(/^[^"]*"|".*$$/,"",$$0);printf " %-20s %s\n",substr(t,1,length(t)-1),$$0}}' $(MAKEFILE_LIST)
.PHONY: it
it:
@echo "Start bash in the container as user 1000"
@kwmiebach
kwmiebach / v17.css
Created December 18, 2024 12:42
Styles V17
/* chrome n3 */
a.fw-bold.text-truncate {
font-size: 30px
}
span.min-w-0.text-truncate {
font-size: 30px
}
@kwmiebach
kwmiebach / addkeys.sh
Last active January 11, 2025 01:45
Add public keys for a user to ~/.ssh/authorized_keys
#!/bin/bash
# GitHub SSH Key Updater
# ---------------------
# SECURITY WARNING: This script grants SSH access to your machine!
# Only add keys from GitHub users you absolutely trust with full SSH access to your system.
# Each added public key will allow that user to log into your machine via SSH.
#
# Purpose:
# Fetches and merges public SSH keys from a GitHub user into your ~/.ssh/authorized_keys file,
@kwmiebach
kwmiebach / make-system-folder.cmd
Last active January 1, 2025 15:29
Create a `Windows Master Control Panel' / 'All Tasks Folder on the Desktop'. The so called 'god mode '
@echo off
cd %USERPROFILE%\Desktop
mkdir "system.{ED7BA470-8E54-465E-825C-99712043E01C}"
@kwmiebach
kwmiebach / smnetscanner.sh
Last active January 1, 2025 15:30
If you can't use angryipscanner from a command line
#!/bin/bash
# (c) CompuMatter, LLC, ServerMatter
# no warranty expressed or implied - use as is.
# See https://www.youtube.com/watch?v=4hjskxkapYo
# versioned here: https://gist.github.com/kwmiebach/6565ad1b43f3c781b23fce6ba80f59ea
# history of the gist:
# 2023-09-28 downloaded from https://cloud.compumatter.biz/s/fxfYM9SkamBtGqG - unchanged
# purpose of this script:
@kwmiebach
kwmiebach / get_toml_value.sh
Last active January 1, 2025 15:30
Read values from a simple toml file in bash
#######################################################################################
# Bash function get_toml_value() to get the value of a key in a section of a TOML file.
# Versioned here: https://gist.github.com/kwmiebach/e42dc4a43d5a2a0f2c3fdc41620747ab
# Call it like this:
# value=$(get_toml_value "./conf/config.toml" "server_b" "domain")
# Result should be "my123.example.com" in the case of this example file:
# ---------------------------
# [server_a]
# proto = "https"
# domain = "test.example.net"
@rockavoldy
rockavoldy / 0-odoo-cheatsheet.md
Last active January 8, 2025 13:16
Odoo Cheatsheet
@asafge
asafge / ng-really.js
Created November 12, 2013 13:06
ng-really? An AngularJS directive that creates a confirmation dialog for an action.
/**
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
*/
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;
@noprompt
noprompt / console-macros.clj
Last active December 22, 2015 05:59
ClojureScript console functions/macros
(ns clojurescript.console.macros
(:refer-clojure :exclude [time]))
(defmacro with-group [title & body]
`(do
(.group js/console ~title)
~@body
(.groupEnd js/console)))
(defmacro with-group-collpased [title & body]
@gitanat
gitanat / sendreceive.py
Created November 9, 2012 09:00
send and receive python objects through network with integrity and authentication
'''this module implements two functions, send() and receive(), capable
of sending arbitrary objects through the network (with pickle), with
authentication and integrity assurance'''
import socket
try:
import cPickle as pickle
except ImportError:
import pickle
import hmac