Skip to content

Instantly share code, notes, and snippets.

View michael-simons's full-sized avatar

Michael Simons michael-simons

View GitHub Profile
WITH RECURSIVE cte AS (
SELECT id, content FROM tweets WHERE id = ?
UNION ALL
SELECT t.id, t.content
FROM cte c
JOIN tweets t on t.in_reply_to_status_id = c.id
) SELECT * FROM cte
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Simple Polylines</title>
<style>
html, body {
height: 100%;
margin: 0;
SELECT TRUNC(q.datum-1/96,'mm')
,MAX(q.leistung)
FROM (SELECT SUM(NVL(v.prognose_wert,0)) leistung
,v.datum
FROM stuff v
WHERE id = 25175139
GROUP BY v.datum
) q
GROUP BY TRUNC(q.datum-1/96,'mm')
/
Oh I strongly believe that
pizza will save us all
It connects this world
Let's order pizza…
Oh I strongly believe that
pizza will save us all
Every revolutionary needs only pizza and weaponry
@michael-simons
michael-simons / shrinkDockerqcow.sh
Last active February 22, 2017 16:12
Quick gist that shrinks your Docker base file with qemu-img on macOS
# Install qemu tools with homebrew or macports first
# Stop all running containers
# You may want to remove stopped containers
# docker rm -f $(docker ps -a -q)
# and also prune the free space inside the base image file
# docker system prune
cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux
mv Docker.qcow2 Docker.qcow2.original
qemu-img convert -O qcow2 Docker.qcow2.original Docker.qcow2
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.example</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>jar</packaging>
@michael-simons
michael-simons / UTF8.java
Created March 18, 2017 22:24
The pain with surrogate pairs
public class UTF8 {
public static void main(String[] args) {
// See http://www.fileformat.info/info/unicode/char/1f4a9/index.htm
final String poo = "A pile of poo: 💩.";
System.out.println(poo);
// Length of chars doesn't equals the "real" length, that is: the number of actual codepoints
System.out.println(poo.length() + " vs " + poo.codePointCount(0, poo.length()));
// Iterating over all chars
@TestConfiguration
public static class Franz {
final ConfigurableEnvironment environment;
public Franz(ConfigurableEnvironment environment) {
this.environment = environment;
}
@Bean
@michael-simons
michael-simons / application-prod.properties
Created May 29, 2017 12:21
Referring to properties defined in more specific profiles
security.user.password = super-secure