Skip to content

Instantly share code, notes, and snippets.

View alexeypegov's full-sized avatar
🖖

Alexey Pegov alexeypegov

🖖
View GitHub Profile
@alexeypegov
alexeypegov / proto.msg
Last active April 27, 2022 23:36
ProtoBuffers debug with CURL. ProtoBuffers should be installed first: "yum install protobuf" or "brew install protobuf".
key:"string value"
int_key:22
@alexeypegov
alexeypegov / fillTextVsDrawImagePerformance.js
Last active January 24, 2022 18:38
Compare performance of fillText() vs drawImage() for HTML5 Canvas
// jshint esnext:true
// noprotect
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
function init(el, width, height) {
const _el = el ? el : document.createElement('canvas');
if (!el) {
$('body').append(_el);
}
BEGIN MESSAGE.
0mXN3EAcfT5U9Fe GrbfP3WBCGlo1eT 2bXnkb59eHGco6b QXN7SwofdKVXePJ
yvk7WEvQH7J7avu jQer9yGlOOJTCKq 6Xr2MZHgg6tMd0T uqTha0axH2WqLw0
n9LiwTSniN6RaJL K6DEFuA4Ac9bZdv 2gxWNnhBKKsDwlp lzjZaQuPTufUpEL
5lLjUZ88Gio5Fkj bIbefot81GFgvEf bg4hF0aLMzWSiL.
END MESSAGE.
@alexeypegov
alexeypegov / Preferences.sublime-settings
Created May 28, 2018 08:50
Sublime Text configuration
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
@alexeypegov
alexeypegov / extract-tdumps.clj
Last active May 13, 2018 16:33
Extruct java thread dumps from a log file
#!/usr/bin/env inlein
'{:dependencies [[org.clojure/clojure "1.9.0"]]}
(require '[clojure.string :as s]
'[clojure.java.io :as io])
(def filename (first *command-line-args*))
(when-not filename
@alexeypegov
alexeypegov / ini.clj
Created January 7, 2018 15:17
Simple INI-file parser
(ns ini.core
(:use [clojure.string :only [index-of last-index-of trim split-lines]]
[slingshot.slingshot :only [throw+]]))
(defn- section?
"Whatever the given string is a section or not"
[s]
(and
(= (first s) \[)
(= (last s) \])))

Keybase proof

I hereby claim:

  • I am alexeypegov on github.
  • I am alexeypegov (https://keybase.io/alexeypegov) on keybase.
  • I have a public key ASAcmSzYgSkiqw5hl9Ds9WDHcs6x8uwswa2oAtEZ6sTB-go

To claim this, I am signing this object:

@alexeypegov
alexeypegov / avi2m4v.scpt
Created September 4, 2010 17:18
Convert AVI files to M4V (iPhone) one by one using QuickTime Player X
--
-- simple AppleScript to convert chosen AVI files to iPhone video format one by one using QuickTime Player X
--
property outputFolder : (path to movies folder as Unicode text)
on check_exists(fileToCheck)
repeat
tell application "Finder"
if exists file fileToCheck then
exit repeat
@alexeypegov
alexeypegov / git-rbr
Created October 16, 2013 16:47
Quickly create Git remote branch. Place it somewhere in the PATH and call like this: "git rbr branch_name"
#!/bin/sh
if [ -n "$1" ]; then
git checkout -b $1
git push --set-upstream origin $1
else
echo "Usage: git rbr branch-name"
fi
@alexeypegov
alexeypegov / git-pr
Created October 16, 2013 16:46
Quick Github Pull Request for current branch. Place this script somewhere in PATH and call it like "git pr"
#!/bin/sh
function pr() {
local repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*github.com[:/]\(.*\)\.git.*/\1/"`
if [ -n "$repo" ]; then
local branch=`git name-rev --name-only HEAD`
echo "... creating pull request for branch \"$branch\" in \"$repo\""
open https://github.com/$repo/pull/new/$branch
fi
}