This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#GIT bash by HABR | |
export PSORIG="$PS1" | |
function GITCHECK() { | |
STATUS=$(git status 2> /dev/null) | |
if [ -n "$STATUS" ] ; then | |
BRANCH="$(echo "$STATUS" | head -n1 | awk '{print $4}')" | |
export PS1=$PSORIG$(echo -en "\[\033[01;33m\]$BRANCH > \[\033[00m\]") | |
else | |
export PS1="$PSORIG" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#GIT bash by HABR | |
export PSORIG="$PS1" | |
function GITCHECK() { | |
STATUS=$(git status 2> /dev/null) | |
if [ -n "$STATUS" ] ; then | |
BRANCH="$(echo "$STATUS" | head -n1 | awk '{print $4}')" | |
export PS1=$PSORIG$(echo -en "\[\033[01;33m\]$BRANCH > \[\033[00m\]") | |
else | |
export PS1="$PSORIG" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
changelog = "!git tag -l v* -n20 | sed -n 'H;${;g;s/\\n[^v]/\\x00/g;p}' | sort -rV | tr \\\\000 \\\\n | less" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
phpunit --log-json php://stdout unit/ | awk '$NF ~ '/,/' && $1 ~ /"(test|time)"/' | cut -d: -f2- | sed "N;s/\n/--/" | sed "s/,//"| awk 'BEGIN{FS="--"}; {print $2 $1}' | sort -r | head -n 20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$redis = new Redis(); | |
var_dump($redis->connect('127.0.0.1')); | |
echo 'Parent pid: ' . getmypid() . PHP_EOL; | |
set_error_handler(function($errno, $errstr, $errfile, $errline) { | |
echo 'Error in PID ' . getmypid() . ': ' . $errstr . PHP_EOL; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
require('v8').setFlagsFromString('--harmony_destructuring'); | |
const assert = require('assert'); | |
function formatSizeSI(size) { | |
var index = Math.floor(Math.log(Math.abs(size)) / Math.log(1000)) | 0; | |
return +(size / Math.pow(1000, index)).toPrecision(3) + ' ' | |
+ (index ? 'kMGTPEZY'[--index] + 'B' : 'Bytes'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
apt-key adv --keyserver keyserver.ubuntu.com --recv A15703C6 | |
echo "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.3 main" | tee /etc/apt/sources.list.d/mongodb-org-3.3.list | |
apt-get update | |
#apt-get install -y mongodb-org | |
apt-get install -y mongodb-org-unstable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$$('video').forEach(v => v.playbackRate = 1.4) |