Skip to content

Instantly share code, notes, and snippets.

View cimnine's full-sized avatar

Christian Mäder cimnine

View GitHub Profile
@cimnine
cimnine / ocr.sh
Created November 26, 2021 16:31
Script to OCR many PDF files using tessarect and imagemagick
#!/bin/bash
set -e
analyze() {
BASE="$1"
echo "Converting 'input/$BASE.pdf' to 'output/$BASE.tiff'"
convert -density 300 "input/$BASE.pdf" "output/$BASE.tiff" 2>&1
echo "OCR of 'output/$BASE.pdf' to 'output/${BASE}_deu.pdf'"
import itertools
from ruamel.yaml import YAML
from pathlib import Path
def load_yaml(yaml_base_path: str):
yaml_path = Path(yaml_base_path)
content_list = []
content_list.append(load_file(yaml_path.with_suffix('.yml')))
load_dir(content_list, yaml_path.with_suffix('.d'))
return flatten(content_list)
@cimnine
cimnine / 0_README.md
Last active January 16, 2022 14:59
A script to import custom fields from a YAML into Netbox

custom field import script

Usage:

./manage.py shell --plain < import_custom_fields.py

A Note On Boolean Custom Fields

Keybase proof

I hereby claim:

  • I am cimnine on github.
  • I am cma (https://keybase.io/cma) on keybase.
  • I have a public key whose fingerprint is 15ED 97B3 AFFC 073C BDD9 68C2 5A51 249E FCF5 C5F1

To claim this, I am signing this object:

firewall {
ipv6-name dmz-lan-6 {
default-action drop
enable-default-log
rule 100 {
action accept
log enable
protocol ipv6-icmp
}
rule 1 {
@cimnine
cimnine / forever.sh
Last active November 19, 2015 12:32
#!/bin/bash
#
# (c) Netcetera AG
date="19.11.2015"
version="1.2"
#
help() {
script=$(basename "$1")
@cimnine
cimnine / gist:7913819
Last active July 29, 2021 22:01
Luhn Algorithm in VBA (for example for use in Excel)
' Version 1.0.0
' You may use these functions directly in Excel: "=luhnCheck(A55)"
' probably only needed internally
Function luhnSum(InVal As String) As Integer
Dim evenSum As Integer
Dim oddSum As Integer
evenSum = 0

Adding a Certificate to a Key Store

// This method adds a certificate with the specified alias to the specified keystore file.
public static void addToKeyStore(File keystoreFile, char[] keystorePassword,
  String alias, java.security.cert.Certificate cert) {
    try {
        // Create an empty keystore object
        KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());

// Load the keystore contents

@cimnine
cimnine / yack.js
Created December 4, 2012 08:14
Little lib to access the HSR IntTe'12 "Testat2" chat server
(function(window) {
"use strict";
var Yack = function(playerToken) {
if(playerToken) {
this.playerToken = playerToken;
} else {
var o = this;
callSrv('Connect', {}, function(res) {
@cimnine
cimnine / COPYING
Created September 17, 2012 12:09
Sync script for hsr.ch
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE