Skip to content

Instantly share code, notes, and snippets.

Dmitry Klionsky ten0s

Block or report user

Report or block ten0s

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
@ten0s
ten0s / git-sshurl
Created May 20, 2014
Replace github's https url with ssh
View git-sshurl
function git-sshurl() {
local OldUrl=`git remote -v | sed -E -n 's/origin\s*(.*) \(push\)/\1/p'`
local NewUrl=`echo $OldUrl | sed -E 's#https://(.*)/(.*)/(.*)#git@\1:\2/\3#'`
echo "old url:" $OldUrl
echo "new url:" $NewUrl
git remote set-url origin $NewUrl
}
View bench.erl
-module(bench).
-compile(export_all).
%% Luke Gorrie's favourite profiling macro.
-define(TIME(Tag, Expr),
(fun() ->
%% NOTE: timer:tc/4 does an annoying 'catch' so we
%% need to wrap the result in 'ok' to be able to
%% detect an unhandled exception.
{__TIME, __RESULT} =
@ten0s
ten0s / gist:98e7d88476ec75351d75
Last active Aug 29, 2015
Install soap & http deps into virtualenv
View gist:98e7d88476ec75351d75
virtualenv env --no-site-packages
. env/bin/activate
pip install pytest==2.6.1
pip install git+https://github.com/pysimplesoap/pysimplesoap.git@1.13
pip install requests==2.3.0
pip install xmltodict==0.9.0
pip install hexdump==2.0
@ten0s
ten0s / gist:ac6c573ba249b4ae5373
Last active Aug 29, 2015
Install oneapi deps into virtualenv
View gist:ac6c573ba249b4ae5373
virtualenv env --no-site-packages
. env/bin/activate
pip install pytest==2.6.1
pip install requests==2.3.0
pip install git+https://github.com/ten0s/oneapi-python.git@my_changes
@ten0s
ten0s / docker-log.py
Last active Aug 29, 2015
Get comments history of image
View docker-log.py
#!/usr/bin/env python
import json
import sys, subprocess
def get_history_ids(image_id):
p = subprocess.Popen("docker history -q " + image_id,
stdout=subprocess.PIPE,
shell=True)
(out, _err) = p.communicate()
View beam_decompile.erl
#!/usr/bin/env escript
% -*- mode: erlang -*-
main([BeamFile]) ->
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).
@ten0s
ten0s / gist:b9a18344aa046ca3ee3c
Last active Oct 21, 2015
Install vagrant env and build the project
View gist:b9a18344aa046ca3ee3c
1. Download and Install VirtuaBox 4.3.20
----------------------------------------
Windows
http://download.virtualbox.org/virtualbox/4.3.20/VirtualBox-4.3.20-96997-Win.exe
Linux
https://www.virtualbox.org/wiki/Linux_Downloads
2. Start Virtualbox UI and make sure you are able to create 64-bit guests
-------------------------------------------------------------------------
Enable virtualization in BIOS otherwise.
@ten0s
ten0s / mono-publish-tar
Last active Aug 29, 2015
Create Publish folder for a MVC project to run on Mono
View mono-publish-tar
#/bin/bash
if [[ $# -lt 1 ]]; then
echo "Usage: mono-publish-tar VERSION"
exit 1
fi
ver=$1
dir_name=poweralleyui-${ver}
tar_name=${dir_name}.tar.gz
@ten0s
ten0s / gist:2fa05e6863f37d832134
Last active Aug 29, 2015
Install MM test deps into virtualenv
View gist:2fa05e6863f37d832134
virtualenv env --no-site-packages
. env/bin/activate
pip install pytest==2.6.1
pip install requests==2.3.0
pip install xmltodict==0.9.0
pip install hexdump==2.0
pip freeze > requirements.txt
View gist:771b268560e5421b8b57
read_lines(Acc) ->
case file:read_line(standard_io) of
{ok, Line} ->
Line2 = string:strip(Line, right, $\n),
read_lines([Line2 | Acc]);
eof ->
lists:reverse(Acc)
end.
You can’t perform that action at this time.