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 / 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! "
#!/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 #####
<?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;
SED_EXPR='s/^\([A-Z0-9_]*\)=\(.*\)$/export \1="\2"/g'
printenv | sed "$SED_EXPR" > $ENV_FILE
@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
@paunin
paunin / coverage-checker.php
Last active December 12, 2015 04:27
phpunit-covergae-checker.php
#!/usr/bin/env php
<?php
// http://ocramius.github.io/blog/automated-code-coverage-check-for-github-pull-requests-with-travis/
$inputFile = $argv[1];
$percentage = min(100, max(0, (int) $argv[2]));
if (!file_exists($inputFile)) {
throw new InvalidArgumentException('Invalid input file provided');
}
if (!$percentage) {
throw new InvalidArgumentException('An integer checked percentage must be given as second parameter');
@paunin
paunin / Compare.php
Last active August 29, 2015 14:10
Comarer 2 files
<?php
namespace Compare;
/**
* нужно написать программу которая сравнивает два текстовых файла (терабайтных)
* и выводит в третий файл строки, которые есть в первом, но нет во втором.
*
* To run this utility just run `php ./Compare.php input_file1.txt input_file2.txt output_file.txt`
*/
class Compare
@paunin
paunin / callgraph.php
Last active September 28, 2018 07:06
xhprof usages
<?php
require_once(__DIR__.'/vendor/XhProf/xhprof_html/callgraph.php');
@paunin
paunin / frontend-app_angtest.html
Last active August 29, 2015 14:07
Angular mix
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script src="https://code.angularjs.org/1.2.26/angular-route.js"></script>
<script src="app.js"></script>
</head>
<body ng-app="app2">
@paunin
paunin / prepare-commit-msg.sh
Last active August 29, 2015 14:05
git hook prepare-commit-msg
#!/bin/sh
# @author paunin
# @url http://paunin.com
# @require jq[http://stedolan.github.io/jq/]
# @require curl
RM_KEY=""
RM_URL=""