Skip to content

Instantly share code, notes, and snippets.

View con-f-use's full-sized avatar
💭
😱

con-f-use

💭
😱
  • A University, An IT Firm
  • Europe
View GitHub Profile
@con-f-use
con-f-use / ssh_principals.nix
Created December 27, 2023 22:23
SSH Principals nix module
{ config, lib, ... }:
{
options.users.users = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule (
{ name, config, ... }: {
options.openssh.authorizedPrincipals = lib.mkOption {
type = lib.types.listOf lib.types.str;
example = ''[ "admins", "developers", "it-personnel" ]'';
description = lib.mdDoc ''
@con-f-use
con-f-use / auth_handler.patch
Last active April 26, 2022 13:58
If remote server runs sshd with OpenSSH<=7.7 paramiko does the wrong thing when connecting with a CA-signed ssh key (...-cert.pub). This patch fixes that.
--- a/paramiko/auth_handler.py 2022-04-26 15:37:37.433185610 +0200
+++ b/paramiko/auth_handler.py 2022-04-26 15:37:25.083111811 +0200
@@ -22,6 +22,7 @@
import weakref
import time
+import re
from paramiko.common import (
cMSG_SERVICE_REQUEST,
@con-f-use
con-f-use / dynamic_rest_client.py
Last active November 25, 2022 14:30
dynamic rest client concept (abuse python's getattr and getitem)
import urllib.parse
class Endpoint:
def __init__(self, uri, api):
self.m4ngl3 = dict(uri=uri, api=api) # prevent name collisions (with actual members called "uri" or "api", endpoints of these names couldn't be used - we can probably live without ones named "m4ngl3")
def __getitem__(self, name):
api, uri = self.m4ngl3["api"], self.m4ngl3["uri"]
key = api.canonize(uri, name)
return api._resources.setdefault(key, Endpoint(key, api))
@con-f-use
con-f-use / walldap.md
Last active September 25, 2021 13:13

LDAP behind the WALL

Let's preface this by saying, that I'm indeed a very, very evil man, and the following does not correspond in any way shape or form to a real setup in the acutal realm of living breathing things. Nor should it. Ever.

The Premise

@con-f-use
con-f-use / mcomix3.nix
Last active November 25, 2020 18:43
mcomix3 nix package (WIP)
{ stdenv
, fetchFromGitHub
, python3
, python3Packages
, wrapGAppsHook
, gobject-introspection
, gtk3
, gdk-pixbuf
# Recommended Dependencies:
, unrar
@con-f-use
con-f-use / nodrllama.cow
Created May 8, 2020 14:58
Nodrama-Llama
## Nodrama-Llama
$the_cow = <<EOC;
$thoughts
$thoughts
(\\/)
(_o |
/ |
\\ \\______
\\ )o
/|----- |
@con-f-use
con-f-use / jcgb.sh
Last active March 11, 2021 16:07
Some bash functions I like to use
#!/usr/bin/env bash
getbool() {
local in="${1:-no}"
if [[ "${in^^}" =~ ^(1|Y(ES)?|ON|T(RUE)?|ENABLE(ED)?)$ ]]; then
return 0
fi
return 1
}
#!/usr/bin/env bash
# Wrapper to use liquidprompt with bashit
# The path to this file should read '$BASH_IT/themes/liquidprompt/liquidprompt.theme.bash'
targetdir="$BASH_IT/themes/liquidprompt/liquidprompt"
gray="\[\e[1;90m\]"
# Get liquidprompt if not yet installed
cwd="$PWD"
if cd "$targetdir" &>/dev/null && git rev-parse --is-inside-work-tree &>/dev/null; then
#!/usr/bin/python
# Let's call this file 'mymodule.py'
# When run from the 'shell application' created by setuptools,
#+only doctests for `main()` get run, while `to_be_tested()` is
#+ignored `mymoduleapp -test`.
# Testing for both functions works, when run direcly as shell
# script, e.g. as `./mymodule.py --test`
# Used python version: Python 2.7.12 (setuptools 20.7.0)
Moved to https://github.com/con-f-use/img2ngrv