Skip to content

Instantly share code, notes, and snippets.

View vol4ok's full-sized avatar

Andrew Volkov vol4ok

View GitHub Profile
@vol4ok
vol4ok / Cakefile
Created December 20, 2012 08:50
Cakefile loader
build = (opt) ->
console.log "build!"
if task?
console.log "task"
task "sbuild", ->
build()
else
console.log "exports"
exports.build = build
@vol4ok
vol4ok / gist:4952077
Created February 14, 2013 11:01
extract mp3 audio from video files
for f in *.mp4
ffmpeg -i "$f" -ab 32k -ac 1 -acodec mp3 -vn "${f%.*}.mp3"
done
@vol4ok
vol4ok / gist:5270397
Last active December 15, 2015 13:49
Mac OS X Lion: How to clean up the 'Open With' menu
  1. Execute:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
  1. Relaunch the Finder
{
"working_dir": "${project_path}",
"path": "C:\\Program Files\\nodejs;C:\\Users\\<USER_NAME>\\AppData\\Roaming\\npm",
"cmd": ["grunt", "--no-color"],
"shell": true
}
@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"
@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 / 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 / _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 / 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;
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++ ))