Skip to content

Instantly share code, notes, and snippets.

@terrancesnyder
terrancesnyder / regex-japanese.txt
Created November 7, 2011 14:05
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@terrancesnyder
terrancesnyder / node-0mq-ctrl-c.js
Created September 7, 2012 21:14
Handling Ctrl-C cleanly in Node.js
// Show how to handle Ctrl+C in Node.js
var zmq = require('zmq')
, socket = zmq.createSocket('rep');
socket.on('message', function(buf) {
// echo request back
socket.send(buf);
});
@terrancesnyder
terrancesnyder / setenv.sh
Created May 23, 2011 00:07
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@terrancesnyder
terrancesnyder / logging.properties
Created May 24, 2011 21:56
logging.properties - default logging.properties for shared use in tomcat
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
# and enterprise use with large-scale deployments.
@terrancesnyder
terrancesnyder / example_rule.json
Created September 14, 2023 02:59
Example of protecting with Ory Oathkeeper Access to API (GET)
{
"id": "Protect a People API with Consent Check",
"match": {
"url": "http://api.woven-city.io/api/people/contacts",
"methods": [ "GET" ]
},
"upstream": {
"url": "https://my_container_or_dns:8080/api/people/contacts"
},
"authenticators": [{
@terrancesnyder
terrancesnyder / gzip-hdfs
Created October 29, 2013 18:34
Hadoop GZIP command line
hadoop fs -cat /Work/lon_text/lon_order_data_t/cdw320_lon_order_data_t.1.txt | head -100 | gzip > test.csv.gz
cat cdw320_lon_order_data_t.1.txt | head -100 | gzip > ../../tsnyder/cdw320_lon_order_data_t.1.txt.gz
hadoop fs -cat /Work/tsnyder/cdw320_lon_order_data_t.1.txt.gz | gunzip
@terrancesnyder
terrancesnyder / tomcat.sh
Created May 23, 2011 00:14
/etc/init.d/tomcat
#! /bin/sh
# ==================================================================
# ______ __
# /_ __/___ ____ ___ _________ _/ /_
# / / / __ \/ __ `__ \/ ___/ __ `/ __/
# / / / /_/ / / / / / / /__/ /_/ / /_
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/
# Based On:
# http://www.springsource.com/files/uploads/tomcat/tomcatx-performance-tuning.pdf
@terrancesnyder
terrancesnyder / provision.sh
Created May 24, 2011 21:47
provision.sh - Means of provisioning a new tomcat instance.
#!/bin/bash
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@terrancesnyder
terrancesnyder / run.sh
Created May 22, 2011 23:37
./run.sh - Tomcat Multi-Instance Run Shell Script (run.sh) Based on Springsource
#!/bin/bash
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@terrancesnyder
terrancesnyder / server.sh
Created May 22, 2011 23:48
./server.sh - Tomcat Multi-Instance Run Shell Script (server.sh) Based on Springsource for init.d
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft