Skip to content

Instantly share code, notes, and snippets.

@elbosso
elbosso / setupscreenconkx.sh
Last active February 23, 2023 11:58
This script installs and configures a few applications and services - in particular it sets up gnu screen and conky in a way to provide a nice bottom line complete with tabs for the open windows and some information about system health
#!/bin/bash
######################################################################
# This script sets up gnu screen and conky in a way to provide a nice
# footer line complete with tabs for the open windows and some
# information about the systems health
# (https://elbosso.github.io/gnu_screen_sitzung_wenig_aufgepeppt.html#content)
#
# If run as sudo (or root) it tries to install gnu screen and conky
# (needed) and joe (my own preference) before writing a customized
# version of .screenrc and a customized version of a conky config.
@elbosso
elbosso / badges_flask.py
Created January 6, 2019 16:38
This is yet another followup re: dynamic badges in gitlab - its predecessor is here: https://gist.github.com/elbosso/cbce113805735478e926c28a9079cede This time we use flask to be more flexible with more deployment options - also it's fun!
from flask import Flask
from flask import make_response
import requests
from anybadge import Badge
from flask import request
app = Flask(__name__)
@app.route("/open/<int:projid>")
def openIssues(projid):
//https://ircama.github.io/osm-carto-tutorials/tile-server-ubuntu/
CONTAINERNAME=osm
PROCESSORCOUNT=$(cat /proc/cpuinfo | grep processor | wc -l) # used to speed up make
lxc-create -n $CONTAINERNAME -t download -- --arch amd64 --dist ubuntu --release xenial
lxc-start -n $CONTAINERNAME
lxc-attach -n $CONTAINERNAME -- apt-get update
lxc-attach -n $CONTAINERNAME -- apt-get -y upgrade
lxc-attach -n $CONTAINERNAME -- apt-get -y install joe screen conky-cli openssh-server curl unzip gdal-bin tar wget bzip2 build-essential clang git autoconf libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal-dev g++ libmapnik-dev mapnik-utils python-mapnik libxml2-dev libfreetype6-dev libjpeg-dev libpng-dev libproj-dev libtiff-dev libcairo2 libcairo2-dev python-cairo python-cairo-dev libgdal-dev build-essential python-dev libbz2-dev libicu-dev libboost-all-dev apache2 apache2-dev python-yaml python-pip mapnik-utils fonts-noto-cjk fonts-noto-hinted fonts-noto-unhinted fonts-hanazono ttf-unifont font
@elbosso
elbosso / geolocationgeojson.sh
Created May 29, 2021 15:19
A bash script for rendering the result of a traceroute call on a OpenStreetView Map. Its only parameter is the destination - for example `geolocationgeojson.sh iana.org` - uses https://gist.github.com/rajanski/4d2595c1fd4e35c19b4e1a02b4ed579f
#!/bin/bash
# prerequistes:
# * wget
# * traceroute
# * xdg-open
# with help from https://gist.github.com/rajanski/4d2595c1fd4e35c19b4e1a02b4ed579f
commaneeded=""
@elbosso
elbosso / Matrix44.java
Created January 10, 2021 15:48
Source to generate somewhat pretty graphics (abstract, generative art) - see also https://mastodon.social/@elbosso/105526549344085753 Creates "/tmp/render.png" upon execution in three different modes: 0,1,2. Tons of other parameters adjustable by altering the source code. Inspired by https://pixelfed.social/p/y6nH/38965 and https://www.scratchap…
/*
* Copyright (c) 2021.
*
* Juergen Key. Alle Rechte vorbehalten.
*
* Weiterverbreitung und Verwendung in nichtkompilierter oder kompilierter Form,
* mit oder ohne Veraenderung, sind unter den folgenden Bedingungen zulaessig:
*
* 1. Weiterverbreitete nichtkompilierte Exemplare muessen das obige Copyright,
* die Liste der Bedingungen und den folgenden Haftungsausschluss im Quelltext
@elbosso
elbosso / WangDomino.java
Created January 1, 2021 20:36
Generator for tilings using the 13 example tiles from the wikipedia article https://de.wikipedia.org/wiki/Wang-Parkettierung
/*
* Copyright (c) 2021.
*
* Juergen Key. Alle Rechte vorbehalten.
*
* Weiterverbreitung und Verwendung in nichtkompilierter oder kompilierter Form,
* mit oder ohne Veraenderung, sind unter den folgenden Bedingungen zulaessig:
*
* 1. Weiterverbreitete nichtkompilierte Exemplare muessen das obige Copyright,
* die Liste der Bedingungen und den folgenden Haftungsausschluss im Quelltext
@elbosso
elbosso / Truchet.java
Last active January 1, 2021 13:15
Truchet tiling - conceived after going down yet another rabbithole because of operation mindfuck@rc3 (https://media.ccc.de/v/rc3-501024-operation_mindfuck_vol_4)
/*
* Copyright (c) 2021.
*
* Juergen Key. Alle Rechte vorbehalten.
*
* Weiterverbreitung und Verwendung in nichtkompilierter oder kompilierter Form,
* mit oder ohne Veraenderung, sind unter den folgenden Bedingungen zulaessig:
*
* 1. Weiterverbreitete nichtkompilierte Exemplare muessen das obige Copyright,
* die Liste der Bedingungen und den folgenden Haftungsausschluss im Quelltext
@elbosso
elbosso / create_gitlab_issue.sh
Created December 2, 2020 06:22
Bash script to automaticalley create issues in GitLab - use it for example in cron jobs
#!/bin/bash
rawurlencode() {
local string="${1}"
local strlen=${#string}
local encoded=""
local pos c o
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
@elbosso
elbosso / openIssuesByProject.sh
Created May 9, 2020 14:51
Shell script for using with telegraf exec input - writing number of open gitlab issues per project
#!/bin/bash
#https://stackoverflow.com/questions/296536/how-to-urlencode-data-for-curl-command
rawurlencode() {
local string="${1}"
local strlen=${#string}
local encoded=""
local pos c o
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
@elbosso
elbosso / BaseTestList.java
Last active April 6, 2020 18:41
Abstract JUnit 4 Test class for implementations of the Java interface java.util.List
/*
* Copyright (c) 2020.
*
* Juergen Key. Alle Rechte vorbehalten.
*
* Weiterverbreitung und Verwendung in nichtkompilierter oder kompilierter Form,
* mit oder ohne Veraenderung, sind unter den folgenden Bedingungen zulaessig:
*
* 1. Weiterverbreitete nichtkompilierte Exemplare muessen das obige Copyright,
* die Liste der Bedingungen und den folgenden Haftungsausschluss im Quelltext