Skip to content

Instantly share code, notes, and snippets.

View paunin's full-sized avatar
🦄
Unicorns engineering!

Dmitriy Paunin paunin

🦄
Unicorns engineering!
View GitHub Profile
@paunin
paunin / config-changer.sh
Last active December 29, 2016 14:26
Simple config(.conf or .ini) changer
#CONFIGS= #in format variable1:value1[,variable2:value2[,...]]
#CONFIG_FILE= #path to file
echo "
#------------------------------------------------------------------------------
# AUTOGENERATED
#------------------------------------------------------------------------------
" >> $CONFIG_FILE
SED_EXPR='s/^\([A-Z0-9_]*\)=\(.*\)$/export \1="\2"/g'
printenv | sed "$SED_EXPR" > $ENV_FILE
<?php
/**
* Class WeekTimestamp
*/
final class WeekTimestamp
{
const SECONDS_IN_MINUTE = 60;
const SECONDS_IN_HOUR = self::SECONDS_IN_MINUTE * 60;
const SECONDS_IN_DAY = self::SECONDS_IN_HOUR * 24;
#!/bin/bash
DOCKER_COMPOSE_FILES='docker-compose1.yml,docker-compose2.yml'
DOCKER_COMPOSE_UP_MODE=1 #1|0
DOCKER_COMPOSE_UP_LOG_FILE='/tmp/log.txt'
DOCKER_COMPOSE_BUILD_OPTIONS="" #any options for `docker-compose build`
DOCKER_COMPOSE_UP_OPTIONS="" #any options for `docker-compose up`
DOCKER_COMPOSE_RUN_OPTIONS="" #any options for `docker-compose run`
TEST_CONTAINERS="application1=/test.sh,application2=/test2.sh"
##### get port remover #####
@paunin
paunin / organize.sh
Last active February 28, 2020 01:14
Organizing exported from *.photoslibrary pictures
#!env bash
#https://gist.github.com/paunin/e4f9f01a1cfcfc99828b75d4fd29ac96
# Export files from apple *.photoslibrary (File->Export Unmodified Original) with options "Subfolder Format = Moment Name"
# Run the script against the folder where the images were exported.
# Subfolders will be renamed from format `{MOMENT_NAME}, d Month YYYY` to `YYYY.mm.dd[{MOMENT_NAME}]`
# example: `Da Lat - Phường 8 - Tỉnh Lâm Đồng, 3 May 2016` => 2016.05.03[Da Lat - Phường 8 - Tỉnh Lâm Đồng]
DIR=$1
if [[ "$DIR" == "" ]]; then
echo "Error: please pass \$1 for directory to organize! "