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 / esp-clone.sh
Last active November 20, 2017 20:47
Automatically clone and build repositories related to the esp8266 sdk
#!/bin/bash
# Build the esp 8266 open-sdk and related tools in current directory.
#
# Tested on Ubuntu 16.04.1 and 14.04.4/5.
# It takes up to an hour to build and several GB of space, so be prepared!
#
# Use it with:
# wget -O esp-clone.sh https://gist.githubusercontent.com/con-f-use/d086ca941c2c80fbde6d8996b8a50761/raw && chmod +x esp-clone.sh && ./esp-clone.sh
#
# ToDo: Ask the user when install installing examples or checking for Ubuntu, make a -y option to proceed automatically
Moved to https://github.com/con-f-use/img2ngrv
#!/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)
#!/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
@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
}
@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 / 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 / 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 / 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 / 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,