Skip to content

Instantly share code, notes, and snippets.

View onigoetz's full-sized avatar

Stéphane Goetz onigoetz

View GitHub Profile
@onigoetz
onigoetz / messageformat.js
Created January 18, 2024 16:19
Profiling article examples
// Simple substitution
render("Hello, {name}!", { name: "John" }); // Hello, John!
// More advanced, with plurals
const message = `You have {numBooks, number} {numBooks, plural, one {book} other {books}}.`;
const variables = { numBooks: 5 };
render(message, variables); // You have 5 books.
@onigoetz
onigoetz / View.ts
Last active June 23, 2021 09:36
Microfrontends at Swissquote
interface View {
show(container: Element): void;
hide(): void;
}
@onigoetz
onigoetz / CLDRGenerator.java
Created June 11, 2019 06:20
CLDR Data subset
import java.io.IOException;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@onigoetz
onigoetz / dmesg.txt
Created February 27, 2019 18:28
Failed Drive diagnostics
[602336.506945] sdb:
[602337.780622] sdb: sdb1 sdb9
[602337.847438] sdb: sdb1 sdb9
[602358.964698] sdm:
[602360.146857] sdm: sdm1 sdm9
[602360.160642] sdm: sdm1 sdm9
[602391.209978] mpt2sas_cm0: log_info(0x31120303): originator(PL), code(0x12), sub_code(0x0303)
[602391.209986] mpt2sas_cm0: log_info(0x31120303): originator(PL), code(0x12), sub_code(0x0303)
[602391.209990] mpt2sas_cm0: log_info(0x31120303): originator(PL), code(0x12), sub_code(0x0303)
[602391.209995] mpt2sas_cm0: log_info(0x31120303): originator(PL), code(0x12), sub_code(0x0303)
@onigoetz
onigoetz / docker-compose.yml
Created October 16, 2018 06:06
Rocket Chat sticky load balancing with docker-compose and haproxy
version: '2'
services:
rocketchat1:
image: rocketchat/rocket.chat:0.65.1
restart: unless-stopped
volumes:
- ./uploads:/app/uploads
environment:
- PORT=3000
@onigoetz
onigoetz / crafty.config.js
Created January 24, 2018 21:33
Crafty Medium examples
module.exports = {
presets: [
"@swissquote/crafty-preset-babel",
"@swissquote/crafty-runner-webpack"
],
js: {
app: {
runner: "webpack",
source: "js/index.js"
}
@onigoetz
onigoetz / Dockerfile
Created November 5, 2016 21:35
Unrar after download
FROM lsiobase/alpine
MAINTAINER onigoetz <onigoetz@onigoetz.ch>
RUN apk add --no-cache bash unrar
COPY crontab /var/spool/cron/crontabs/abc
COPY ./unrar.sh /bin/unrar_torrent.sh
RUN chmod +x /bin/unrar_torrent.sh
@onigoetz
onigoetz / gist:9255492ce9cc8ba51fc9
Created April 8, 2015 12:51
Debug code quickly
<?php
function quick_backtrace() {
$trace = debug_backtrace();
echo '<pre>';
foreach ($trace as $entry) {
if (__FUNCTION__ == $entry['function']) continue;
if (array_key_exists('file', $entry)) {
$file = (strlen($entry['file']) >= 30)? '…'.substr($entry['file'], -29) : $entry['file'];