Skip to content

Instantly share code, notes, and snippets.

Andrey Tarantsov andreyvit

Block or report user

Report or block andreyvit

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
View MemoryLeakReport.md

Memory Leak Report

Many web apps leak memory on IE11 despite running fine on other browsers. We've identified two main causes of this.

The first kind of leak is simple, entirely predictable and caused by a quirk in how IE's JavaScript engine handles closures. Let's call it an “undead closure leak”. This leak goes away if you properly clean up all references or reload the page, and thus affects only AJAXy parts of the apps.

The second kind of leak is a complex permanent one, leaking the entire page context even if you reload the page. Let's call it a “GC singularity leak”. It's triggered by certain JavaScript code patterns, seemingly because IE's garbage collector never finishes its job (our theory is that it exhibits exponential complexity and encounters some sort of timeout/threshold).

This might not be an exhaustive list; internet posts point to other issues, notably when handling IFRAMEs, but we haven't encountered any of these.

View Delegate-README.txt
В этой директории лежит delegate (универсальный прокси-сервер и сервер
контекта) для Windows. Остальные версии можно найти на сайте.
Вот примерный список функций:
* входящие (т.е. с вашего компьютера) соединение по протоколам
HTTP, HTTPS, "HTTPS-tunnel", FTP, NNTP, Telnet, SOCKS и др.
* исходящие соеднинения (т.е. к настоящим серверам) по тем же
протоколам, причём, например, можно FTP (на входе) пустить
через SOCKS-прокси (или через HTTPS-прокси)
* кэширование запросов (с управляемыми параметрами)
@andreyvit
andreyvit / Rakefile
Created Apr 16, 2012
Rake tasks to initialize a new Mac
View Rakefile
desc "Install zsh config"
task :zshconfig do
sh 'chsh -s /bin/zsh'
sh 'rm -f ~/.zshrc ~/.zshenv'
sh 'ln -s ~/env/config/zshenv ~/.zshenv'
sh 'ln -s ~/env/config/zshrc ~/.zshrc'
end
desc "Install ssh config"
task :sshconfig do
@andreyvit
andreyvit / DockIcon.h
Created Mar 25, 2012
Show in Dock / Menu Bar / Nowhere coordinator
View DockIcon.h
#import <Foundation/Foundation.h>
typedef enum {
AppVisibilityModeNone,
AppVisibilityModeDock,
AppVisibilityModeMenuBar
} AppVisibilityMode;
@andreyvit
andreyvit / filter-windbg-address-map.go
Created Dec 5, 2018
A script to filter and summarise the memory map produced by `!address` command in WinDbg (requires Go 1.11)
View filter-windbg-address-map.go
package main
import (
"bytes"
"flag"
"io/ioutil"
"log"
"strconv"
"strings"
@andreyvit
andreyvit / ie11leak.html
Created Nov 20, 2018
A minimal reproduction case for a weird IE11 memory leak
View ie11leak.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script>
(function () {
var doc = document;
@andreyvit
andreyvit / fpdi_with_annots.php
Created Mar 12, 2012
FPDI extension to preserve external hyperlinks
View fpdi_with_annots.php
<?php
// FPDI extension that preserves hyperlinks when copying PDF pages.
//
// (c) 2012, Andrey Tarantsov <andrey@tarantsov.com>, provided under the MIT license.
//
// Published at: https://gist.github.com/2020422
//
// Note: the free version of FPDI requires unprotected PDFs conforming to spec version 1.4.
// I use qpdf (http://qpdf.sourceforge.net/) to preprocess PDFs before running through this
View livereload.js
// DEPRECATED
// see https://github.com/livereload/livereload-js/blob/master/dist/livereload.js for an up-to-date version
(function() {
var __protocol = {}, __connector = {}, __timer = {}, __options = {}, __reloader = {}, __livereload = {}, __startup = {};
// protocol
(function() {
var PROTOCOL_6, PROTOCOL_7, Parser, ProtocolError;
var __indexOf = Array.prototype.indexOf || function(item) {
@andreyvit
andreyvit / remove-old-db-backups.sh
Created Mar 24, 2012
A script to remove old DB backup files, keeping one backup per month, one backup per day for the last X months and the last Y backups.
View remove-old-db-backups.sh
#! /bin/bash
# vim: sw=2 ts=2 et ai
NUM_OLDEST_BACKUPS_TO_KEEP=1
NUM_RECENT_BACKUPS_TO_KEEP=100
NUM_MONTHS_TO_KEEP_DAILY_BACKUPS=4
AUTOMATIC_REMOVAL_THRESHOLD=40
# Deletes old DB backup files from the folder specified as an argument.
#
You can’t perform that action at this time.