Skip to content

Instantly share code, notes, and snippets.

View bjoern-r's full-sized avatar

Björn bjoern-r

  • Berlin; Germany
View GitHub Profile
@bjoern-r
bjoern-r / quectel-5g-connect.sh
Created September 29, 2021 12:43
Script to connect a Quectel 5G modem with qmicli
#!/bin/bash
# Set traps to catch exite signals
trap stopservice SIGINT
trap stopservice SIGKILL
trap stopservice SIGTERM
function stopservice {
if [[ ! -z ${DATA_HANDLE} && ! -z ${CLIENT_CID} ]]
then
@bjoern-r
bjoern-r / BatteryVoltageGuard.ino
Created April 14, 2020 18:52
Simple Arduino sketch to control a relais to switch a relais if the voltage read from the adc is below a certain level
/*
Battery Guard
Use an arduino nano and connect the input voltage with an voltage divider to A0
I used 9kOhm and 1kOhm to get a /10 divider to be able to measure up to 50V
Switch points are for a 12v AGM battery.
The relais is controlled via D7.
*/
#define NUM_READINGS 10
#define RELAIS_PIN 7
#define ADC_REF 5.0
@bjoern-r
bjoern-r / ovpn_route.sh
Created February 21, 2019 11:07
openvpn script to configure routes via different routing table
#!/bin/sh
# add to config
# --route-noexec
# --route-up script.sh
# --route-pre-down script.sh
echo "++++++++++++ $script_type ++++++++++++" | logger -t ovpn_route
#env | tee -a /tmp/vpn
#echo "--------------------------------------" | tee -a /tmp/vpn
@bjoern-r
bjoern-r / com.c
Last active January 22, 2020 00:36
very simple serial terminal
/*
* Building: cc -o com com.c
* Usage : ./com /dev/device [speed]
* Example : ./com /dev/ttyS0 [115200]
* Keys : Ctrl-A - exit, Ctrl-X - display control lines status
* Darcs : darcs get http://tinyserial.sf.net/
* Homepage: http://tinyserial.sourceforge.net
* Version : 2007-07-31
*
* Ivan Tikhonov, http://www.brokestream.com, kefeer@brokestream.com
@bjoern-r
bjoern-r / codimd-oauth2.md
Last active November 2, 2019 18:14
CodiMD docker with Oauth2 via

CodeiMD authentication via Oauth2 with django-oidc-provider

install django-oidc-provider

create application in django-oidc-provider

Configure allowed callback urls:

https://pad.server.com/auth/oauth2/callback
http://pad.server.com/auth/oauth2/callback

Configure scopes:

@bjoern-r
bjoern-r / busybox-static-chroot.md
Last active April 9, 2019 06:30
busybox static chroot

create user

usermod -G chrootlogin joe

add to sshd_config

change file /etc/ssh/sshd_config

Subsystem sftp internal-sftp
@bjoern-r
bjoern-r / bloom.py
Last active January 23, 2019 17:31 — forked from marcan/bloom.py
Simple Bloom filter implementation in Python 3 (for use with the HIBP password list)
#!/usr/bin/python3
#
# Simple Bloom filter implementation in Python 3
# Copyright 2017 Hector Martin "marcan" <marcan@marcan.st>
# Licensed under the terms of the MIT license
#
# Written to be used with the Have I been pwned? password list:
# https://haveibeenpwned.com/passwords
#
# Download the pre-computed filter here (968MB, k=11, false positive p=0.0005):
@bjoern-r
bjoern-r / sonoff2emoncms.py
Last active December 2, 2018 11:31
sonoff POW MQTT to emoncms publisher
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import json
import time
import requests
nodename="sonoff"
apikey="--xx--"
url="https://emoncms.org/input/post"
@bjoern-r
bjoern-r / randomTrace.md
Last active September 22, 2018 12:49
Random Tracepaces from around the world

From Japan

curl nixda.biz/ip

133.11.240.193

tracepath nixda.biz

 1?: [LOCALHOST]                                         pmtu 1500
 1:  gateway                                               1.652ms 
@bjoern-r
bjoern-r / add_interfaces_dhcp.sh
Created March 8, 2018 17:10
script to configure all unconfigured interfaces for dhcp and bring them up. Ubuntu-16.04
#!/bin/sh
# Author: bri
# Will add all interfaces in state DOWN to /etc/network/interfaces.d/auto.cfg
# with option dhcp
## for iface in `ls /sys/class/net/`; do
/sbin/ip -br l | awk '/DOWN/{print $1}' |
while read dev
do