Skip to content

Instantly share code, notes, and snippets.

View eduard-sukharev's full-sized avatar

Eduard Sukharev eduard-sukharev

  • VK Play
  • Russia, Saint-Petersburg
View GitHub Profile
@eduard-sukharev
eduard-sukharev / auth_code_request.sh
Last active December 27, 2018 14:30
Fetch OAuth2 Authorization code for client and cookie value, urldecoded
#!/bin/bash
authorize_path='oauth2/authorize'
cookie_name='ACC_SID'
redirect_uri=${4:+"redirect_uri=$4"}
if [ "$#" -lt 3 ]; then
echo "Usage is:"
echo ""
echo -e "\033[0;32m$0\033[0;33m host_url client_id COOKIE_VALUE\033[0m"
@eduard-sukharev
eduard-sukharev / api_endpoint_mock.json
Created April 18, 2017 08:37
Easily mock api with wiremock docker container
{
"request": {
"method": "GET",
"urlPathPattern": "/api/blog/?"
},
"response": {
"status": 200,
"body": "[{\"id\":2,\"name\":\"Phasellus nec consectetur tellus.\",\"image\":\"http://blog.example.com/image1.jpg\",\"url\":\"//blog.example.com/post.php?id=19699828\"},{\"id\":1,\"name\":\"Duis facilisis eu metus ut placerat.\",\"image\":\"http://blog.example.com/image2.jpg\",\"url\":\"//blog.example.com/post.php?id=19644237\"}]"
}
}
@eduard-sukharev
eduard-sukharev / markdown2epub.sh
Created March 23, 2017 14:37
Convert Markdown book sources to Epub
#!/bin/sh
# Be sure to remove top level book titles from the beginning of each chapter' file, otherwise
# you'll get blank page with book title and chapter subtitle before each chapter
# Plain markdown allows html tags inclusion for images.
pandoc -o mybook.epub -f markdown -t epub -s --toc --toc-depth=2 ch1.md ch2.md ch3.md metadata.yml
@eduard-sukharev
eduard-sukharev / testrunner
Created January 10, 2017 11:11
Convenience wrapper for running PHPUnit tests in Docker container
#!/bin/bash
filter=${1:+"--filter $1"}
PHPSTORM_SERVER_NAME="project.server.local"
PHPUNIT_CONFIG_PATH="tests/"
DOCKER_IMAGE="company_project_1"
DOCKER_USER="www-data"
PHPUNIT_EXECUTABLE_PATH="bin/phpunit"
docker exec -u $DOCKER_USER $DOCKER_IMAGE bash -c "export TERM=xterm; export PHP_IDE_CONFIG=\"serverName=$PHPSTORM_SERVER_NAME\"; $PHPUNIT_EXECUTABLE_PATH -c $PHPUNIT_CONFIG_PATH $filter"
@eduard-sukharev
eduard-sukharev / 4c173e54-c9e6-4ed8-8674-0da672713704-testsuite.xml
Created December 7, 2016 08:38
Sample allure XML report data to reproduce problems with .something in test steps. Programming Language Agnostic!
<?xml version="1.0" encoding="UTF-8"?>
<alr:test-suite xmlns:alr="urn:model.allure.qatools.yandex.ru" start="1480684292464" stop="1480684651460" version="1.4.0">
<name>TestSuite-2016-12-02_101132</name>
<test-cases>
<test-case start="1480684340540" stop="1480684352813" status="passed">
<name>dotSomethingInTestSteps</name>
<title>Test case to demonstrate the problem of dot-something names of test steps rendered incorrectly</title>
<steps>
<step start="1480684340546" stop="1480684344682" status="passed">
<name>Step with title and something.com at the end</name>
@eduard-sukharev
eduard-sukharev / gso-zipcodes-ranges.tsv
Created February 1, 2016 14:15
Approximate Zipcodes Ranges for supported GSO locations
89118 95364 408.56
89118 96027 754.35
89118 85003 299.039143
89118 85004 299.334916
89118 85006 300.22969
89118 85007 298.323945
89118 85008 302.040987
89118 85009 296.014931
89118 85012 295.750848
89118 85013 294.80885
@eduard-sukharev
eduard-sukharev / dump.sh
Created November 27, 2015 14:21
Quick-n-dirty dumping and restoring postgres states for current GIT branch
#!/bin/bash
default_dump=`git symbolic-ref --short HEAD`
CASE="${1:-$default_dump}"
echo "Dumping to dump_$CASE.tar..."
pg_dump --clean -h localhost -U postgres -F t -f dump_$CASE.tar db_name
echo "Done"
@eduard-sukharev
eduard-sukharev / gist:526e6cba8abcc9ce2651
Last active September 28, 2017 19:14
Convert VCHD into mp4 with ffmpeg 2.6

FFMpeg Commands for Transcoding MTS video (from AVCHD-Lite Cameras, like Panasonic DMC-TS1/2)

Encoding parameters as for static ffmpeg-2.6.1-static build

720p -> H.264 (x264) video + AAC 128kbps audio:

Medium quality 720p:

ffmpeg -i 00001.MTS -threads 3 -y -vcodec libx264 -qscale 0 -acodec libvo_aacenc -ab 128k -ar 44100 -ac 2 -s 1280x720 -b 1M output.mp4

High quality 720p:

@eduard-sukharev
eduard-sukharev / pre-push
Last active January 7, 2017 01:17
Git hook to Prepare PR message when developing with TFS (put into .git/hooks, add executable rights and create pr_messages directory)
#!/bin/sh
# Git hook to:
# Run phpunit tests
# Prepare GitHub formatted PR message with links to TMS
# Copy PR message into KDE clipboard management tool (Klipper)
# put it into .git/hooks, add executable rights and create pr_messages directory
tms_name="JIRA"
tms_prefix="http://jira.com/browse/"