Skip to content

Instantly share code, notes, and snippets.

View jancajthaml's full-sized avatar
🦈

Jan Cajthaml jancajthaml

🦈
View GitHub Profile
chrome.experimental.socket.create('tcp', '127.0.0.1', 8080, function(socketInfo) {
chrome.experimental.socket.connect(socketInfo.socketId, function (result) {
chrome.experimental.socket.write(socketInfo.socketId, "Hello, world!");
});
});
@jancajthaml
jancajthaml / timeit.py
Last active July 18, 2018 10:27
measure execution of python block or method with single timeit
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
class timeit():
def __init__(self, label):
import sys
import time
echo -n $(curl -s -H "Accept: application/json" http://api.icndb.com/jokes/random 2>&1 | jq '.value.joke') | say -v Karen
The Idea
A Worldwide digital socializing, banking and organizing system that is hard to corrupt, dynamically changeable and rewards the work and ideas of every individual using the system. Users can be anonymous, identified or anything in between and can still earn money and have credibility.
.Descriptions
The platform strives to be like water, flowing everywhere and nourishing all life. The platform has the power to create a fair society where a persons ideas and work are rewarded the right way. It enables people to follow their dreams and earn a living at the same time while making sure tasks that nobody wants to do are still done.
Imagine a ball of Nanobots that either expunges parts of itself that have been corrupted or change and implement/integrate the corruption into the ball. That is how I imagine the system, it repairs itself and evolves while keeping it's essence/core intact.
It even can change it's essence/core if needed but only when every part of it is in unison about the change. The ball ca
@jancajthaml
jancajthaml / 0-usage
Last active February 12, 2018 08:35
Parallel support for ruby collections
# GENERAL INFORMATION
# as in any language parallelism is not free and should be used mainly for costly, non-atomic, blocking operations
# on primitive operations it is expected to be slower than native ruby implementation because of additional resources
# and allocations spent on parallelism
#
# implementation is lock-free, for this reason following design decisions were made
# - map does not replace value in place but instead return new enumerable
# - reject and select do 2 passes over collection (using compact) to guarantee collision-free bucket
# - all methods require block and do not work with &block and/or &filter passed as a argument
data/
audit/
PNRE09YP/
transaction_state/
b8943a93b4b66e2fa96e3d5151ffedcc
d2a4c259fb83690087696cf0e197b3fa
01O0K8EO/
transaction_state/
e8170903fec265838369e0d5666a50b1
bf40862e8b816cbeb35adf7951910777
watch progress of core at `docker logs -f 09837b0d2288126ca6d4bf0aef915664337c8a5bb69d9e7c62f790ff506ae721`
info | parallelism set to 200
info | prefix uri set to http://core:8080/v1/Z777F5BE
debug | starting tests
info | discovering containers
>> bash | docker ps -a | grep performance | awk -F " " '{ print $2,$1 }'
73 ms
info | found transaction_core(1x)
#!/bin/sh -eo pipefail
sh ./dev-env/performance.sh
watch progress of core at `docker logs -f 8af03c7da3d966260b25ca9b841c7334753fe5189948907379a36f8b8c0dab51`
info | limit set to 20
info | prefix uri set to http://core:8080/v1/E7Y4MXCN
debug | starting tests
info | discovering containers
>> bash | docker ps -a | grep performance | awk -F " " '{ print $2,$1 }'
0x1043b10 65488b0c25a0080000 GS MOVQ GS:0x8a0, CX
0x1043b19 483b6110 CMPQ 0x10(CX), SP
0x1043b1d 7631 JBE 0x1043b50
0x1043b1f 4883ec18 SUBQ $0x18, SP
0x1043b23 48896c2410 MOVQ BP, 0x10(SP)
0x1043b28 488d6c2410 LEAQ 0x10(SP), BP
0x1043b2d 488d052c6a0200 LEAQ 0x26a2c(IP), AX
0x1043b34 48890424 MOVQ AX, 0(SP)
0x1043b38 48c744240800000000 MOVQ $0x0, 0x8(SP)
0x1043b41 e8aa3efeff CALL runtime.newm(SB)
@jancajthaml
jancajthaml / gist:e9ce9314c1a0a03998fa04dd3dabbfe8
Created June 13, 2017 16:05
fix docker for mac leaking image
brew install qemu
cd ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux
mv Docker.qcow2 Docker.qcow2.original
qemu-img convert -O qcow2 Docker.qcow2.original Docker.qcow2
rm Docker.qcow2.original
du -hs Docker.qcow2