Skip to content

Instantly share code, notes, and snippets.

View 1. truncate_syslog_after_resume.service
[Unit]
Description=deletes all but the last 1000 lines of syslog due to possible logging spam by VLC
[Service]
Type=oneshot
ExecStart=-/usr/local/sbin/truncate_syslog.sh
TimeoutSec=0
StandardOutput=syslog
After=suspend.target
@rubo77
rubo77 / planet2png.py
Last active Nov 28, 2020
converts a jpeg file with a planet on black background to a transparent png
View planet2png.py
#!/usr/bin/python3
# converts a jpeg file with a planet on black background to a transparent png
# like this imagemagick function does:
# for i in planet_*.jpg; do nr=$(echo ${i/planet_/}|sed s/.jpg//g|xargs); convert $i -fuzz 1% -transparent black trans/planet_${nr}.png; done
# but the python script will create them without arkifacts
# needs
# sudo apt install python3-opencv python3-sklearn python3-skimage
@rubo77
rubo77 / list_of_all_ciphers_in_tlsv1.3.txt
Created May 9, 2020
list of all ciphers in TLSv1.3 in Debian buster
View list_of_all_ciphers_in_tlsv1.3.txt
# this is the output when you expand the rules to the full list of ciphers with
# openssl ciphers 'TLSv1.3:HIGH:!LOW:!MEDIUM:!EXP:!NULL:!aNULL@STRENGTH'
TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-DSS-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-CCM8:ECDHE-ECDSA-AES256-CCM:DHE-RSA-AES256-CCM8:DHE-RSA-AES256-CCM:ECDHE-ECDSA-ARIA256-GCM-SHA384:ECDHE-ARIA256-GCM-SHA384:DHE-DSS-ARIA256-GCM-SHA384:DHE-RSA-ARIA256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA256:ECDHE-ECDSA-CAMELLIA256-SHA384:ECDHE-RSA-CAMELLIA256-SHA384:DHE-RSA-CAMELLIA256-SHA256:DHE-DSS-CAMELLIA256-SHA256:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-DSS-CAMELLIA256-SHA:RSA-PSK-AES256-GCM-SHA384:DHE-PSK-AES256-GCM-SHA384:RSA-PSK-CHACHA20
@rubo77
rubo77 / comments_in_gluon_firmware.ascii
Created Apr 5, 2020
all comments in gluon firmware
View comments_in_gluon_firmware.ascii
# Copyright (C) 2013 Project Gluon
# Copyright (C) 2013 Project Gluon
# Firewall script for inserting and removing ebtables rules.
# Example format, for filtering any IPv4 multicast packets to the SSDP UDP port:
# rule FORWARD --logical-out br-client -d Multicast -p IPv4 --ip-protocol udp --ip-destination-port 5355 -j DROP
# Removing all rules:
# $ /etc/init.d/gluon-ebtables stop
# Inserting all rules:
# $ /etc/init.d/gluon-ebtables start
# Inserting a specific rule file:
@rubo77
rubo77 / rotatescreen.sh
Last active Nov 6, 2021
This script rotates the screen (tested on a Lenovo Yoga 730-15iwl) (source: https://askubuntu.com/a/1217290/34298)
View rotatescreen.sh
#!/bin/bash
# This script rotates the screen and touchscreen
# by Ruben Barkow-Kuder: https://gist.github.com/rubo77/daa262e0229f6e398766
#### configuration
# find your Touchscreen device with `xinput`
TouchscreenDevice="$(xrandr |grep eDP|cut -d" " -f1)"
if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then
@rubo77
rubo77 / matrix-synapse-commands-in-riot.md
Last active Feb 2, 2020
matrix synapse commands in riot
View matrix-synapse-commands-in-riot.md

/shrug

args:

<message>

description:

Prepends ¯\(ツ)/¯ to a plain-text message

/plain

args:

<message>

@rubo77
rubo77 / snap-update.sh
Last active May 31, 2021
start snap service, delete snap backups, do a refresh and disable it again
View snap-update.sh
#!/bin/bash
# this script starts the snapd service, deletes old snap images, does a refresh and disables it again
# put it in /usr/local/sbin/snap-update and give it executable rights
# Note: If you run apt upgrade and there is an update to a package that is managed by snapd,
# the upgrade will hang if snapd is still masked, so remember to unmask snapd in that case
# and start apt upgrade again
set -x
systemctl unmask snapd.service
@rubo77
rubo77 / 00_local_excludes
Last active Jan 3, 2021
/etc/aide/aide.conf.d/00_local_excludes exclude file with all folders, that frequently change
View 00_local_excludes
!/backup*
!/dev/disk/
!/etc/.etckeeper
!/etc/.git/
!/etc/aide/.aide.conf.swp
!/etc/aide/.aide.conf.swp
!/etc/aide/aide.conf.d/00_local_excludes
!/etc/ld.so.cache
!/etc/lvm/archive
!/etc/lvm/backup
@rubo77
rubo77 / MainActivity.java
Last active May 7, 2019 — forked from sandeepyohans/MainActivity.java
Adding alert() support to a WebView - Android
View MainActivity.java
/*
Retrieved from https://web.archive.org/web/20160516165158/http://lexandera.com/2009/01/adding-alert-support-to-a-webview/
*/
// ...
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
public class MainActivity extends AppCompatActivity {
View freifunk_gateway_connection_check.sh
#!/bin/sh
# this script can log the quality of fastd-connections to all gateways
# it sets only one gateway active at a time and checks the connection.
# add this script as cron script to get a statistic over time
COMMUNITY_NAME=ffki;
GW_PREFIX=vpn
GATEWAYLIST="0 1 2 4 6"
PING_IP6=2a01:4f8:171:27a2:0:77:77:254
STATISTIC_LOG_FILE=/tmp/gw_connection_statistic.log
for ENABLED in $GATEWAYLIST; do