Skip to content

Instantly share code, notes, and snippets.

View creotiv's full-sized avatar

Andrey Nikishaev creotiv

View GitHub Profile
@creotiv
creotiv / gulpfile.js
Created October 14, 2015 09:39 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
<?php
class ImageDiff {
// not bigger 20
private $matrix = 15;
public function getImageInfo($image_path){
list($width, $height, $type, $attr) = getimagesize($image_path);
$image_type = '';
@creotiv
creotiv / gist:10103885
Created April 8, 2014 09:21 — forked from ivanvanderbyl/gist:4222308
Postgres update from 9.1 to 9.2
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
@creotiv
creotiv / backup.sh
Created September 23, 2013 11:01 — forked from karussell/backup.sh
# TO_FOLDER=/something
# FROM=/your-es-installation
DATE=`date +%Y-%m-%d_%H-%M`
TO=$TO_FOLDER/$DATE/
echo "rsync from $FROM to $TO"
# the first times rsync can take a bit long - do not disable flusing
rsync -a $FROM $TO
# now disable flushing and do one manual flushing
@creotiv
creotiv / pyperclip.py
Created April 22, 2012 19:09 — forked from rafacv/pyperclip.py
Unified interface to access clipboard across major OSes
# Source: http://coffeeghost.net/2010/10/09/pyperclip-a-cross-platform-clipboard-module-for-python/
# Pyperclip v1.3
# A cross-platform clipboard module for Python. (only handles plain text for now)
# By Al Sweigart al@coffeeghost.net
# Usage:
# import pyperclip
# pyperclip.copy('The text to be copied to the clipboard.')
# spam = pyperclip.paste()