Skip to content

Instantly share code, notes, and snippets.

Avatar

Igal Sapir isapir

View GitHub Profile
View JwtUtils.cfc
component {
this.algorithms = {
"HS256" : "HMACSHA256"
};
/**
* initializes the object with the secret that is used to sign the JWT
*/
View calculate.js
/** Because `eval(q)` is too easy... Based on the post
https://www.linkedin.com/feed/update/urn:li:activity:6531594043288358912 */
/** Token types */
var TYPES = {
EOF : -1
,UNKNOWN : 0
,NUM : 1
,OP : 2
};
View unique-records.sql
/** Create test table */
drop table if exists dupes;
create temporary table dupes(word text, num int, id int);
/** Add test data with duplicates */
insert into dupes(word, num, id)
values ('aaa', 100, 1)
,('bbb', 200, 2)
,('ccc', 300, 3)
,('bbb', 400, 4)
View Dockerfile Lucee
## BUILD:
#
# docker build [--build-arg LUCEE_VERSION=5.2.9.37-SNAPSHOT] -t isapir/lucee-52937 .
# docker push isapir/lucee-52937
## RUN:
#
# groupadd -g 8080 --system lucee
# useradd --system -u 8080 lucee -g lucee
# export WEBROOT=/webroot
@isapir
isapir / startup.bat
Last active Sep 1, 2018
Lucee Configuration Files for Tomcat
View startup.bat
@echo off
:: set the path to Tomcat binaries
:: set CATALINA_HOME=C:\Apps\tomcat\apache-tomcat-9.0.11
:: set the path to the instance config, i.e. current directory if this file is in the CATALINA_BASE directory
set CATALINA_BASE=%CD%
:: set title to the last part of the current directory
for %%f in (%CD%) do set CUR_DIR=%%~nxf
@isapir
isapir / tomcat@.service
Created Mar 11, 2018
Tomcat template unit file for systemd
View tomcat@.service
# /etc/systemd/system/tomcat@.service
[Unit]
Description=Tomcat %I
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
# Tomcat config files
Environment=CATALINA_BASE=/etc/tomcat/%i
@isapir
isapir / dependencies.txt
Last active Jun 10, 2017
Tomcat Project settings for IntelliJ-IDEA
View dependencies.txt
../tomcat-idea/lib
ant-1.9.9.jar
ecj-4.6.3.jar
geronimo-spec-jaxrpc-1.1-rc4.jar
wsdl4j-1.6.2.jar
../tomcat-idea/lib-test
easymock-3.4.jar
run `ant deploy` to build the project to the "output/build" directory, which will then be used as the Working Directory at run configurations.
View download-java.sh
## URL_BASE is found by inspecting the link at http://www.oracle.com/technetwork/java/javase/downloads/server-jre8-downloads-2133154.html
DIR_DOWNLOAD=~/Downloads
DIR_DEST=/usr/java
URL_BASE=http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441
## download server-jre
JAVA_ARCHIVE=server-jre-8u121-linux-x64.tar.gz
## to download JDK instead, use:
View nginx-settings.md

nginx

Reverse Proxy Headers:

proxy_set_header    Host                $host;                        ## CGI.HTTP_HOST
proxy_set_header    X-Original-URI      $request_uri;                 ## CGI.X_Original_URI     - URI before rewriting
proxy_set_header    X-Real-IP           $remote_addr;                 ## CGI.X_REAL_IP          - IP address that connected to nginx
proxy_set_header    X-Request-ID        $request_id;                  ## CGI.X_REQUEST_ID       - unique identifier for the request
proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;   ## CGI.REMOTE_ADDR        - via Tomcat RemoteIpFilter
@isapir
isapir / jvmdump.bat
Last active Mar 23, 2017
Dump Threads and Heap for a JVM that runs as Service
View jvmdump.bat
:: if the service is run in Session 0 then open a console for that session and run it from there
:: e.g. %PsExec% -s -h -d -i 0 cmd.exe
:: set the paths for your environment
set PsExec=C:\Apps\SysInternals\PsExec.exe
set JAVA_HOME=C:\Apps\Java\jdk1.8.0_121
set DUMP_DIR=C:\temp
@echo off
You can’t perform that action at this time.