Skip to content

Instantly share code, notes, and snippets.

View funivan's full-sized avatar
⌨️
deliver bits

Ivan Shcherbak funivan

⌨️
deliver bits
View GitHub Profile
@funivan
funivan / CalculateLines.py
Last active December 7, 2017 14:06
Sublime plugin
import sublime, sublime_plugin
class CalculateLinesCommand(sublime_plugin.TextCommand):
def run(self, edit):
lines={}
region = sublime.Region(0, self.view.size())
for lineRegion in self.view.lines(region):
key = self.view.substr(lineRegion)
key = key.strip(' \t\n\r')
@funivan
funivan / info.md
Created January 13, 2016 09:39
xdebug 2.3 phpstorm 10.0.3 build 143.1770
#!/bin/bash
fps=7
avconv -start_number 0035 -f image2 -r $fps -i %04d.JPG -q:v 1 -b:v 1000K time-lapse.avi
a=1
for i in *.JPG; do
new=$(printf "%04d.JPG" ${a}) #04 pad to length of 4
@funivan
funivan / pidgin-move-chat-top.py
Created March 27, 2015 08:07
Move chat to top
#!/usr/bin/env python
#
# Remember you need dbus session to run this program.
# export DBUS_SESSION_BUS_ADDRESS=`cat /proc/$(pidof gnome-session)/environ | tr '\\0' '\\n' | grep DBUS_SESSION_BUS_ADDRESS | cut -d '=' -f2-`;
#
import socket
import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
import os
import sys
@funivan
funivan / phpstorm64.vmoptions
Created March 2, 2015 08:22
phpstorm64.vmoptions
-Xms128m
-Xmx750m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=225m
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djsse.enableSNIExtension=false
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
// gcc -o v8 v8.c && chmod +x v8 && sudo ./v8
// cat /proc/bus/input/devices
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <linux/input.h>
@funivan
funivan / custom_urls.py
Last active August 29, 2015 14:08
custom urls file location
# -*- coding: UTF-8 -*-
from __future__ import with_statement
__kupfer_name__ = _("Custom urls")
__kupfer_sources__ = ("CustomUrlSource", )
__description__ = _("Navigate to custom urls from list")
__version__ = "0.0.1"
__author__ = "Ivan Scherbak <dev@funivan.com>"
import gtk
<?
/**
* https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Process/PhpExecutableFinder.php#L49
*/
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
if (is_executable($php)) {
return $php;
}
}
@funivan
funivan / CatchErrors.php
Last active December 27, 2015 10:59
errors
<?
set_error_handler('exceptions_error_handler');
function exceptions_error_handler($severity, $message, $filename, $lineno) {
if (error_reporting() == 0) {
return;
}
if (error_reporting() & $severity) {
throw new ErrorException($message, 0, $severity, $filename, $lineno);
@funivan
funivan / save.php
Created June 18, 2013 08:58
Save pages
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
class ExportHtml {
const SAVE_DIR = '/home/ivan/Ubuntu One/saved';