Skip to content

Instantly share code, notes, and snippets.

View antonfisher's full-sized avatar

Anton Fisher antonfisher

View GitHub Profile
@antonfisher
antonfisher / create-orphan-branch.sh
Created January 25, 2016 00:37
Create orphan branch for github documentation
git checkout --orphan docs
git rm -rf .
git reset
git add ...
git push
git co master
var extJsTT = {
button: {
click: function () {},
is: {
enabled: function () {},
},
wait: {
is: {
enabled: function () {},
},
@antonfisher
antonfisher / mic-to-ssh.sh
Last active December 9, 2015 07:28
BASH mic output piped to ssh
#!/usr/bin/env bash
while true; do
arecord -r 44100 -c 1 2>/dev/null | ssh [email protected] "cat > /tmp/record.fifo";
sleep 1;
done;
@antonfisher
antonfisher / get_full_path.sh
Last active December 4, 2015 10:07
BASH: get_full_file_path
##
# Get full file/directory path
#
# Examples:
# full_path=$(get_full_path '/tmp'); # /tmp
# full_path=$(get_full_path '~/..'); # /home
# full_path=$(get_full_path '../../../'); # /home
#
# @param {String} $1 - relative path
# @returns {String} absolute path
@antonfisher
antonfisher / check_directory_exits.sh
Last active November 20, 2015 09:17
BASH: check_directory_exits
##
# Check directory
# $1 {String} - path
# $2 {Number} - show error
#
# @returns {Number} 0 - exists / 1 - not exists
#
# Example:
# check_directory_exits /tmp 1;
#
@antonfisher
antonfisher / split-vs-sed.js
Created November 10, 2015 08:55
Build in Nodejs split function VS bash 'sed & tr' command
/**
* Usage:
* $npm install shelljs
* $node split-vs-sed.js
*/
/**
* Results:
*
* $ node split-vs-sed.js
// http://jsfiddle.net/antonfisher/qky16fp3/
// For human:
/**
* Get Array key by percentage
*
* getArrayKeyByPercent(["a", "b", "c"], 0) ==> "a"
* getArrayKeyByPercent(["a", "b", "c"], 50) ==> "b"
* getArrayKeyByPercent(["a", "b", "c"], 90) ==> "c"