Skip to content

Instantly share code, notes, and snippets.

View whatvn's full-sized avatar

Hung whatvn

View GitHub Profile
#!/usr/bin/env python
try:
import simplejson as json
except:
import json
import urllib2
class ServerStatistics(object):
def __init__(self):
table ip filter {
chain input {
type filter hook input priority 0; policy accept;
}
chain output {
type filter hook output priority 0; policy accept;
}
chain forward {
net.netfilter.nf_conntrack_max = 1048576
net.netfilter.nf_conntrack_tcp_be_liberal = 0
net.netfilter.nf_conntrack_tcp_loose = 0
net.netfilter.nf_conntrack_tcp_max_retrans = 3
net.netfilter.nf_conntrack_tcp_timeout_close = 2
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 2
net.netfilter.nf_conntrack_tcp_timeout_established = 120
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 2
net.netfilter.nf_conntrack_tcp_timeout_last_ack = 10
net.netfilter.nf_conntrack_tcp_timeout_max_retrans = 300
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Created by Hung on 4/27/17.
*/
public class ListOperator {
#!/usr/bin/python
"""WSGI server example"""
from __future__ import print_function
from gevent.pywsgi import WSGIServer
import gevent
import sys
from time import *
from gevent.monkey import patch_all; patch_all()
# compile php
./configure '--prefix=/apps/php-7.0.13' '--disable-all' '--with-libdir=lib64' '--enable-ctype' '--with-curl' '--enable-libxml' '--with-mysqli' '--with-pcre-regex' '--with-iconv' '--with-config-file-path=/abserver/php-7.0.13/etc' '--with-config-file-scan-dir=/abserver/php-7.0.13/etc/php.d' '--enable-maintainer-zts' '--enable-fpm' '--enable-simplexml' '--enable-session' '--enable-xml' '--with-openssl' '--enable-dom' '--enable-json' '--enable-hash' '--enable-opcache' '--enable-phar' '--enable-filter' '--with-zlib'
make -j 8 && make install
# compile php-cpp
export PATH=$PATH:/apps/php-7.0.13/bin
\item{
\textbf{Con ga}{: \href{https://conga.com/ }{https://conga.com}}
}
import asyncio
class asyncOp(object):
def __init__(self, loop):
self.loop = asyncio.get_event_loop()
def run(self, op, callback):
task = self.loop.create_task(op)
import asyncio
class asyncOp(object):
def __init__(self, op, callback):
self.op = op
self.loop = asyncio.get_event_loop()
self.task = self.loop.create_task(self.op)
self.task.add_done_callback(callback)
package spray.examples
import scala.util.{Success, Failure}
import scala.concurrent.duration._
import akka.actor.ActorSystem
import akka.pattern.ask
import akka.event.Logging
import akka.io.IO
import spray.json.{JsonFormat, DefaultJsonProtocol}
import spray.can.Http