Skip to content

Instantly share code, notes, and snippets.

View hzbd's full-sized avatar
I may be slow to respond.

hzbd

I may be slow to respond.
View GitHub Profile
@hzbd
hzbd / cors.nginxconf
Created February 6, 2018 08:24 — forked from pauloricardomg/cors.nginxconf
Nginx configuration for CORS-enabled HTTPS proxy with origin white-list defined by a simple regex
#
# Acts as a nginx HTTPS proxy server
# enabling CORS only to domains matched by regex
# /https?://.*\.mckinsey\.com(:[0-9]+)?)/
#
# Based on:
# * http://blog.themillhousegroup.com/2013/05/nginx-as-cors-enabled-https-proxy.html
# * http://enable-cors.org/server_nginx.html
#
server {
@hzbd
hzbd / nginx-nodejs-cors
Created December 5, 2017 09:02 — forked from m4ttbrock/nginx-nodejs-cors
Nginx Nodejs CORS to subdomain
server {
listen 80;
server_name subdomain.example.com;
access_log /var/log/nginx/example.access.log;
location / {
if ($http_origin ~* (https?://.*\.example\.com(:[0-9]+)?)) {
set $cors "true";
@hzbd
hzbd / nginx.conf
Created November 28, 2017 22:48 — forked from kmjones1979/nginx.conf
This is an example NGINX configuration for the blog: Performing A/B Testing with NGINX - This example demonstrates the sticky route functionality
events { worker_connections 2014; }
http {
default_type text/plain;
log_format cookie '$cookie_route - $route_cookie, '
'$request_uri - $route_uri, '
'$route - $upstream_addr';
error_log /var/log/nginx/debug_error.log debug;
@hzbd
hzbd / gist:0ee9787b114f4e1e3049beff8ae67485
Last active November 19, 2017 14:22
Quickly setup OpenLDAP in docker container(openldap with phpLDAPadmin)
#!/bin/bash -e
SERVICE=ldap-service
HOST_NAME=ldap-host
PASSWORD=xxxxxxx
LDAP_DOMAIN=k8scn.org
LDAP_DC=k8scn
docker run \
--name ${SERVICE} \
@hzbd
hzbd / Benchmark-results.txt
Created February 4, 2017 09:06 — forked from saurabhmishra/Benchmark-results.txt
Kafka Benchmark Commands
End-to-end Latency
0.0543 ms ms (median)
0.003125 ms (99th percentile)
5 ms (99.9th percentile)
Producer and consumer
Producer - 1431170.2 records/sec (136.49 MB/sec)
Consumer - 3276754.7021 records/sec (312.4957 MB/sec)
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Hadoop 2.6.0 Multinode cluster Setup
From Blog http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-multi-node-cluster/
###Machine 1(master).
Prequisite:
java version
java -version
@hzbd
hzbd / addElements.html
Created August 16, 2014 17:40
auto adding a element by js.
<html>
<head>
<title>Testing</title>
<script language="javascript">
fields = 1;
function addInput() {
if (fields < 4) {
document.getElementById('text').innerHTML += "<input type='file'"+ "name=" + "thumdals" + fields + " value=''/><br />";
fields += 1;
} else {
/* ===================================================
* jQuery SelectAll plugin
* ===================================================
* @author: https://gist.github.com/Leegorous
* @license: Licensed under the Apache License, Version 2.0 (the "License"),
* see http://www.apache.org/licenses/LICENSE-2.0
* ===================================================
*
* Example:
*
@hzbd
hzbd / share_tp
Created March 8, 2014 11:07
Django Share button template
{% autoescape on %}
{% with "http://carlosvin.alwaysdate.net" as host %}
{% with "Share in" as share_txt %}
{% with "twitter" as service %}
<a href="http://twitter.com/share?url={{ host }}{{ page_url }}&amp;text={{ title }}" target="_blank" title="{{ share_txt }} {{ service }}">
<img src="http://carlosvin.alwaysdate.net/templates/img/tw.png" alt="{{ share_txt }} {{ service }}"/>
</a>
{% endwith%}