Skip to content

Instantly share code, notes, and snippets.

@swiesend
swiesend / keybase.md
Created March 19, 2020 20:16
keybase.md

Keybase proof

I hereby claim:

  • I am swiesend on github.
  • I am swiesend (https://keybase.io/swiesend) on keybase.
  • I have a public key ASDy0SODfRblXuJk-wEgBPNZ0V72-VRmMkG2OV5HtUo7sQo

To claim this, I am signing this object:

@swiesend
swiesend / continually.jl
Last active September 11, 2019 21:02
OnlineStats.jl - Exponentially Weighted Moving Average with a Window
cd(@__DIR__)
using OnlineStats
using Dates
using Plots
gr()
function test()
data = Plots.fakedata(250,2) .+ [2 1]
n,m= size(data)
ewmas = zeros(0,2)
@swiesend
swiesend / fedora30-KDE org.freedesktop.systemd1.conf
Created July 31, 2019 11:57
DBus access control scheme - Ubuntu 18.04 vs Fedora 30 KDE
<?xml version="1.0"?> <!--*-nxml-*-->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<!--
SPDX-License-Identifier: LGPL-2.1+
This file is part of systemd.
systemd is free software; you can redistribute it and/or modify it
@swiesend
swiesend / Parallel.jl
Last active August 5, 2018 12:53
Parallel Recur layers for Flux.jl - with map/reduce
using Flux
using Flux: treelike, Recur, _truncate, prefor
function average(mapped)
D = mapped[1]
for m in 2:length(mapped)
D = D .+ mapped[m]
end
D = D ./ length(mapped)
D
@swiesend
swiesend / gui-cron.sh
Created June 21, 2017 20:19
get DBUS_SESSION_BUS_ADDRESS and DISPLAY for cronjobs with gui tasks
#!/bin/sh
[ "$#" -lt 1 ] && echo "Usage: $0 program options" && exit 1
program="$1"
shift
user=$(whoami)
env_reference_process=$( pgrep -u "$user" xfce4-session || pgrep -u "$user" ciannamon-session || pgrep -u "$user" gnome-session || pgrep -u "$user" gnome-shell || pgrep -u "$user" kdeinit )
@swiesend
swiesend / notify.sh
Last active June 21, 2017 20:22
desktop notifications with random/shuffled icons
#!/bin/sh
SUMMARY=$1
BODY=$2
ICONS=$3
NEXT_ICON=`find $ICONS -type f | shuf -n1`
echo "$SUMMARY"
echo "$BODY"
@swiesend
swiesend / combinations.py
Last active September 23, 2015 19:11
Word combinations (cartesian product)
def combinations(ll, j=0, cll=None):
'''Returns a list of word combinations.
Generates recursively a cartesian product for given possibilities.
Note: This function consumes a lot of memory for large words with many possibilities.
Example:
>>> ll = [[u'h'], [u'e', u'a'], [u'l', u'll'], [u'o']]