Skip to content

Instantly share code, notes, and snippets.

public class HystrixHook extends HystrixCommandExecutionHook {
private HystrixRequestVariableDefault<Integer> hrv = new HystrixRequestVariableDefault<>();
@Override
public <T> void onStart(HystrixInvokable<T> commandInstance) {
HystrixRequestContext.initializeContext();
getThreadLocals();
}
public class ThreadLocalUtil {
private static ThreadLocal<Integer> idTL = new ThreadLocal<>();
public static void setId(Integer id) {
idTL.set(id);
}
public static void getId() {
idTL.get();
}
@hflamboauto1
hflamboauto1 / ns-inet.sh
Created June 28, 2019 07:37 — forked from dpino/ns-inet.sh
Setup a network namespace with Internet access
#!/usr/bin/env bash
set -x
NS="ns1"
VETH="veth1"
VPEER="vpeer1"
VETH_ADDR="10.200.1.1"
VPEER_ADDR="10.200.1.2"
@hflamboauto1
hflamboauto1 / rsync-sshfs.sh
Created June 7, 2019 16:19 — forked from mfellner/rsync-sshfs.sh
Sync a local and a remote directory with rsync over sshfs (e.g. when you only have sftp access). Note the defer_permissions option and the -c (checksum) flag. Tested on OS X with rsync 2.6.9 and sshfs 2.4.0 (fuse4x 0.9.2).
#!/bin/bash
SSH_USER="[email protected]" # your sftp credentials
SSH_KEY="~/.ssh/id_rsa" # your ssh private key
DOCUMENT_ROOT="/www/vhosts/mywebsite.com/htdocs" # directory on the remote server
LOCAL_DIR="~/mywebsite.com/public" # directory on your local machine
REMOTE_DIR="_remote_dir" # temporary mount point
mkdir -p $REMOTE_DIR
sshfs $SSH_USER:$DOCUMENT_ROOT $REMOTE_DIR -o workaround=rename -o defer_permissions -o IdentityFile=$SSH_KEY
@hflamboauto1
hflamboauto1 / es-ccr
Created March 21, 2019 21:14 — forked from zuketo/es-ccr
es-ccr
# Initial Setup
#
# NOTE: SETUP FOR DEMONSTRATION PURPOSES ONLY, NOT FOR PRODUCTION USE
#
# ELASTICSEARCH
#
# 1. Download Elasticsearch 6.6 (and unzip)
# 2. Start two instances of Elasticsearch, each with a different cluster name, port, and data path:
# ./bin/elasticsearch -E cluster.name=cluster1 -E http.port=9200 -E path.data=./cluster1-data
# ./bin/elasticsearch -E cluster.name=cluster2 -E http.port=9201 -E path.data=./cluster2-data
@hflamboauto1
hflamboauto1 / README.md
Created February 12, 2019 11:34 — forked from smoser/README.md
NAT setup on ubuntu through vpn

nat setup through vpn

The goal of this excersise was to connect a system to my desktop system and let it share the vpn.

systems

  • desktop: It has the following interfaces

    • wlp3s0: wireless managed by network manager connected to a wireless network.
    • tun0: a vpn device set up and managed by network manager
    • enp0s25: an unconnected wireless nic.
  • laptop: this system needed wanted to be on the vpn. It has the following interfaces:

@hflamboauto1
hflamboauto1 / 20130416-todo.md
Created January 14, 2018 11:14 — forked from mrflip/20130416-todo.md
Elasticsearch Tuning Plan

Next Steps

  • Measure time spend on index, flush, refresh, merge, query, etc. (TD - done)
  • Take hot threads snapshots under read+write, read-only, write-only (TD - done)
  • Adjust refresh time to 10s (from 1s) and see how load changes (TD)
  • Measure time of a rolling restart doing disable_flush and disable_recovery (TD)
  • Specify routing on query -- make it choose same node for each shard each time (MD)
  • GC new generation size (TD)
  • Warmers
  • measure before/after of client query time with and without warmers (MD)
{
"Version": "2012-10-17",
"Statement": [{
"Action": "ec2:*",
"Effect": "Allow",
"Resource": "*",
"Condition": {
"StringEquals": {
"ec2:Region": [
"us-east-1",
@hflamboauto1
hflamboauto1 / README.md
Created December 3, 2017 21:40 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


Raspberry Pi VPN Router

This is a quick-and-dirty guide to setting up a Raspberry Pi as a "router on a stick" to PrivateInternetAccess VPN.

Requirements

Install Raspbian Jessie (2016-05-27-raspbian-jessie.img) to your Pi's sdcard.

Use the Raspberry Pi Configuration tool or sudo raspi-config to: