Skip to content

Instantly share code, notes, and snippets.

Avatar

Nguyen Duc Dung dungvn3000

View GitHub Profile
@dungvn3000
dungvn3000 / haskellTcpProxy.hs
Last active Oct 11, 2018 — forked from paul-r-ml/haskellTcpProxy.hs
simple Haskell TCP proxy
View haskellTcpProxy.hs
module TcpProxy where
import Control.Concurrent (forkIO)
import Control.Monad (forever, unless, void)
import Network (PortID(PortNumber),listenOn)
import Network.Socket hiding (listen,recv,send)
import Network.Socket.ByteString (recv,sendAll)
import qualified Data.ByteString as S
import System.Posix (Handler(Ignore),installHandler,sigPIPE)
import Control.Exception (finally)
View gist:982b26853058b0eef34930b299f2670f
# basic pfctl control
# ==
# Related: http://www.OpenBSD.org
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
@dungvn3000
dungvn3000 / HTTP.scala
Created Dec 7, 2016 — forked from searler/HTTP.scala
Source code for Akka IO http server example
View HTTP.scala
/**
* © 2012 Typesafe Inc.
*
* Extracted from http://doc.akka.io/docs/akka/2.1.0-RC2/scala/io.html
*/
import akka.actor._
import akka.util.{ ByteString, ByteStringBuilder }
import java.net.InetSocketAddress
@dungvn3000
dungvn3000 / scalikejdbc.scala
Last active Feb 19, 2016
scalikejdbc query example for a grid support filter, order by column and paging
View scalikejdbc.scala
/**
* Query data for a grid support filter, order by column and paging.
* @param tableQuery
* @param session
* @return
*/
def query(tableQuery: TableQueryDto)(implicit session: DBSession): TableData = {
var sql = select.from(User as u).toSQLSyntax
View GoogleCtr.scala
package controllers
import play.api.mvc._
import jp.t2v.lab.play2.stackc.StackableController
import jp.t2v.lab.play2.auth.LoginLogout
import play.api.Play
import play.api.Play.current
import com.google.api.client.googleapis.auth.oauth2.{GoogleAuthorizationCodeTokenRequest, GoogleBrowserClientRequestUrl, GoogleTokenResponse, GoogleCredential}
import scala.collection.JavaConverters._
import com.google.api.client.http.javanet.NetHttpTransport
View FacebookCtr.scala
package controllers
import play.api.mvc._
import play.api.Play
import play.api.Play.current
import play.api.libs.ws.WS
import scala.util.matching.Regex
import scala.concurrent.{Promise, Future, ExecutionContext}
import ExecutionContext.Implicits.global
import org.apache.commons.lang3.{RandomStringUtils, StringUtils}
View install.sh
#!/bin/sh
echo "assumes java 7 is instlaled openjdk versio"
#pre dependencies
sudo apt-get install git-core pkg-config libtool automake make g++ connect-proxy unzip python
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
#install zeromq
git clone git clone git://github.com/zeromq/libzmq.git
You can’t perform that action at this time.