Skip to content

Instantly share code, notes, and snippets.

View pgilad's full-sized avatar
🔭

Gilad Peleg pgilad

🔭
View GitHub Profile
@qoomon
qoomon / TravisGitHub.md
Last active August 6, 2023 04:59
Setup GitHub Deploy Keys For Travis

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@ozbillwang
ozbillwang / .travis.yml
Created August 1, 2017 12:07
terraform validates with Travis CI
env:
- tf_version=0.8.8
- tf_version=0.9.11
sudo: required
language: bash
before_install:
- wget https://releases.hashicorp.com/terraform/${tf_version}/terraform_${tf_version}_linux_amd64.zip -O /tmp/terraform.zip
@tanaikech
tanaikech / submit.md
Last active April 23, 2024 22:31
Multipart-POST Request Using Node.js

Multipart-POST Request Using Node.js

Here, I introduce 2 scripts for uploading files to Slack using Node.js as samples. These 2 sample scripts are for uploading files to Slack.

Sample script 1:

  • You can upload the zip file by converting byte array as follows.
    • At first, it builds form-data.
    • Adds the zip file converted to byte array and boundary using Buffer.concat().
    • This is used as body in request.
@jeroensmeets
jeroensmeets / gist:6e17fc17b5cb156d24f90f222cd9d9e9
Created May 1, 2017 07:38
essential parts for let's encrypt renewal under nginx
server {
listen 80;
# set root and server_name here
# only serve validation files for Let's Encrypt on port 80
location /.well-known/acme-challenge/ {
try_files $uri /dev/null =404;
}
# otherwise to SSL
@pgilad
pgilad / percentiles.R
Created April 2, 2017 06:19
Percentiles plot using R
library("ggplot2")
sample.jtl <- read.csv("~/repos/work/csv-percentiles/sample.csv")
sample.jtl$ts <- as.POSIXct(sample.jtl$ts / 1000, origin="1970-01-01")
interval_size <- '5 sec'
wanted_percentiles <- c(0.5, 0.9, 0.95, 0.99)
get_quantiles <- function(items) {
yy <- quantile(items, wanted_percentiles)
@equinoxel
equinoxel / main.scss
Created January 23, 2017 10:37
webpack 2 config capable of loading font-awesome fonts
@import "~normalize-scss/sass/normalize";
$fa-font-path: "~font-awesome/fonts";
@import "~font-awesome/scss/font-awesome.scss";
@import "bourbon";
@pgilad
pgilad / chi_square_min_sample.r
Last active April 15, 2018 10:28
Find minimum sample size to obtain minimum power test in non-centralized chi-square
u <- c(0.1, 0.3, 0.5)
chi_df <- 3
target_power <- 0.9
chi_base <- qchisq(0.95, chi_df)
get_power <- function(n) {
return (pchisq(q = chi_base, df = chi_df, ncp = n * u %*% u, lower.tail = FALSE))
}
get_power(20)
@hallettj
hallettj / Makefile
Last active December 10, 2023 13:32
Makefile for transpiling with Babel & Flow in a Node app, or in a client- or server-side shared library
# Makefile for transpiling with Babel in a Node app, or in a client- or
# server-side shared library.
.PHONY: all clean
# Install `babel-cli` in a project to get the transpiler.
babel := node_modules/.bin/babel
# Identify modules to be transpiled by recursively searching the `src/`
# directory.
@FutureSharks
FutureSharks / splunk-daemonset.yaml
Last active July 8, 2020 19:31
Creates a Kubernetes DaemonSet that will monitor container logs and forward them to a Splunk Indexer
# Create using kubectl:
# $ kubectl create -f splunk-daemonset.yaml
#
# You should also add config on your indexer to deal with the json formatted files:
# https://answers.splunk.com/answers/148307/how-to-parse-and-extract-json-log-files-in-splunk.html
#
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: splunk-forwarder