Skip to content

Instantly share code, notes, and snippets.

View sokil's full-sized avatar
🇺🇦
sapere aude

sokil

🇺🇦
sapere aude
View GitHub Profile
@sokil
sokil / SignalHandler.php
Last active January 26, 2024 15:07
Handle signals by dispatcher or ticks
<?php
class SignalHandler
{
/**
* @var bool
*/
private $isRunning;
/**
@sokil
sokil / docker.sh
Last active August 7, 2017 20:01
Docker images:
# Mysql
docker run --name="MYSQL" --rm -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD="yes" mysql/mysql-server:5.7
# Redis
docker run --name="REDIS" -p=7780:6379 -d redis redis-server
# filter services by name
docker ps -a -f NAME=sentry --format "{{.Names}}"
@sokil
sokil / git_commit_date.sh
Last active August 2, 2017 10:53
Change git commit date
#!/bin/bash
# show commiter date and authot date
git log --format=fuller
# commit 0b4cbb6028d413b582c8710166ff66a3fc56f80e
# Author: Dmytro Sokil <[email protected]>
# AuthorDate: Wed Aug 2 09:19:06 2017 +0300
# Commit: Dmytro Sokil <[email protected]>
# CommitDate: Wed Aug 2 09:19:06 2017 +0300
@sokil
sokil / merge_lists.sh
Created July 28, 2017 14:42
merge_lists.sh
#!/bin/bash
bitbuckerRepoUrlList=$(cat $PROJECT_DIR/composer.json | grep bitbucket.com | awk -F'"' '{print $4}')
githubRepoUrlList=$(cat $PROJECT_DIR/composer.json | grep github.com | awk -F'"' '{print $4}')
set -- $bitbuckerRepoUrlList $githubRepoUrlList$armRepos \
"ssh://[email protected]:2600/repo1.git" \
"ssh://[email protected]:2600/repo2.git" \
"ssh://[email protected]:2600/repo3.git"
@sokil
sokil / nginx.conf
Last active July 12, 2017 19:46
Maintenance Nginx Page
server
{
listen 80;
server_name server.com.ua;
location /
{
try_files $uri @underconstruction;
}
@sokil
sokil / check.sh
Created June 23, 2017 09:33
Check list of domains for existance
cat siteDomains | xargs -I{} bash -c "ping -c 1 {} > /dev/null 2>&1 && echo {} 'ok' || echo {} 'er'"
@sokil
sokil / clone.sql
Created June 19, 2017 08:24
Clone rows
-- create temporary table
create temporary table cloned_rows_table like source_table;
-- clone some tows to temporary table
insert into cloned_rows_table select * from source_table where some_condition = 42;
-- apply some data modifications to cloned_rows_table
-- ....
-- regenerate auto increment id
#!/bin/sh
branchName=`git rev-parse --abbrev-ref HEAD`
taskNumber=`echo $branchName | awk -F'-' '{print $4 "-" $5}'`
taskSubject=`echo $branchName | awk -F'-' '{print $6}' | sed 's/_/ /g'`
commitMessageFile=$1
commitMode=$2
messageInFile=`cat $commitMessageFile`
# $2 is the commit mode
@sokil
sokil / schema.sql
Created June 1, 2017 06:06
Table schema
-- Table status
show table status;
-- same as
SELECT * FROM information_schema.tables WHERE table_schema = DATABASE();
@sokil
sokil / ssh.sh
Last active May 12, 2017 19:02
SSH keys
# Local:
ssh-keygen -t rsa
scp ~/.ssh/id_rsa.pub [email protected]://home/user/.ssh
# ssh remoteserver.com
# Remote:
cd ~/.ssh
cat .ssh/id_rsa.pub >> .ssh/authorized_keys