Skip to content

Instantly share code, notes, and snippets.

@easyfmxu
easyfmxu / snowflake.go
Created July 4, 2020 22:41 — forked from asyncins/snowflake.go
[snowflake-go]
package main
import (
"errors"
"fmt"
"sync"
"time"
)
const (
#!/bin/bash
# --- Version history ---
# 0.4: added variable to store file path, and $2 for base file name
# added variable to store desired reporting interval
# 0.3: added $1 to send in process ID at run time.
# 0.2: switched to $SECONDS for the loop. works.
# 0.1: didn't work well at all.
# --- Version history ---
# Usage: cputrack [PID] [filename]
@easyfmxu
easyfmxu / http-benchmark.md
Created January 30, 2020 06:03 — forked from denji/http-benchmark.md
HTTP(S) Benchmark Tools / Toolkit for testing/debugging HTTP(S) and restAPI (RESTful)
@easyfmxu
easyfmxu / deployment-tool-ansible-puppet-chef-salt.md
Created December 18, 2019 19:08 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@easyfmxu
easyfmxu / index.html
Created October 11, 2018 23:39 — forked from gaearon/index.html
Multiple React components on a single HTML page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@easyfmxu
easyfmxu / MidpointLruCache.py
Created October 7, 2016 02:33 — forked from midom/MidpointLruCache.py
LRU with midpoint insertion (LRU2Q) cache decorator for Python
class MidpointLruCache:
def __init__(self, size, oldpercentage):
self.size = size
self.oldsize = size * oldpercentage / 100
self.youngsize = size * (100 - oldpercentage) / 100
self.youngitems = collections.OrderedDict()
self.olditems = collections.OrderedDict()
def __call__(self, func):
@easyfmxu
easyfmxu / sample-output
Created July 26, 2016 05:32 — forked from k9ert/sample-output
a ruby-script working as a check_mk-plugin to monitor zookeeper, place it in /usr/lib/check_mk_agent/local
$ ./zkmon.rb
0 zk_version - OK 3.4.3-1240972, built on 02/06/2012 10:48 GMT
0 zk_avg_latency count=5 OK 5
0 zk_max_latency count=265 OK 265
0 zk_min_latency count=0 OK 0
0 zk_packets_received count=2158687 OK 2158687
0 zk_packets_sent count=2319327 OK 2319327
0 zk_outstanding_requests count=0 OK 0
0 zk_server_state - OK standalone
0 zk_znode_count count=10078 OK 10078
@easyfmxu
easyfmxu / benchmark-commands.txt
Created March 3, 2016 04:39 — forked from jkreps/benchmark-commands.txt
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@easyfmxu
easyfmxu / haproxy-db.conf
Created January 24, 2016 03:35 — forked from aw/haproxy-db.conf
HAProxy configuration for MySQL failover and redundancy
# HAProxy configuration - haproxy-db.cfg
##
## FRONTEND ##
##
# Load-balanced IPs for DB writes and reads
#
frontend db_write
bind 172.16.0.50:3306
@easyfmxu
easyfmxu / 0-startup-overview.md
Created October 27, 2015 10:55 — forked from dideler/0-startup-overview.md
Startup Engineering notes