Skip to content

Instantly share code, notes, and snippets.

View jestan's full-sized avatar

Jestan Nirojan jestan

View GitHub Profile
@jestan
jestan / gist:1319504
Last active September 27, 2015 19:27
My Git Commands
#### Create a feature branch
git checkout -b <branch-name>
#### Create a remote branch for the feature branch
git push origin refs/heads/<branch-name>
#### Delete a remote branch
git push origin :refs/heads/<branch-name>
@jestan
jestan / gist:1319512
Created October 27, 2011 13:18
Dispatch Https
import dispatch._
import Http._
val https = new Http with HttpsLeniency
val secureHost = (:/("localhost", 443)).secure
val resp = https(secureHost / "search" as_str)
@jestan
jestan / gist:1319535
Created October 27, 2011 13:30
Dispatch Http Verbs
import dispatch._
import Http._
val http = new Http with thread.Safety with NoLogging
val host = :/("localhost", 8080)
//GET
val resp = http(host / "feed-api" / "app1" / "status" as_str)
@jestan
jestan / gist:1324980
Created October 29, 2011 19:43
Kill a process by opened port
#!/bin/sh
kill $(lsof -t -i :8080)
@jestan
jestan / gist:1326942
Created October 31, 2011 05:05
Dispatch Http Caching
#Http Caching
trait HttpCache extends Http {
override def make_client: org.apache.http.client.HttpClient = {
val config = new CacheConfig
config.setMaxCacheEntries(500)
config.setMaxObjectSizeBytes(50000)
new CachingHttpClient(super.make_client, config)
}
}
@jestan
jestan / gist:1330861
Created November 1, 2011 15:42
Faban Load Test Script
fhb -J -server -J -Xmx512m -J -Xms512m -c 1 -D test-results -s -S -W 20000 -r360/720/360 -p data.json http://localhost:8080/xyz-service
@jestan
jestan / gist:1344257
Created November 7, 2011 05:46
Lift Hacks
# Lift Run modes
"test", "staging", "production", "pilot", "profile", or blank
-Drun.mode=production
# Snippets
snippets are in the xxx.snippet package or LiftRules.addToPackages("xyz")
@jestan
jestan / gist:1431109
Created December 4, 2011 19:49
Netty JVM Opts
-server -Xms2048m -Xmx2048m -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods
@jestan
jestan / gist:1444598
Created December 7, 2011 20:53
My Scala Notes
# Compiler switches for optimization
-optimise
# Detailed Scala Collection Doc
http://www.scala-lang.org/docu/files/collections-api/collections.html
# @specialized (full performance for generic code)
# Scala Performance Optimization
@jestan
jestan / gist:1450770
Created December 9, 2011 08:43
sctp issue
private boolean scheduleWriteIfNecessary(final SctpChannelImpl channel) {
final Thread currentThread = Thread.currentThread();
final Thread workerThread = thread;
if (currentThread != workerThread) {
if (channel.writeTaskInTaskQueue.compareAndSet(false, true)) {
boolean offered = writeTaskQueue.offer(channel.writeTask);
assert offered;
}
if (!(channel instanceof SctpAcceptedChannel) ||