Instantly share code, notes, and snippets.

Jimmy Nguyen rhacker

View GitHub Profile
rhacker /
Created Oct 26, 2018 — forked from jed/
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

rhacker /
Created May 22, 2018 — forked from doublenns/
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)
View ideavimrc
" space leader
let mapleader = " "
" Plugins
set surround
set hlsearch
set scrolloff=3
set ignorecase smartcase
set showmode
rhacker /
Created Nov 3, 2016
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

rhacker /
Last active Sep 5, 2016
NOTES: Seven concurrency models in seven weeks

Notes on 7 concurrency model in 7 weeks

// This notes is for vietnamruby #hardcore learning group


  • Paul Butcher -
  • Consultant
  • He was Chief Software Architect of SwiftKey,
  • Chief Technical Officer of Texperts and
  • Chief Technical Officer of Smartner.
View gist:68ac9f261d4fec7a92be58274c3d0c30
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": {
rhacker / .gitignore
Created Jun 25, 2016
Visual studio gitignore
View .gitignore
# Download this file using PowerShell v3 under Windows with the following comand
# Invoke-WebRequest -OutFile .gitignore
# User-specific files
# Build results
View accordion-test
(defn accordion-test
(let [{:keys [title content active?]} x]
{:class (when active? "active")}
{:on-click #(prn "something")
:style {:cursor "pointer"}}
View gist:af34b460e149001b3a06
[cljs.test :refer-macros [is async]]
[ :as om :refer-macros [defui]]
[sablono.core :as sab :include-macros true]
[reagent.core :as r])
[devcards.core :as dc :refer [defcard deftest defcard-rg]]))
(defui Menu1
View gist:0cb8cb9eb8c3e2f43e9c
(ns onyx-starter.core
[clojure.core.async :as async]
[onyx.plugin.core-async :refer [take-segments!]]
[com.stuartsierra.component :as component]
[taoensso.timbre :refer [info error] :as timbre]
[clj-kafka.producer :as kp]
[clj-kafka.admin :as kadmin]
[onyx.kafka.embedded-server :as ke]