Skip to content

Instantly share code, notes, and snippets.

View floscher's full-sized avatar

Florian Schäfer floscher

View GitHub Profile
@floscher
floscher / .editorconfig
Created October 9, 2023 11:34
.editorconfig
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
tab_width = 2
trim_trailing_whitespace = true

MySQL

Start MySQL client as root user:

$ sudo mysql -u root

See existing users:

> SELECT User, Host from mysql.user;
#!/bin/php
<?php
$SUBJECT_PREFIX = "Subject: ";
$allHeadersRead = FALSE;
$subject = NULL;
while($f = fgets(STDIN)){
$allHeadersRead |= (trim($f) === '');
@floscher
floscher / add_uuid_column.sql
Last active October 20, 2019 15:38
Add UUID column to MySQL table
ALTER TABLE `table_name` ADD COLUMN `uuid` binary(16);
# Each value must be different, see https://stackoverflow.com/a/54777792
UPDATE `table_name` SET `uuid` = (SELECT UNHEX(REPLACE(UUID(), _utf8'-', _utf8'')));
ALTER TABLE `table_name` MODIFY `uuid` binary(16) NOT NULL;
@floscher
floscher / update_gradle_wrapper.sh
Last active June 4, 2018 18:01
A script for updating an existing Gradle wrapper in a given directory to another version.
#!/usr/bin/env sh
if [ $# -ne 2 ]; then
echo "This script needs exactly two parameters: the path where the current Gradle wrapper is and the version to which to upgrade."
echo "Example: ./update_gradle_wrapper.sh ./path/to/directory/to/update/ 1.2.3"
exit 1;
fi
distType="all"
path="$1"
// ==UserScript==
// @name Achavi-Link on OSM.org
// @namespace de.schaeferban
// @include https://openstreetmap.org/user/*/history*
// @include https://www.openstreetmap.org/user/*/history*
// @include http://openstreetmap.org/user/*/history*
// @include http://www.openstreetmap.org/user/*/history*
// @include https://openstreetmap.org/changeset/*
// @include https://www.openstreetmap.org/changeset/*
// @include http://openstreetmap.org/changeset/*
@floscher
floscher / bug928449.html
Created March 7, 2015 19:52
Minimal example for firefox bug 928449
<!DOCTYPE html>
<script src="https://code.jquery.com/jquery.min.js"></script>
<style>
span {
top:10%;
left:50%;
position:absolute;
animation: scale 30s infinite alternate linear;
}
@keyframes scale {
@floscher
floscher / update
Created January 25, 2015 15:07
update-hook for
#!/bin/bash
# This hook checks for whitespace problems and rejects pushing them (even with --force).
# Put this in the ./hooks/ directory on your (server-)repository.
# With the core.whitespace-attribute in your git-configuration you can control for which
# problems it should check (see http://www.git-scm.com/docs/git-config for possible values).
echo "Checking for whitespace problems introduced between $2 and $3"
git diff --check $2 $3
exit `git diff --check $2 $3 | wc -l`