Skip to content

Instantly share code, notes, and snippets.

View h4's full-sized avatar
💭
I may be slow to respond.

Mikhail Baranov h4

💭
I may be slow to respond.
View GitHub Profile
@h4
h4 / FhGae.markdown
Created May 21, 2014 08:50
A Pen by Mikhail Baranov.
@h4
h4 / vim.txt
Created June 3, 2014 11:52
Vim cheatsheet
Файл настройки: ~/.vimrc
Можно редактировать файлы через сеть, например
:e <scp|ftp|ftps>://user@host/path/to/the/file.txt
:Ex или :e ./ - файловый менеджер
hjkl перемещение в разные стороны
i режим вставки
I добавление в начало строки
a режим добавления
A добавление в конец строки
@h4
h4 / jscs.json
Last active August 29, 2015 14:05
node-jscs/issues/589
{
"requireCurlyBraces": [ "if", "else", "for", "while", "do", "try", "catch" ],
"requireSpaceAfterKeywords": [ "if", "else", "for", "while", "do", "switch", "return", "try", "catch" ],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true },
"disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true },
"requireMultipleVarDecl": true,
"requireBlocksOnNewline": true,
@h4
h4 / form.js
Created August 28, 2014 12:34
/**
* Data collection class
* @param serialized
* @param promise
* @constructor
*/
var Data = function(serialized, promise) {
serialized || (serialized = {});
this._promise = promise;
@h4
h4 / injected-script.js
Created September 19, 2014 08:35
Coast bug
/*
/// #import "webview.js"
*/
window.OperaIce||(window.OperaIce={});OperaIce.Navigation||(OperaIce.Navigation={});
OperaIce.Navigation.BodyClickNotifier=function(){this.lastClickEvent=null;this.onClick=function(b){if(b&&b.target){var a=b.target;if("INPUT"!=a.tagName.toUpperCase()||"submit"!=a.type.toLowerCase()&&"button"!=a.type.toLowerCase()){var a=this.targetRect(a),c=this.screenSize();this.lastClickEvent=b;OperaIce.WebView.performCallback("document-onclick",a,c)}}};this.register=function(){var b=this;document.addEventListener("click",function(a){b.onClick(a)},!1)};this.targetRect=function(b){var a=b.getBoundingClientRect(),
a={top:a.top,left:a.left,width:Math.round(a.width),height:Math.round(a.height)};try{for(;b=b.ownerDocument.defaultView.frameElement;){var c=getComputedStyle(b,null),d=b.getBoundingClientRect();a.top+=d.top+parseFloat(c.borderTopWidth)+parseFloat(c.paddingTop);a.left+=d.left+parseFloat(c.borderLeftWidth)+parseFloat(c.paddingLeft)}a.top=Math.round(a.top);a.left=Math.round(a.left)}catch
@h4
h4 / error.log
Created September 23, 2014 18:22
Indeed-vagrant
==> default: Successfully added box 'hashicorp/precise64' (v1.1.0) for 'virtualbox'!
==> default: Importing base box 'hashicorp/precise64'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["import", "/Users/h4/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/box.ovf", "--vsys", "0", "--vmname", "precise64_1411496426411_2197", "--vsys", "0", "--unit", "9", "--disk", "/Volumes/Truck/Users/h4/VirtualBox VMs/precise64_1411496426411_2197/box-disk1.vmdk"]
Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /Users/h4/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise64/1.1.0/virtualbox/box.ovf...
OK.
@h4
h4 / convert-new-raw
Created September 25, 2014 19:43
Автоматическое извлечение превью из nef-файлов
#!/usr/bin/env bash
LOG_FILE=/var/log/conver-new-raw.log
# echo "$# $%" >> $LOG_FILE
inotifywait -e delete -e create -r -m $1 | while read dir events file; do
filepath=$dir$file
previewpath=$dir"jpg/"
deletedpath=$previewpath"__deleted/"
@h4
h4 / builder.js
Created October 30, 2014 15:41
stylus base64
var stylus = require('stylus');
var fs = require('fs');
var str = fs.readFileSync('contacts/contacts.styl', {encoding: 'utf-8'});
console.log(__dirname);
stylus(str)
.set('filename', __dirname + '/contacts/contacts.styl')
.define('url', stylus.url()) // Включает base64
@h4
h4 / add.txt
Last active August 29, 2015 14:09
udev
UDEV [7270.882870] change /devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0/block/sdc (block)
ACTION=change
DEVLINKS=/dev/disk/by-id/usb-Generic_USB_SD_Reader_058F312D81B-0:0 /dev/disk/by-path/pci-0000:00:1a.7-usb-0:1:1.0-scsi-0:0:0:0
DEVNAME=/dev/sdc
DEVPATH=/devices/pci0000:00/0000:00:1a.7/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0/block/sdc
DEVTYPE=disk
DISK_MEDIA_CHANGE=1
ID_BUS=usb
ID_INSTANCE=0:0
ID_MODEL=USB_SD_Reader
@h4
h4 / gist:584f09d533be5ae2d63a
Last active August 29, 2015 14:09
oksva modules
aggregator
block
blog
book
color
comment
contact
contextual
dashboard
dblog