Skip to content

Instantly share code, notes, and snippets.

View Sonique's full-sized avatar

Vitaly Larchenkov Sonique

View GitHub Profile
# Script dir for script relative path
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
@Sonique
Sonique / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Sonique
Sonique / simple_timer.java
Last active August 29, 2015 14:13
Simple Java code execution timer
// Basic
long start = System.currentTimeMillis();

long end = System.currentTimeMillis();
// Stopwatch
Stopwatch stopwatch = new Stopwatch();
double time = stopwatch.elapsedTime();
// #java #timer #stopwatch
@Sonique
Sonique / git-post-receive-master-to-production-hook.sh
Last active August 29, 2015 14:03
Put files from master branch to production folder
#!/bin/bash
echo "================================="
echo "Post-receive script: START"
WORK_TREE="/site/folder"
GIT_DIR="/home/git/repos/site.git"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ $branch == "master" ]; then
echo "Branch determined as master."