Skip to content

Instantly share code, notes, and snippets.

[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
@karl007
karl007 / riot_delete_room.php
Created February 13, 2020 09:35
[Matrix/Riot] kick all users of a room to delete it
#!/usr/bin/php
<?php
if(!function_exists('curl_init')) {
die('cURL not available!');
}
// check if there are every required arguments
if (count($argv) < 4) {
echo('USAGE: ' . $argv[0] . ' <URL> <TOKEN> <ROOM ALIAS|ID>');
@rubo77
rubo77 / snap-update.sh
Last active March 31, 2023 16:46
start snap service, delete snap backups, do a refresh and disable it again
#!/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 July 7, 2022 16:47
/etc/aide/aide.conf.d/00_local_excludes exclude file with all folders, that frequently change
!/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
#!/bin/bash
SERVER="matrix.mycompany.com"
echo -e "\e[97mEnter user you'd like to deactivate\e[0m";
read user
if [ "$user" == "" ]; then
echo "User required.";
exit;
#!/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
@TobleMiner
TobleMiner / analyze_tg.sh
Last active January 2, 2019 19:19
Simple script to analyze the transglobal table of batman
#!/usr/bin/env bash
node_mac_paths=('.nodes[].nodeinfo.network.mac')
batctl_count_hops() {
batctl -m "$1" tg |
sed 's/([[:space:]]*[0-9]\+)//g' | # Remove tq field
sed 's/[[:space:]]\+/ /g' | # Replace duplicate whitespace characters by a single space
cut -d' ' -f5 | # Extract nexthop
egrep -o '([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}' | # Match mac addresses only
@sandeepyohans
sandeepyohans / MainActivity.java
Last active October 30, 2023 10:42
Adding alert() support to a WebView - Android
/*
Retrieved from https://web.archive.org/web/20160516165158/http://lexandera.com/2009/01/adding-alert-support-to-a-webview/
*/
final WebView browser = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);
final Context myApp = this;

this is the output of the script generate_markdown_of_packages.sh below:

Main Gluon Packages

gluon/package/gluon-alfred

Configure alfred

depends on +gluon-core +gluon-respondd +gluon-neighbour-info gluon-mesh-batman-adv +micrond +alfred