Skip to content

Instantly share code, notes, and snippets.

View gaocegege's full-sized avatar
🐮
Programming

Ce Gao gaocegege

🐮
Programming
View GitHub Profile

Keybase proof

I hereby claim:

  • I am gaocegege on github.
  • I am gaocegege (https://keybase.io/gaocegege) on keybase.
  • I have a public key whose fingerprint is 48F2 9F0D 1473 D685 3D8E 0E92 8D04 D990 3473 542E

To claim this, I am signing this object:

@gaocegege
gaocegege / tab-color-in-iterm2.zsh
Created May 18, 2015 14:57
add the script into .zshrc, and u can change the color of tab. from http://kendsnyder.com/tab-colors-in-iterm2-v10/
# iterm coloring
function tab-color() {
if [[ $# == 1 ]]
then
# convert hex to decimal
hex=$1
if [[ ${hex:0:1} == "#" ]]
then
# strip leading hash sign
hex=${hex:1:6}
@gaocegege
gaocegege / httpclient.scala
Created June 6, 2015 08:45
scala httpclient example
import java.io._
import org.apache.commons._
import org.apache.http._
import org.apache.http.client._
import org.apache.http.client.methods.HttpPost
import org.apache.http.impl.client.DefaultHttpClient
import java.util.ArrayList
import org.apache.http.message.BasicNameValuePair
import org.apache.http.client.entity.UrlEncodedFormEntity
@gaocegege
gaocegege / reporter.scala
Created June 6, 2015 08:46
scala reporter
package reporter
import scala.tools.nsc.Global
import scala.reflect.internal.util.{Position, NoPosition, FakePos}
object Reporters {
abstract class ReporterFormatter {
def formatTypeTitle(typ: MsgType): String
}
@gaocegege
gaocegege / friend.scala
Created June 9, 2015 14:40
Gephi Toolkit Transformer in scala
package renren
class Friend(var uid: String, var school: String, var name: String, var link: String) extends Serializable {
override def toString(): String = {
s"Friend($uid, $school, $name, $link)"
}
override def equals(o: Any) = o match {
case that: Friend => that.uid.equalsIgnoreCase(this.uid)
case _ => false
@gaocegege
gaocegege / actorexample.scala
Created June 9, 2015 23:50
scala actor example
import scala.actors.Actor
import scala.actors.Actor._
object Main {
class Pong extends Actor {
def act() {
var pongCount = 0
while (true) {
receive {
case "Ping" =>
@gaocegege
gaocegege / nginxproxy.md
Created January 13, 2016 03:47 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

// 2D Array of objects
System sys;
// Number of columns and cols in the grid
// cols need to > 35 to support the gun test
int cols = 50;
void setup() {
size(400, 400);
sys = new System(cols, 400 / cols);
@gaocegege
gaocegege / client.scala
Created March 5, 2016 13:48 — forked from crdueck/client.scala
akka remote
// client conf
akka {
loglevel = "DEBUG"
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
transport = "akka.remote.netty.NettyRemoteTransport"
log-sent-messages = on
log-received-messages = on
import os
config = os.path.join(os.path.dirname(__file__),"tests-files", "config.yml")
print(config)