Skip to content

Instantly share code, notes, and snippets.

@ivan1911
ivan1911 / Default (OSX).sublime-keymap
Last active December 19, 2015 09:29
Sublime Text 3 Keybindings
[
{ "keys": ["super+e"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} },
{ "keys": ["super+shift+b"], "command": "expand_selection", "args": {"to": "brackets"} },
{ "keys": ["super+b"], "command": "move_to", "args": {"to": "brackets"} },
{ "keys": ["super+k"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["super+r"], "command": "show_panel", "args": {"panel": "replace"} },
{ "keys": ["super+shift+r"], "command": "replace_next" },
{ "keys": ["super+s"], "command": "save" },
{ "keys": ["super+shift+s"], "command": "prompt_save_as" },
{ "keys": ["super+u"], "command": "upper_case" },
@ivan1911
ivan1911 / Preferences.sublime-settings
Last active December 19, 2015 09:29
Sublime Text 3 Preferences file
{
"close_windows_when_empty": false,
"color_scheme": "Packages/Colorscheme/Twilight.tmTheme",
"find_selected_text": true,
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
@ivan1911
ivan1911 / mtd.py
Created May 16, 2013 13:28
MtD string search
#! /usr/bin/env python
# -*- coding: utf-8 -*-
""" 4 mtd """
str = 'magga pes "mtd tozhe"'
print str[str.find('"'):];
@ivan1911
ivan1911 / mtd_parse.py
Created April 11, 2013 14:46
korean parse
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
import lxml.html
f = open('in.htm', 'r')
html = f.read()
f.close()
doc = lxml.html.document_fromstring(html)
for tr in doc.xpath('//*[@style="border: 1px solid rgb(178, 178, 178); width: 70px; height: 40px; overflow: hidden; margin-left: 5px;"]'):
@ivan1911
ivan1911 / obf.php
Created April 10, 2013 08:37
Simple php obfuscator
<?php
$infile=$_SERVER['argv'][1];
$outfile=$_SERVER['argv'][2];if (!$infile || !$outfile) {
    die("Usage: php {$_SERVER['argv'][0]} <input file> <output file>\n");}
echo "Processing $infile to $outfile\n";
$data="ob_end_clean();?>";
$data.=php_strip_whitespace($infile);
// compress data
$data=gzcompress($data,9);
// encode in base64
@ivan1911
ivan1911 / declofnum.js
Last active June 5, 2016 12:45 — forked from realmyst/gist:1262561
Javascript склонение для числительных
function declOfNum(number, titles) {
cases = [2, 0, 1, 1, 1, 2];
return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
}
use:
declOfNum(count, ['найдена', 'найдено', 'найдены']);