This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget http://apache.mesi.com.ar/tomcat/tomcat-8/v8.0.21/bin/apache-tomcat-8.0.21.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* {@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 |