Skip to content

Instantly share code, notes, and snippets.

View edwardbeckett's full-sized avatar

Edward J Beckett edwardbeckett

View GitHub Profile
package recfun
import scala.collection.mutable.ListBuffer
import common._
/** https://class.coursera.org/progfun-2012-001/assignment/view?assignment_id=4 */
object Main {
def main(args: Array[String]) {
println("Pascal's Triangle")
for (row <- 0 to 10) {
@edwardbeckett
edwardbeckett / maven-cli
Created June 1, 2015 16:00
Adobe AEM MultiModule Archetype
mvn archetype:generate \
-DarchetypeRepository=http://repo.adobe.com/nexus/content/groups/public/ \
-DarchetypeGroupId=com.day.jcr.vault \
-DarchetypeArtifactId=multimodule-content-package-archetype \
-DarchetypeVersion=1.0.2 \
-DgroupId=my-group-id \
-DartifactId=myproject \
-Dversion=1.0-SNAPSHOT \
-Dpackage=com.mycompany.myproject \
-DappsFolderName=myproject \
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@edwardbeckett
edwardbeckett / sample
Created May 12, 2015 14:10
Sample Question
A zero-indexed array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing.
Your goal is to find that missing element.
Write a function:
class Solution { public int solution(int[] A); }
that, given a zero-indexed array A, returns the value of the missing element.
@edwardbeckett
edwardbeckett / tomcat_init.sh
Last active August 29, 2015 14:19
tomcat_instance_init
#!/bin/bash
# chkconfig: 2345 20 80
# description: Tomcat 8 start/stop/status init.d script
JAVA_HOME=/usr/local/jdk
export JAVA_HOME
#Add Java binary files to PATH
PATH=$JAVA_HOME/bin:$PATH
export PATH
@edwardbeckett
edwardbeckett / setenv.sh
Last active August 29, 2015 14:19
Tomcat SetEnviroment Script
#!/bin/sh
# Edit this file to set custom options
#
# Notes:
#
# * Tomcat accepts the JAVA_OPTS and CATALINA_OPTS parameters
# * JAVA_OPTS are used during START/STOP/RUN
# Edit this file to set custom options
# Edit this file to set custom options
#
@edwardbeckett
edwardbeckett / tomcat_download
Created April 16, 2015 01:25
Tomcat 8 Latest
wget http://apache.mesi.com.ar/tomcat/tomcat-8/v8.0.21/bin/apache-tomcat-8.0.21.tar.gz
@edwardbeckett
edwardbeckett / java_download
Last active August 29, 2015 14:19
Java JDK Linux
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
#!/bin/bash
#
# Tomcat 8 start/stop/status init.d script
# Initially forked from: https://gist.github.com/valotas/1000094
# @author: Miglen Evlogiev <[email protected]>
#
# Release updates:
# Updated method for gathering pid of the current proccess
# Added usage of CATALINA_BASE
# Added coloring and additional status
@edwardbeckett
edwardbeckett / DualPivotQuickSort
Created March 25, 2015 20:31
DualPivotQuickSort
/**
* {@link java/util/DualPivotQuicksort}
* Sorts the specified range of the array using the given
* workspace array slice if possible for merging
*
* @param a the array to be sorted
* @param left the index of the first element, inclusive, to be sorted
* @param right the index of the last element, inclusive, to be sorted
* @param work a workspace array (slice)
* @param workBase origin of usable space in work array