Skip to content

Instantly share code, notes, and snippets.

View ip6li's full-sized avatar

Christian Felsing ip6li

View GitHub Profile
@ip6li
ip6li / surfacego2-modemfix.sh
Created December 16, 2023 05:10
Init LTE Modem Surface Go 1
#!/usr/bin/bash
echo 16383 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
echo 16383 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
echo 16384 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/rx_max
echo 16384 | tee /sys/bus/usb/devices/2-3/2-3:1.0/net/wwp0s20f0u3/cdc_ncm/tx_max
@ip6li
ip6li / sms-read
Created December 16, 2023 05:06
Read and send SMS on Linux Surface Go 1
#!/usr/bin/env bash
DELETE=$1
mmcli -m 0 --output-json --messaging-list-sms | jq '."modem.messaging.sms"[]' | while read sms; do
SMS_NUM=$(echo $sms | sed 's/"//g'| awk -F/ '{print $NF}')
if [ -z $SMS_NUM ]; then
exit 0
fi
SMS_DATA=$(mmcli --output-json -s $SMS_NUM)
SENDER=$(echo "$SMS_DATA" | jq .sms.content.number | sed 's/"//g')
@ip6li
ip6li / create-wg-client-config
Created October 15, 2022 09:47
Creates Wireguard config for clients including QR code for mobile devices.
#!/usr/bin/env bash
# You *must* change parameters for IP networks, DNS etc.
# Otherwise your config *will* not work.
usage() {
echo "Usage: $0 <name>"
}
NAME="$1"
@ip6li
ip6li / add-certs-to-firefox
Created January 3, 2021 12:47
Get (CA) certificates from an URL and install them in Firefox cert store.
#!/usr/bin/env bash
# see also https://ip6.li/de/howto/firefox
umask 077
TMPDIR="/tmp/ff-certs"
# Prefight checks
for i in curl grep certtool certutil; do
which "$i" > /dev/null 2> /dev/null
@ip6li
ip6li / get-enterprise-certs.sh
Last active December 31, 2021 07:59
Import local certificates
#!/usr/bin/env bash
###########################################################################################
# Import local CA certificates to Linux distributions
# Should work with CentOS/RedHat/Fedora, Debian/Ubuntu and Arch Linux
###########################################################################################
CERTS='https://pki.example.com/ejbca/publicweb/webdist/certdist?cmd=cacert&issuer=CN%3DManagement%2CO%3DChristian+Felsing+2020%2CC%3DDE&level=0'
CERTS+=' https://pki.example.com/ejbca/publicweb/webdist/certdist?cmd=cacert&issuer=CN%3DRoot+CA+EC+Gen+1%2COU%3DTrust+Center%2CO%3DChristian+Felsing%2CL%3DTaunusstein%2CC%3DDE&level=0'
CERTS+=' https://pki.example.com/ejbca/publicweb/webdist/certdist?cmd=cacert&issuer=CN%3DLegacy+CA%2COU%3DTrust+Center%2CO%3DChristian+Felsing%2CL%3DTaunusstein%2CC%3DDE&level=0'
#!/usr/bin/env bash
##################################################################
# show subject of all certs in a bundle file (PEM)
##################################################################
f="$1"
if [ -z "$f" ]; then
echo "usage: $0 <filename>"
exit 1
@ip6li
ip6li / openssl.cnf
Created May 1, 2019 12:16
openssl.cnf for PKCS#11
#
# OpenSSL example configuration file.
# This is mostly being used for generation of certificate requests.
#
openssl_conf = openssl_def
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
@ip6li
ip6li / make-ads-conf
Created May 20, 2018 13:14
Adaway for unbound DNS server
#!/usr/bin/env bash
# Creates unbound config with blacklisting from adaway
# resulting file /etc/unbound/conf.d/ads.conf needs to be
# included in unbound.conf
# This version was written for Arch Linux
#
# Expects file /opt/cftools/ads-custom.conf with following content:
# local-zone: "<bad.domain>." static
# for example: local-zone: "bild.de." static
@ip6li
ip6li / rpassword.sh
Last active December 31, 2021 08:04
Generate Secure Password
#!/bin/bash
# https://xkcd.com/936/
# https://gist.github.com/ip6li/f4ebf492a7927887afe8563e6c66face
# Do not rely on passwords only. Password authentication w/o 2nd factor
# is to be notorious for insecurity independently from password length
# or complexity.
NUM_WORDS=2