Skip to content

Instantly share code, notes, and snippets.

View dungvn3000's full-sized avatar

Nguyen Duc Dung dungvn3000

View GitHub Profile
import "regexp"
// Basic regular expressions for validating strings
const (
Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\
@dungvn3000
dungvn3000 / haskellTcpProxy.hs
Last active October 11, 2018 10:10 — forked from paul-r-ml/haskellTcpProxy.hs
simple Haskell TCP proxy
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)
# 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 December 7, 2016 12:13 — forked from searler/HTTP.scala
Source code for Akka IO http server example
/**
* © 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 / install.sh
Last active December 22, 2015 03:38 — forked from emaxerrno/Installing zookeper and monitoring it
For storm cluster install
#!/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