Skip to content

Instantly share code, notes, and snippets.

View butuzov's full-sized avatar
🇺🇦

Oleg Butuzov butuzov

🇺🇦
  • Kyiv, Ukraine
View GitHub Profile
@butuzov
butuzov / uri.js
Created August 27, 2015 07:54
URI Parsing with Javascript (alternative)
function parse_url(url) {
/* Dom parsing of A
based at https://gist.github.com/jlong/2428561
*/
var parser = document.createElement('a');
parser.href = url;
/* Exception for user:password */
var re = /(\/\/)(.+?)((:(.+?))?)@/i;
if ( re.exec(url) ){
@butuzov
butuzov / setup-dev.sh
Created October 4, 2015 09:37
Install homebrew, nginx, mysql, php55, and composer on Mac OS X
#!/bin/bash
# install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
@butuzov
butuzov / wp-query-ref.php
Created September 11, 2016 11:28 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@butuzov
butuzov / Installing Google Test on Mac.md
Last active April 4, 2024 10:08
Bash Script to install Google Test and Google Mock on Mac

Installing Google Test on Mac

One bash script to install google test (and mock) on your Mac. I assume you already had install cmake (if not, use brew - brew install cmake).

It use brew directories to store gmock and gtest.

gtest_installer.sh

#!/usr/bin/env bash

Java Exception Example UnexceptableInputException.java

class UnexceptableInputException extends Exception{
	public UnexceptableInputException() {}

	public UnexceptableInputException(String message){
		super(message);
	}
}
@butuzov
butuzov / mp3 to m4b.md
Created August 10, 2018 06:07
Convert mp3's to m4b using `ffmpeg`

Let's imagine we have a lot of mp3 files ( forexample one of the pluralsite courses converted to mp3 ).

URL=https://www.pluralsight.com/courses/run-effective-meetings
PASS=pass
USER=user
OUTPUT="%(playlist_index)s. %(title)s-%(id)s.%(ext)s"
youtube-dl --username $USER --password $PASS -o $OUTPUT --extract-audio --audio-format mp3 $URL
@butuzov
butuzov / gopak.md
Created February 24, 2019 09:15
`gopak` - Go PAth Kommander

Code

You can add this code to you .bashrc or something...

# Go PAth Commander?
# I am so terrible with pans-naming
# https://en.wikipedia.org/wiki/Hopak
gopak(){
@butuzov
butuzov / readme.md
Last active November 11, 2019 11:55
Jupyter Notebook Go Kernel

Installing Go kernel for Jupyter notebooks

brew install zeromq
brew install pkg-config
https://github.com/gopherdata/gophernotes
go get -u github.com/gopherdata/gophernotes
mkdir -p ~/Library/Jupyter/kernels/gophernotes
p $GOPATH/src/github.com/gopherdata/gophernotes/kernel/* ~/Library/Jupyter/kernels/gophernotes
@butuzov
butuzov / version_compare.sh
Created August 16, 2019 08:34
(bash) Compare Version in `Major.Minor.Patch`
# Compare two versions, in version format Major.Minor.Patch
# It doesn't validate version format, only compare values.
#
# Usage :
# version_compare <compared> <required>
#
# Example:
# version_compare 0.13.1 0.11.0
#
# returns

Output of dinamic inventory.

> ./hosts
{
    "kube-master": [
        "master-1"
    ],
    "kube-node": [
        "node-sml-1",