# examples/tcpdump.rb
require 'pcaplet'
include Pcap
pcaplet = Pcaplet.new
pcaplet.each_packet do |pkt|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pcap/pcap.h> | |
/* callback function when packet have captured */ | |
static void mycb(u_char *user, | |
const struct pcap_pkthdr *h, const u_char *packet) | |
{ | |
static int count = 1; | |
printf("Packet %d:\n", count); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# monit: monit init script for Redhat/Fedora. | |
# Written by physacco. 2013/04/11 | |
# To start at boot time: | |
# 1. copy this file to /etc/init.d/monit | |
# 2. chkconfig monit on | |
# --------------------- |
lxc convenience Wrapper for LXC programs
lxc-attach start a process inside a running container
lxc-cgroup manage the control group associated with a container
lxc-checkconfig check the current kernel for lxc support
lxc-checkpoint checkpoint a running container (not implemented yet)
lxc-clone clone a new container from an existing one
lxc-console Launch a console for the specified container
lxc-create creates a container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PidFile=/usr/local/pgsql/data/postmaster.pid | |
foo() | |
{ | |
if [ -f "$PidFile" ]; then | |
pgrep postgres | grep `head -1 $PidFile` | |
fi | |
} |
C API _mysql
|--------------------------------+-------------------------------------+------------------------------------------|
| C API | _mysql | Note |
|--------------------------------+-------------------------------------+------------------------------------------|
| mysql_affected_rows() | conn.affected_rows() | |
| mysql_autocommit() | conn.autocommit() | COM_QUERY set autocommit= |
| mysql_character_set_name() | conn.character_set_name() | |
| mysql_close() | conn.close() | COM_QUIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myclient: myclient.o | |
gcc -omyclient -rdynamic -L/usr/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto myclient.o | |
myclient.o: myclient.c | |
gcc -omyclient.o -c myclient.c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Parse and format time. | |
// Written by physacco. 2011-05-13. | |
// | |
// Tested on: | |
// - Mozilla SpiderMonkey JavaScript-C 1.7.0 2007-10-03. | |
// - Mozilla Rhino 1.7 release 0.7.r2.fc12 2009 07 28. | |
// | |
// To run it with nodejs, substitute print with console.log. | |
// YYYY-mm-dd HH:MM:SS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Print number in comma-splited format. | |
// Written by physacco. 2011-05-13. | |
// | |
// Tested on: | |
// - Mozilla SpiderMonkey JavaScript-C 1.7.0 2007-10-03. | |
// - Mozilla Rhino 1.7 release 0.7.r2.fc12 2009 07 28. | |
function commaSplitNumber(num) { | |
var numstr = num.toString(); | |
var dec, frac; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bigdecimal (1.2.0) | |
io-console (0.4.2) | |
json (1.7.7) | |
minitest (4.3.2) | |
psych (2.0.0) | |
rake (0.9.6) | |
rdoc (4.0.0) | |
test-unit (2.0.0.0) |