Skip to content

Instantly share code, notes, and snippets.

View strrife's full-sized avatar

Alexander Mikhalchenko strrife

View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib
import argparse
import imutils
import cv2
import numpy as np
import sys
#!/bin/bash
TIME=`date '+%Y-%m-%d-%H-%M-%S'`
echo "Using Time identifier: $TIME";
INDEX=0
gphoto2 --auto-detect | tail -n +3 | awk '{print $4}' | while read line
do
rm -f capt0000.jpg
@strrife
strrife / slack-space-notofier.php
Created December 12, 2016 13:27
After a few crashes because of no free space left here's a script that notifies you in Slack "errors" channel
<?php
define('THRESHOLD', 80);
$res = shell_exec('/bin/df -h | /bin/grep \'/dev/sda2\' | /usr/bin/awk \'{print $5}\'');
$res = floatval(str_replace('%', '', trim($res)));
if($res > THRESHOLD){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://hooks.slack.com/services/T01234567/B11234567/123456712345671234567');
curl_setopt( $ch, CURLOPT_POSTFIELDS, json_encode([
.stars {
position: relative;
font-size: 20px;
}
.stars.big
{
font-size: 40px !important;
}
@strrife
strrife / .bash_profile
Last active April 11, 2016 19:11
<3 Aliases
alias fuck="sudo"
alias gitf="git fetch"
alias gimme="brew install"
alias vhosts="fuck nano /etc/apache2/extra/httpd-vhosts.conf"
alias jspf="jspm i --unlink --force"
alias rserv="brew services restart
alias a2r="sudo apachectl -k restart"
alias dm="docker-machine"
denv(){
@strrife
strrife / toto.sh
Last active January 25, 2016 19:28
sudo apt-get update -y
sudo apt-get install -y git
sudo gem install sass
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get install -y build-essential tcl8.5
wget http://download.redis.io/releases/redis-stable.tar.gz
sudo apt-get update -y
sudo apt-get install -y git
sudo gem install sass
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm i -g grunt-cli bower forever
sudo npm i -g node-sass
function delay(time) {
return new Promise(function (fulfill) {
setTimeout(fulfill, time);
});
}
@strrife
strrife / 1) Redis
Last active November 18, 2015 19:28 — forked from nghuuphuoc/1) Install
Install Redis on Centos 6
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum -y --enablerepo=remi,remi-test install redis
@strrife
strrife / dead-simple-jquery-mvc.js
Last active November 9, 2015 21:11
jQuery dead-simple mvc.
(function bindDeadSimpleMvc($) {
var updateBindings = function () {
console.log($(this).attr('placeholder'));
$('[data-bind="' + $(this).attr('data-bind-variable') + '"]').html($(this).val());
};
$('input[data-bind-variable]').on('change keyup', updateBindings).each(updateBindings);
})(jQuery);