Skip to content

Instantly share code, notes, and snippets.

View Voronenko's full-sized avatar
turning coffee into code since late 90s

Vyacheslav Voronenko

turning coffee into code since late 90s
View GitHub Profile
@Voronenko
Voronenko / aws_elb_get_instance_public_ips
Created August 26, 2015 19:53
Get public IPs of the instances currently linked to aws load balancer named LB1
aws elb describe-instance-health --load-balancer-name bla --region us-east-1 | awk '{ print $2 }' | grep "i-" | cut -d '=' -f 2 | sed -e 's/,$//' | xargs aws ec2 describe-instances --instance-id | grep PublicIpAddress | awk '{print $2}' | cut -d '=' -f 2 | sed -e 's/,$//'
# 172.25.24.104 = your local ip address
ACCEPT loc:172.25.24.104 net tcp 9418
@Voronenko
Voronenko / dirty cmd string replace
Created March 12, 2014 16:07
This example copies Vagrantfile and fixes relative path in target file
@echo off
setlocal enabledelayedexpansion
set INTEXTFILE=.kitchen\kitchen-vagrant\default-precise32-vsdev\Vagrantfile
set OUTTEXTFILE=Vagrantfile
set SEARCHTEXT=../../../
set REPLACETEXT=
set OUTPUTLINE=
for /f "tokens=1,* delims=¶" %%A in ( '"type %INTEXTFILE%"') do (
SET string=%%A
@Voronenko
Voronenko / remove_all_gems_windows
Created March 13, 2014 09:43
Remove all gems windows
ruby -e "`gem list`.split(/$/).each { |line| puts `gem uninstall -Iax #{line.split(' ')[0]}` unless line.empty? }"
# npm update -g npm fails with unmet semver dependencies? You have an older version of normalize-package-data,
curl https://npmjs.org/install.sh | sh
vagrant up
vagrant vbguest --do install --iso https://www.virtualbox.org/download/testcase/VBoxGuestAdditions_4.3.11-93070.iso
@Voronenko
Voronenko / gist:11401123
Created April 29, 2014 13:56
ubuntu 12.04 with built in chef minimal setup
Vagrant.configure("2") do |c|
c.vm.box = "opscode-ubuntu-12.04"
c.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box"
c.vm.hostname = "default-ubuntu-1204.vagrantup.com"
c.vm.synced_folder ".", "/vagrant", disabled: true
c.vm.provider :virtualbox do |p|
end
end
apt-get install -y curl
# Install nginx
if [ "xx" = "x$(grep 'nginx' /etc/apt/sources.list )x" ] ; then
echo 'Installing nginx...'
echo '
# Repositories for up to date nginx packages
deb http://nginx.org/packages/mainline/ubuntu/ precise nginx
deb-src http://nginx.org/packages/mainline/ubuntu/ precise nginx' >> /etc/apt/sources.list
curl -s http://nginx.org/keys/nginx_signing.key | apt-key add -
apt-get update > /dev/null
#!upstart
description "MyApp"
author "Author name"
env PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
respawn
start on runlevel [23]
stop on shutdown
@Voronenko
Voronenko / gitflow-delete-merged-into-develop-branches
Created May 13, 2014 05:52
Delete all obsolete branches, that were already merged into develop on remote
git branch --merged develop | grep -v "\* develop" | xargs -n 1 git branch -d