Skip to content

Instantly share code, notes, and snippets.

View iwanbk's full-sized avatar
🎯
Focusing

Iwan Budi Kusnanto iwanbk

🎯
Focusing
  • Bandung, Indonesia
  • 14:27 (UTC +07:00)
View GitHub Profile
@iwanbk
iwanbk / lwip_udpecho_raw_server.c
Created November 28, 2011 09:17
LWIP UDP Echo Server with RAW API
/*
* author : Iwan Budi Kusnanto ([email protected])
*/
#include "lwip/api.h"
#include "lwip/sys.h"
#include "lwip/udp.h"
#include "udpecho_raw_server.h"
static void udpecho_raw_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
@iwanbk
iwanbk / gist:1992013
Created March 7, 2012 08:47
multiprocess gevent wsgi server
#original code from http://pastebin.com/EDwwNhqq
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("0.0.0.0", port))
fork()
address = socket.fromfd(s.fileno(), socket.AF_INET, socket.SOCK_STREAM)
address.listen()
@iwanbk
iwanbk / gist:2295233
Created April 3, 2012 20:15
TCP Echo Client in Golang
package main
import (
"net"
"os"
)
func main() {
strEcho := "Halo"
servAddr := "localhost:6666"
tcpAddr, err := net.ResolveTCPAddr("tcp", servAddr)
@iwanbk
iwanbk / bench_client.py
Created April 23, 2012 06:33
flask with ujson & json benchmark
#!/usr/bin/env python
import timeit
import jsonrpclib
import ujson
import requests
N_TEST = 10000
server_json = jsonrpclib.Server('http://localhost:8000/json/')
@iwanbk
iwanbk / gevent-multiprocess.py
Created April 23, 2012 09:28 — forked from denik/gevent-multiprocess.py
gevent-multiprocess
import sys
from gevent import server
from gevent.baseserver import _tcp_listener
from gevent.monkey import patch_all; patch_all()
from multiprocessing import Process, current_process, cpu_count
def note(format, *args):
sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args))
@iwanbk
iwanbk / client.py
Created May 1, 2012 10:18 — forked from stevvooe/client.py
A minimal python to go json-rpc implemention, sans HTTP
import json
import socket
s = socket.create_connection(("127.0.0.1", 5090))
s.sendall(json.dumps(({"id": 1, "method": "Hello.Hello", "params": ["hello"]})))
print s.recv(4096)
"""
BOSH Client
-----------
Quite simple BOSH client used by Django-XMPPAuth
For now, it only supports the DIGEST-MD5 authentication method.
"""
import httplib, sys, random
# The upstream server doesn't need a prefix! no need for wss:// or http:// because nginx will upgrade to http1.1 in the config below
upstream yeomanserver {
server localhost:3000;
}
server {
listen 443;
server_name legionofevil.org;
root html;
#!KAMAILIO
#
# sample config file for dispatcher module
# - load balancing of VoIP calls with round robin
# - no TPC listening
# - don't dispatch REGISTER and presence requests
#
# Kamailio (OpenSER) SIP Server v3.2
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#!KAMAILIO
#
# Kamailio (OpenSER) SIP Server v3.1 - default configuration script
# - web: http://www.kamailio.org
# - git: http://sip-router.org
#
# Direct your questions about this file to: <[email protected]>
#
# Refer to the Core CookBook at http://www.kamailio.org/dokuwiki/doku.php
# for an explanation of possible statements, functions and parameters.