Skip to content

Instantly share code, notes, and snippets.

View antonbabenko's full-sized avatar
🇺🇦

Anton Babenko antonbabenko

🇺🇦
View GitHub Profile
@antonbabenko
antonbabenko / create_pr.sh
Created April 1, 2014 10:50
How to create PR from command line when diff is very large
curl -u username:password \
--header 'X-GitHub-OTP: your_code_here' \
--request POST \
--data '{"title":"Merge staging into master", "head":"staging", "base":"master"}' \
https://api.github.com/repos/zoozoo-ab/zoozoo/pulls
@antonbabenko
antonbabenko / deploy.rb
Created May 9, 2014 15:53
`symfony:verify_console` task for Capifony to verify if application is bootable
# `symfony:verify_console` task verify if application is bootable (config&parameters.yml contains all required keys).
# It outputs error text if app/console can't boot.
after "symfony:composer:install", "symfony:verify_console"
#################################################################
namespace :symfony do
task :verify_console do
capifony_pretty_print "--> Run app/console to verify if parameters.yml has all required keys and application is runnable"
@antonbabenko
antonbabenko / fontawesome_3_to_4_migration.sh
Created May 13, 2014 11:15
FontAwesome 3.2.1 to 4 migration (using sed)
#!/bin/sh
# This is universal part for all FontAwesome projects (I suppose :)
find src -type f -iname '*.css' -or -iname '*.js' -or -iname '*.twig' -exec sed -i -r \
-e "s,(['\"\t ])icon-fixed-width(['\"\t ]),\1fa-fw\2,g" \
-e "s,(['\"\t ])icon-large(['\"\t ]),\1fa-lg\2,g" \
-e "s,(['\"\t ])icons-ul(['\"\t ]),\1fa-ul\2,g" \
-e "s,(['\"\t ])icon-li(['\"\t ]),\1fa-li\2,g" \
-e "s,(['\"\t ])icon-spin(['\"\t ]),\1fa-spin\2,g" \
@antonbabenko
antonbabenko / upload_public.sh
Last active August 29, 2015 14:04
s3-mp-upload example
#!/bin/sh
time ./s3-mp-upload.py -f -np 10 -s 20 -t 300 --insecure archive.zip s3://builds.antonbabenko.com/archive.zip
s3cmd setacl --acl-public s3://builds.antonbabenko.com/archive.zip
@antonbabenko
antonbabenko / reloadvcl.sh
Last active April 26, 2018 08:47
Watch default.vcl changes and reload on the fly (must-have for working with Varnish locally)
#!/bin/bash
#####
# Watch changes in default.vcl and reload a varnish config:
# sudo su -
# fswatch -o /usr/local/etc/varnish/default.vcl | xargs -n1 /Users/Bob/bin/reloadvcl
####
FILE="/usr/local/etc/varnish/default.vcl"
@antonbabenko
antonbabenko / varnish_version.sh
Created October 2, 2014 17:16
Print current Varnish version sha (tested with version 4)
#!/bin/sh
{ varnishd -V; } 2> version_file ; cat version_file | head -1 | awk '{ print out substr($4, 0, 7) }'
@antonbabenko
antonbabenko / gist:789b71cb1fcaa2e20e67
Last active August 29, 2015 14:11
Crash report - libvmod-cookie SHA 0424757aa69fc8769c50e04d3e24601979cb38b5
Process: varnishd [50834]
Path: /usr/local/Cellar/varnish/4.0.2/sbin/varnishd
Identifier: varnishd
Version: 0
Code Type: X86-64 (Native)
Parent Process: varnishd [50225]
Responsible: varnishd [50834]
User ID: -2
Date/Time: 2014-12-11 21:53:15.438 +0100
@antonbabenko
antonbabenko / sns.php
Created March 9, 2016 19:46
Debug SNS messages
<?php
// Fetch the raw POST body containing the message
$postBody = file_get_contents('php://input');
error_log($postBody);
// JSON decode the body to an array of message data
$message = json_decode($postBody, true);
if ($message) {
@antonbabenko
antonbabenko / write_comment.sh
Created May 31, 2016 08:54
Write comment to github PR
curl -H "Authorization: token $GITHUB_TOKEN" \
-X POST https://api.github.com/repos/antonbabenko/myrepo/issues/123/comments \
--data '{"body": "Nice change"}'
@antonbabenko
antonbabenko / crash.log
Created August 10, 2016 11:23
Terraform 0.7.0 crash report
2016/08/10 13:16:58 [INFO] Terraform version: 0.7.0
2016/08/10 13:16:58 [DEBUG] Detected home directory from env var: /Users/Bob
2016/08/10 13:16:58 [DEBUG] Detected home directory from env var: /Users/Bob
2016/08/10 13:16:58 [DEBUG] Attempting to open CLI config file: /Users/Bob/.terraformrc
2016/08/10 13:16:58 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/08/10 13:16:58 [DEBUG] Detected home directory from env var: /Users/Bob
2016/08/10 13:16:59 [WARN] Ignoring AWS metadata API endpoint at default location as it doesn't return any instance-id
2016/08/10 13:16:59 [TRACE] Graph after step *terraform.ConfigTransformer:
data.terraform_remote_state.application - *terraform.GraphNodeConfigResource