Skip to content

Instantly share code, notes, and snippets.

View vol4ok's full-sized avatar

Andrew Volkov vol4ok

View GitHub Profile
@vol4ok
vol4ok / echoHttpRequest.js
Last active August 29, 2015 14:20 — forked from Marak/echoHttpRequest.js
Echo HTTP requests
module['exports'] = function echoHttp (hook) {
hook.debug("Debug messages are sent to the debug console");
hook.debug(hook.params);
hook.debug(hook.req.path);
hook.debug(hook.req.method);
@vol4ok
vol4ok / gist:fc094e5f95ea5c89c5bb
Last active August 29, 2015 14:01
route all to angular grunt config
var modRewrite = require('connect-modrewrite');
//...
// initConfig -> Connect section
livereload: {
options: {
open: true,
base: [
'.tmp',
@vol4ok
vol4ok / gist:9364446
Last active August 29, 2015 13:57
on ng-repeat finish directive for angular js
angular.module("app").directive("onRepeatFinish", ["$timeout", function($timeout){
return {
restrict: "A",
link: function($scope, $element, $attrs) {
if ($scope.$last) {
$timeout(function(){
if (angular.isFunction($scope[$attrs["onRepeatFinish"]]))
$scope[$attrs["onRepeatFinish"]]()
});
}
mkdir output
i=1
for f in *.jpg *.JPG
do
echo "$f -> photo-$i.jpg"
cp "$f" photo-$i.jpg
gm mogrify -resize 1920x1920 photo-$i.jpg
jpegtran -outfile output/photo-$i.jpg -copy none -optimize -perfect photo-$i.jpg
rm photo-$i.jpg
(( i++ ))
@vol4ok
vol4ok / drv_mgr.c
Created August 20, 2013 09:21
Driver manager module. Allow to load, start, stop and unload driver on all version of Windows
#include <windows.h>
#include "drv_mgr.h"
SC_HANDLE install_driver(const wchar_t *name, const wchar_t *path)
{
SC_HANDLE h_scm;
SC_HANDLE h_svc = INVALID_HANDLE_VALUE;
if (!path || !name)
return INVALID_HANDLE_VALUE;
@vol4ok
vol4ok / _linear-gradient.scss
Created July 31, 2013 10:31
linear-gradient mixin for scss
@mixin linear-gradient($from, $to) {
background: $from;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, $from), color-stop(1, $to));
background: -webkit-linear-gradient(top, $from, $to);
background: -moz-linear-gradient(top, $from, $to);
background: -ms-linear-gradient(top, $from, $to);
background: -o-linear-gradient(top, $from, $to);
background: linear-gradient(top, bottom, $from, $to);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}');
-ms-filter: quote(progid:DXImageTransform.Microsoft.gradient(startColorstr='#{$from}', endColorstr='#{$to}'));
@vol4ok
vol4ok / gist:5727997
Created June 7, 2013 09:01
share local server to remote server via ssh
LOCAL_PORT = 3333
REMOTE_PORT = 2222
SSH_USER_HOST = "foo@var.com"
express = require "express"
{spawn} = require "child_process"
ssh = spawn('ssh', ['-N', '-R', "#{REMOTE_PORT}:localhost:#{LOCAL_PORT}", SSH_USER_HOST])
app = express()
@vol4ok
vol4ok / gist:5487093
Created April 30, 2013 07:11
Show the List of Installed Packages on Ubuntu or Debian and find the locations
dpkg --get-selections
dpkg -L <pkg-name>
@vol4ok
vol4ok / translit.coffee
Created April 19, 2013 09:53
Translit
String::translit = (->
L =
"А": "A", "а": "a", "Б": "B", "б": "b", "В": "V", "в": "v"
"Г": "G", "г": "g", "Д": "D", "д": "d", "Е": "E", "е": "e"
"Ё": "Yo", "ё": "yo", "Ж": "Zh", "ж": "zh", "З": "Z", "з": "z"
"И": "I", "и": "i", "Й": "Y", "й": "y", "К": "K", "к": "k"
"Л": "L", "л": "l", "М": "M", "м": "m", "Н": "N", "н": "n"
"О": "O", "о": "o", "П": "P", "п": "p", "Р": "R", "р": "r"
"С": "S", "с": "s", "Т": "T", "т": "t", "У": "U", "у": "u"
"Ф": "F", "ф": "f", "Х": "H", "х": "h", "Ц": "Ts", "ц": "ts"
{
"working_dir": "${project_path}",
"path": "C:\\Program Files\\nodejs;C:\\Users\\<USER_NAME>\\AppData\\Roaming\\npm",
"cmd": ["grunt", "--no-color"],
"shell": true
}