Skip to content

Instantly share code, notes, and snippets.

View sgrankin's full-sized avatar
🎏

Sergey Grankin sgrankin

🎏
  • 11:57 (UTC -04:00)
View GitHub Profile
@sgrankin
sgrankin / idea.vmoptions
Created December 16, 2016 17:01
idea.vmoptions - my current IntelliJ vm options
-Xms4g
-Xmx4g
-XX:-UseParNewGC
-XX:-UseConcMarkSweepGC
-XX:ReservedCodeCacheSize=1g
-XX:+UseG1GC
-XX:+DisableExplicitGC
@sgrankin
sgrankin / reviewable.js
Last active July 7, 2016 17:59
gerrit style reviewable key bindings
[
["f", "Show next/latest diffs", "setProposedRevRanges()"],
["shift+]", "Next unreviewed file", "nextUnreviewedFile()"],
["shift+[", "Previous unreviewed file", "prevUnreviewedFile()"],
["]", "Next changed file", "nextChangedFile()"],
["[", "Previous changed file", "prevChangedFile()"],
[null, "Next visible file", "nextVisibleFile()"],
[null, "Previous visible file", "prevVisibleFile()"],
@sgrankin
sgrankin / gist:9bf1654833f2d1406eebb2ee1d9ce897
Last active July 3, 2016 15:42
mac docker + kubernetes 1.3 "fix"
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
scriptdir=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
. $scriptdir/env.sh
echo ">>>>> Mac Docker found - making /var/lib/kubelet shared"
MOBY_TTY="${HOME}/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty"
if [ -c "$MOBY_TTY" ]; then
@sgrankin
sgrankin / com.docker.machine.default.sh
Created June 11, 2016 17:12
Docker machine LaunchAgent using launchctl to set environment vars
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# Library/LaunchAgents/com.docker.machine.default.plist
#
echo x - Library/LaunchAgents/com.docker.machine.default.plist
#!/usr/bin/env ruby
# find all branches which have been squash merged into master
require 'pp'
# all branches
branches = %x{git branch | sed s/^..//}.split.map(&:chomp)
# sort by branch age; generate pretty time stamp while we're at it
branch_times = branches.map{|branch|
@sgrankin
sgrankin / quantize.py
Last active August 29, 2015 14:04
Quantize inputs like dtrace does
"""
Re-bucket input histogram in linear or exponential buckets.
Input:
value\tcount
Output:
quantized_value\tcount
"""
from gevent import spawn
from gevent.queue import Queue
def whisper(left, right):
left.put(right.get() + 1)
def main():
n = 100000
leftmost = Queue()
left, right = None, leftmost
#!/bin/sh
OUT="${1%.*}.pdf"
$(dirname "$0")/gprof2dot.py -f pstats "$@" | dot -Tpdf > $OUT
open $OUT
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s %(levelname)7s: %(message)s', # [%(name)s +%(lineno)d]',
datefmt='%Y-%m-%dT%H:%M:%S%z',
)
logger = logging.getLogger(__name__)
@sgrankin
sgrankin / gist:7997492
Last active December 31, 2015 13:59
Add trailing new line to files
sed -e '$a\' *