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 / SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B
Created December 3, 2014 17:32
Fix for windows to install compass, if you spot WARNING: : SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed ; Once downloaded - run set SSL_CERT_FILE=C:\Ruby200-x64\cacert.pem
require 'net/http'
# create a path to the file "C:\Ruby200-x64\cacert.pem"
cacert_file = File.join(%w{c: Ruby200-x64 cacert.pem})
Net::HTTP.start("curl.haxx.se") do |http|
resp = http.get("/ca/cacert.pem")
if resp.code == "200"
open(cacert_file, "wb") { |file| file.write(resp.body) }
puts "\n\nA bundle of certificate authorities has been installed to"
@Voronenko
Voronenko / imagemagick
Created December 24, 2014 18:31
Install imagemagick on ubuntu 14.04 from source
sudo apt-get install build-essential checkinstall && sudo apt-get build-dep imagemagick -y
wget http://www.imagemagick.org/download/ImageMagick-6.9.0-0.tar.gz
tar xzvf ImageMagick-6.9.0-0.tar.gz
cd ImageMagick-6.9.0-0/
./configure --prefix=/opt/imagemagick-6.9 && make
sudo checkinstall
@Voronenko
Voronenko / error: Unable to find vcvarsall.bat
Created February 6, 2015 11:44
error: Unable to find vcvarsall.bat
Visual Studio 2010 (VS10): SET VS90COMNTOOLS=%VS100COMNTOOLS%
Visual Studio 2012 (VS11): SET VS90COMNTOOLS=%VS110COMNTOOLS%
Visual Studio 2013 (VS12): SET VS90COMNTOOLS=%VS120COMNTOOLS%
@Voronenko
Voronenko / ssh keys
Last active August 29, 2015 14:14
Copy SSH pub key to remote PC for key based login
cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
# ssh -fNg -L 3307:127.0.0.1:3306 b@B
@Voronenko
Voronenko / ThinkPad HDD Activity indicator
Created February 13, 2015 09:19
HDD activity indicator for Thinkpad w/o hdd activity indicator
// This script flashes the ThinkPad light when there is hard drive activity.
// Run this command to compile it:
// g++ -Wall -Wextra -O2 -o hdd_led hdd_led.cc
// Then run as root.
//
// Script by Dan Stahlke, [email protected]. BSD license. No warranty.
#include <string>
#include <fstream>
#include <iostream>
@Voronenko
Voronenko / repair_mongo
Last active August 29, 2015 14:15
Dirty mongo repair script
#!/bin/sh
sudo rm /var/lib/mongodb/mongod.lock 
sudo -u mongodb mongod -f /etc/mongod.conf --repair
@Voronenko
Voronenko / Postgre_lis_ user_defined_types.sql
Created February 25, 2015 21:43
Postgre list user defined types
SELECT n.nspname AS schema,
pg_catalog.format_type ( t.oid, NULL ) AS name,
t.typname AS internal_name,
CASE
WHEN t.typrelid != 0
THEN CAST ( 'tuple' AS pg_catalog.text )
WHEN t.typlen < 0
THEN CAST ( 'var' AS pg_catalog.text )
ELSE CAST ( t.typlen AS pg_catalog.text )
END AS size,
@Voronenko
Voronenko / gist:784ed56e1093f05e9b0d
Last active August 29, 2015 14:19
sudo for devops - prevent from asking passwords
#make sure slavko is added to sudoers group
# sudo usermod -aG sudo <username>
# Allow members of group sudo to execute any command without asking password
#%sudo ALL=(ALL:ALL) ALL
%sudo ALL=(ALL) NOPASSWD:ALL
#allow specific user to do so without password, where slavko is the username
slavko ALL=(ALL) NOPASSWD: ALL
@Voronenko
Voronenko / findport
Created April 24, 2015 10:50
Find first unused port above ...
#!/bin/bash
ss -tln |
awk 'NR > 1{gsub(/.*:/,"",$4); print $4}' |
sort -un |
awk -v n=3000 '$0 < n {next}; $0 == n {n++; next}; {exit}; END {print n}
@Voronenko
Voronenko / crontab_allusers
Created April 29, 2015 10:17
List crontab entries for all users
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done