Skip to content

Instantly share code, notes, and snippets.

View revilon1991's full-sized avatar
🐈
work hard, play hard

Evgenii Kuznetsov revilon1991

🐈
work hard, play hard
View GitHub Profile
@seanblanchfield
seanblanchfield / gcal_countries.py
Created July 29, 2021 14:27
Google calendar public holiday names by country
# Complete mapping of ISO 3166 2-letter country codes to descriptions used in Google calendar URLs, accurate as of 29 July 2021.
iso_to_gcal_description = {
"ad": "ad",
"ae": "ae",
"af": "af",
"ag": "ag",
"ai": "ai",
"al": "al",
"am": "am",
@stemar
stemar / varexport.php
Last active December 22, 2022 05:06
PHP var_export() with short array syntax (square brackets) indented 2 spaces.
<?php
/**
* PHP var_export() with short array syntax (square brackets) indented 2 spaces.
*
* NOTE: The only issue is when a string value has `=>\n[`, it will get converted to `=> [`
* @link https://www.php.net/manual/en/function.var-export.php
* @param mixed $expression
* @param bool $return
* @return string
*/
@cn0047
cn0047 / benchmark.plainGoVsGin.md
Last active December 18, 2023 10:51
Plain Go vs Gin

Plain Go vs Gin

The aim of this benchmark is to answer the question do you need framework for your tiny microservice.

Prerequisites

Let's consider simple example where we need framework only to parse URL (someone may decide that it's sufficient reason to start use framework for tiny microservice).

@ziishaned
ziishaned / output.json
Last active May 21, 2024 15:57
Build a tree from a flat array in PHP
{
"5a969a6fe799f7cbe9083122": {
"_id": "5a969a6fe799f7cbe9083122",
"name": "Tajawal",
"parent": null,
"created_by": "5a8d84b8e799f70a157f8211",
"update_at": "1519819375891",
"created_at": "1519819375891",
"children": {
"5a969f5ce799f7cbe9083123": {
@ewjoachim
ewjoachim / stop-old-containers.sh
Created June 1, 2017 13:27
Stop docker containers older than 1 day old
#!/bin/bash -eux
yesterday=$(date -d yesterday +%s)
# dnsdock should not be stopped : we limit to the containers created after it
docker ps --filter since=dnsdock -q --format "{{.ID}} {{.CreatedAt}}" | while read line
do
# line looks like:
# 123456789abcdef 2017-01-01 00:00:00 +02:00 CEST
set $line
id=$1
storefront = {
'AL':'143575',
'DZ':'143563',
'AO':'143564',
'AI':'143538',
'AG':'143540',
'AR':'143505',
'AM':'143524',
'AU':'143460',
'AT':'143445',
United States 143441
Argentina 143505
Australia 143460
Belgium 143446
Brazil 143503
Canada 143455
Chile 143483
China 143465
Colombia 143501
Costa Rica 143495