Skip to content

Instantly share code, notes, and snippets.

View 0xqd's full-sized avatar
🚀
Buidl web3

jn 0xqd

🚀
Buidl web3
View GitHub Profile
@0xqd
0xqd / run_shell_cmd.py
Created May 22, 2018 07:28 — forked from doublenns/run_shell_cmd.py
Quick, dirty function to call shell commands from Python
#!/usr/bin/env python3
import subprocess
def run_shell_cmd(cmd, *shell):
# Might want to use a "try" or call.check in case Command fails
if "shell" in shell.lower():
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE, shell=True)
" space leader
let mapleader = " "
" Plugins
set surround
set hlsearch
set scrolloff=3
set ignorecase smartcase
set showmode
@0xqd
0xqd / stm.md
Created November 3, 2016 02:25
STM - Software transactional memory

In computer science, software transactional memory (STM) is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing. It is an alternative to lock-based synchronization. STM is a strategy implemented in software, rather than as a hardware component. A transaction in this context occurs when a piece of code executes a series of reads and writes to shared memory. These reads and writes logically occur at a single instant in time; intermediate states are not visible to other (successful) transactions. The idea of providing hardware support for transactions originated in a 1986 paper by Tom Knight.[1] The idea was popularized by Maurice Herlihy and J. Eliot B. Moss.[2] In 1995 Nir Shavit and Dan Touitou extended this idea to software-only transactional memory (STM).[3] Since 2005, STM has been the focus of intense research[4] and support for practical implementations is growing.

Transactional locking

STM can be implemented as a lock-fre

@0xqd
0xqd / notes.md
Last active September 5, 2016 22:49
NOTES: Seven concurrency models in seven weeks

Notes on 7 concurrency model in 7 weeks

// This notes is for vietnamruby #hardcore learning group

Author

  • Paul Butcher - https://paulbutcher.com/
  • Consultant
  • He was Chief Software Architect of SwiftKey,
  • Chief Technical Officer of Texperts and
  • Chief Technical Officer of Smartner.
curl -XDELETE "http://localhost:9200/geo_polygon"
curl -XPOST "http://localhost:9200/geo_polygon"
# We index points with geo_point and geo_shape types for testing purpose
curl -XPOST "http://localhost:9200/geo_polygon/loc/_mapping" -d'
{
"loc": {
"properties": {
@0xqd
0xqd / .gitignore
Created June 25, 2016 15:01
Visual studio gitignore
# Download this file using PowerShell v3 under Windows with the following comand
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
(defn accordion-test
[x]
(let [{:keys [title content active?]} x]
[:div.accordion
{:class (when active? "active")}
[:div.title
{:on-click #(prn "something")
:style {:cursor "pointer"}}
title]
(ns css.components.tab
(:require
[cljs.test :refer-macros [is async]]
[om.next :as om :refer-macros [defui]]
[sablono.core :as sab :include-macros true]
[reagent.core :as r])
(:require-macros
[devcards.core :as dc :refer [defcard deftest defcard-rg]]))
(defui Menu1
(ns onyx-starter.core
(:require
[clojure.core.async :as async]
[onyx.plugin.core-async :refer [take-segments!]]
[com.stuartsierra.component :as component]
[taoensso.timbre :refer [info error] :as timbre]
[onyx.plugin.kafka]
[clj-kafka.producer :as kp]
[clj-kafka.admin :as kadmin]
[onyx.kafka.embedded-server :as ke]
(defn build-catalog [batch-size batch-timeout]
[{:onyx/name :kafka-read-messages
:onyx/plugin :onyx.plugin.kafka/read-messages
:onyx/type :input
:onyx/medium :kafka
:kafka/topic "test"
:kafka/group-id "onyx-consumer"
:kafka/fetch-size 307200
:kafka/chan-capacity 1000
:kafka/zookeeper "127.0.0.1:2181"