Skip to content

Instantly share code, notes, and snippets.

@ccy
ccy / delphi.async.md
Last active December 21, 2023 01:57

DEPRECATED: Refer to delphi-ppl

UI design strategy for long running task

A long running task may cause the application runtime become unresponsive and lead perception of application halt or hang during the operation.

For example:

  1. A database backup operation spend 10 minutes to finish.
  2. Perform length report calculation
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active May 13, 2026 16:04
set -e, -u, -o, -x pipefail explanation
@AveYo
AveYo / .Files.bat
Last active April 20, 2026 08:54
Files.html listing from directory context-menu ( or simpler, but less fancy Files.xml )
;@echo off &title Files.html listing from directory context-menu by AveYo v1.0
;if not exist "%~1" ( goto :setup ) else pushd "%~1\.." &echo Listing "%~1" - please wait... &set "fn=%~nx1 Files.html"
;del /f/q "%fn%" >nul 2>nul &cd.>"%fn%" 2>nul
;if exist "%fn%" ( set "files=%CD%\%fn%" ) else set "files=%USERPROFILE%\Desktop\%fn%"
;pushd "%~1"
;set "ampersand=&" &set "escape=&"
;> "%files%" findstr -bv ; "%~f0"
;>>"%files%" echo ^<p^>%DATE%, %TIME%^</p^>^<div class="filetree"^>
;>>"%files%" <nul set/p="<ul class="main-tree"><li class="tree-title">%~1</li>"
;>>"%files%" echo.
create table "Tickers_Data"
(
ticker integer not null
constraint tickers_data_ticker_foreign
references "Tickers",
time date not null,
low double precision not null,
high double precision not null,
open double precision not null,
close double precision not null,
@litvil
litvil / CamelKafkaAvroDeserializer.java
Created June 8, 2018 16:59
Camel Kafka Avro serializer and deserializer
package com.company.mapping;
import io.confluent.common.config.ConfigException;
import io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient;
import io.confluent.kafka.serializers.AbstractKafkaAvroDeserializer;
import io.confluent.kafka.serializers.KafkaAvroDeserializerConfig;
import org.apache.kafka.common.serialization.Deserializer;
import java.util.Collections;
import java.util.List;
@jeffjohnson9046
jeffjohnson9046 / spring-cloud-config-decrypt-curl.sh
Last active August 5, 2019 23:38
Use the Spring Cloud Config service to encrypt/decrypt an encrypted value
# Encrypt
curl -sbiL -X POST http://localhost:8888/encrypt -d '[the value you want to encrypt]'
# Decrypt
curl -sbiL -X POST http://localhost:8888/decrypt -d '[the encrypted value, without the "{cipher}" prefix]'
@Aghassi
Aghassi / docker-compose.yml
Last active July 18, 2024 17:29
LinuxServer Docker Compose: Plex, Sonarr, Radarr, NZBGet, Let's Encrypt, Time Machine
version: '2'
services:
plex:
image: linuxserver/plex
container_name: plex
volumes:
- /path/to/plex/config:/config
- /path/to/plex/Movies:/data/movies
- /path/to/plex/Shows:/data/tvshows
- /path/to/plex/transcode:/data/transcode
FROM alpine:3.7
RUN echo 'http://dl-4.alpinelinux.org/alpine/edge/community/' >> /etc/apk/repositories
ENV PYTHON_VERSION=2.7.14-r2
ENV PY_PIP_VERSION=9.0.1-r1
ENV SUPERVISOR_VERSION=3.3.1
ENV NGINX_VERSION=1.12.2-r3
RUN mkdir /www && mkdir /www/myapp/
@ValentinTrinque
ValentinTrinque / GenericRecordFixtureFactory.java
Created January 23, 2018 17:27
Generate GenericRecord using Avro
import org.apache.avro.Schema;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
public class GenericRecordFixtureFactory {
public static GenericRecord createFromEvent(String siteId, String visitorId, String timestampMs) {
EventMock eventMock = new EventMock();
#!/bin/bash
# Taken from http://rustyautopsy.github.io/rabbitholes/2014/10/21/vmcreate/
# Original author: Travis Dolan
DEFAULT_DISK_SIZE=32
DEFAULT_MEMORY=2048
DEFAULT_SOCKETS=1
DEFAULT_CORES=2
DEFAULT_ISO='ubuntu-14.04-server-amd64.iso'