Skip to content

Instantly share code, notes, and snippets.

@Rillke
Rillke / for php.xml
Last active August 29, 2015 14:01
code style formatter mediawiki eclipse
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles>
<profile name="mw">
<setting id="indentationChar" value="&#9;"/>
<setting id="insert_space_after_opening_paren_in_declare" value="false"/>
<setting id="insert_space_before_closing_paren_in_declare" value="false"/>
<setting id="insert_space_before_opening_paren_in_declare" value="false"/>
<setting id="org.eclipse.php.core.formatter.insert_new_line_in_function_invoke" value="0"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_force_split" value="false"/>
<setting id="org.eclipse.php.formatter.core.formatter.alignment_for_arguments_in_allocation_expression_indent_policy" value="2"/>
@Rillke
Rillke / fick.js
Created November 28, 2014 17:58
fick.js
/**
* Copyright 2014 by Rainer Rillke
* Makes sure Flickr iframes and images always look great.
* You may use and re-distribute and modify this file, povided
* that the above copyright notice and this text will be
* preserved.
* This software comes without any warranty.
* You may also use it under the terms of the JSON license.
*/
@Rillke
Rillke / toggle_wifi_hotspot.bat
Last active February 9, 2016 13:34 — forked from Mithrandir0x/disable_wifi_hotspot.bat
Two little batch files to create a cozy WiFi hotspot from the laptop.
@ECHO OFF
ECHO Setting up or shutting down a hosted network
SET /P ACTION="ENABLE [E] DISABLE [D] INFO[I]: "
IF /I "%ACTION:~,1%" EQU "E" GOTO enable
IF /I "%ACTION:~,1%" EQU "D" GOTO disable
IF /I "%ACTION:~,1%" EQU "I" GOTO info
GOTO unknown
:enable
SET DEFAULT_SSID=rillke's hotspot
@Rillke
Rillke / mariadb-docker-dumpcreate.md
Last active June 13, 2021 17:24
Restore database dump to mariadb docker container

Create database dump from MariaDB Docker container

docker-compose exec mariadb sh -c \
  'exec mysqldump --all-databases -uroot -p"$MYSQL_ROOT_PASSWORD"' \
  ____encoding____

encoding

@Rillke
Rillke / overlay2.sh
Last active August 11, 2017 20:50
Switch Docker to use Overlay2 FS instead of the default (used on Ubuntu Trusty and Xenial [systemd])
# First, make sure you're using systemd and
# the prerequisites are fulfilled:
# https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/#prerequisites
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
mkdir -p /etc/systemd/system/docker.service.d
@Rillke
Rillke / emsdk_env.sh
Created August 31, 2017 21:22
emscripten
#!/usr/bin/env bash
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo 'Script must be sourced'
exit -1
fi
cwd=$(pwd)
cd /INSTALLDIR/emsdk-portable
source emsdk_env.sh
@Rillke
Rillke / SSH-through-bastion.dokuwiki
Last active April 27, 2020 14:12
SSH through bastion host: SSH and PuTTY
* Linux: ~/.ssh/config:
<code>
Host SHORTCUT
Hostname FULLURL_OR_IP_TARGET_HOST
User USERNAME
Host FULLURL_OR_IP_TARGET_HOST
ProxyCommand ssh -a -W %h:%p BASTION_HOST
Port NUMBER
@Rillke
Rillke / venn.sql
Created November 11, 2018 14:36
MySQL stored procedure for calculating the compartments of a Venn-Diagram created from 4 sets
-- Given the 4 tables, each containing items and representing one set,
-- I'd like to get the count of the items in each compartment required
-- to draw a Venn diagram as shown below. The calculation should take
-- place in the MySQL server since I do not want to transmit the single
-- items to the application server.
-- https://stackoverflow.com/q/53234943/2683737
-- Copyright 2018 Rainer Rillke
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
@Rillke
Rillke / N26transactions.js
Created November 11, 2019 15:27
Extract data from N°26 bank transactions page
let balance = 0;
let transactions = [];
for (elem of document.querySelectorAll('a[href^="/transactions"]')) {
console.log(Array(20).join('-'));
const parent = elem.parentNode;
if (!parent) {
console.warn('skip [parent]', elem, elem.innerText);
continue;
}
const amountNode = parent.nextSibling;
@Rillke
Rillke / 0-http.conf
Created March 25, 2020 21:48
Opencast Presentation nginx Proxy
# Yes, you are an nginx. But do not tell everyone your version.
server_tokens off;
# Cache definition; used for proxying to Jetty
# This defines a chache stored at /tmp/nginx/cache with only
# one hierarchy level, no additional temp path, a key (used for
# matching requests to cache entries) zone in RAM which is 10M,
# schedules entries older than 2h for deletion and a maximum size
# of 160M
proxy_cache_path /tmp/nginx/cache levels=1 use_temp_path=off