Skip to content

Instantly share code, notes, and snippets.

View iwanbk's full-sized avatar
🎯
Focusing

Iwan Budi Kusnanto iwanbk

🎯
Focusing
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 (ibk@labhijau.net)
*/
#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: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 / psql-srv.py
Created August 27, 2018 23:34 — forked from matteobertozzi/psql-srv.py
postgres "server" wire protocol example
# th30z@u1310:[Desktop]$ psql -h localhost -p 55432
# Password:
# psql (9.1.10, server 0.0.0)
# WARNING: psql version 9.1, server version 0.0.
# Some psql features might not work.
# Type "help" for help.
#
# th30z=> select foo;
# a | b
# ---+---
@iwanbk
iwanbk / bashrc_add
Last active March 8, 2023 07:02
Go + Vim Init : main file is goinit.sh
export GOROOT=$HOME/go
export GOPATH=$HOME/pathgo
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:$GOPATH/bin
@iwanbk
iwanbk / split_string_by_line.lua
Created April 29, 2013 03:39
Split string by line in Lua
for line in yourString:gmatch("([^\n]*)\n?") do
-- do something
end
@iwanbk
iwanbk / kamailio.cfg
Created May 13, 2013 12:57
kamailio.cfg with SIP over websocket. Modified from kamailio 4.0.1 example
#!KAMAILIO
#
# Simple/sample kamailio.cfg for running a proxy/registrar with TLS and
# WebSockets support.
###!substdef "!DBURL!sqlite:///etc/kamailio/db.sqlite!g"
#!substdef "!DBURL!mysql://kamailio:kamailiorw@localhost/kamailio!g"
#!substdef "!MY_IP_ADDR!10.0.11.175!g"
#!substdef "!MY_DOMAIN!ubukam.lan!g"
#!substdef "!MY_WS_PORT!5065!g"
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
#!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
@iwanbk
iwanbk / NOTE.md
Created November 23, 2018 13:53 — forked from tcnksm/NOTE.md
Small note of gRPC Best Practice @ CoreOSFest 2017
@iwanbk
iwanbk / json_test.go
Created June 8, 2018 10:16
json serialization benchmark
package main
import (
"encoding/json"
"testing"
)
func BenchmarkMapNakedInterface(b *testing.B) {
m := map[string]interface{}{
"col1": "val1",