Skip to content

Instantly share code, notes, and snippets.

#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#define UID_ROOT (0)
#define PATH_KILLALL "/usr/bin/killall"
#define PROCNAME_TO_OPERATE "gcin"
/* This is a Windows Script Host script file written in JScript. You will need Word
* installed on your system before get this script running.
* The purpose of this script is convert multiple Word files (*.doc) into HTML files
* via Word's "Save As" function.
* User have to place the files into a folder and double-click on this script. A folder
* selection dialog will appear than you shall know what to do. */
WScript.Echo( "Please make sure all Word windows have been closed before proceed." );
var objShell = new ActiveXObject("Shell.Application");
/**
* The ROT13 server example code from LibEvent-Book written by Nick Mathewson.
* http://github.com/nmathewson/libevent-book
*
* The code is modified for my practice.
* compiling w/: gcc `pkg-config libevent --cflags --libs` rot13-server.c
*/
/* For sockaddr_in */
#include <netinet/in.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int main(int argc, char ** argv)
{
static struct addrinfo hint = {
@yinyin
yinyin / msgout-plurk.pl
Created May 17, 2010 16:15
Perl script to post message to Plurk
#!/usr/bin/perl
# Usage: ./msgout-plurk.pl "Message going to Plurk"
#
# please make sure $MSGOUT_PLRK_CONFIG_FILE is modified to point to your configuration file.
# for configuration file example, please see "msgout-plurk.txt".
use LWP::UserAgent;
use URI::Escape;
use HTTP::Request::Common;
#include <Python.h>
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
} pytrymod_TryobjObject;
static PyTypeObject pymodtry_TryobjType = {
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
$_X_CODE39_CODING_MAP = array(
'0' => '000110100', '1' => '100100001', '2' => '001100001', '3' => '101100000',
'4' => '000110001', '5' => '100110000', '6' => '001110000', '7' => '000100101',
'8' => '100100100', '9' => '001100100', 'A' => '100001001', 'B' => '001001001',
'C' => '101001000', 'D' => '000011001', 'E' => '100011000', 'F' => '001011000',
'G' => '000001101', 'H' => '100001100', 'I' => '001001100', 'J' => '000011100',
'K' => '100000011', 'L' => '001000011', 'M' => '101000010', 'N' => '000010011',
'O' => '100010010', 'P' => '001010010', 'Q' => '000000111', 'R' => '100000110',
'S' => '001000110', 'T' => '000010110', 'U' => '110000001', 'V' => '011000001',
'W' => '111000000', 'X' => '010010001', 'Y' => '110010000', 'Z' => '011010000',
@yinyin
yinyin / WMO1677.txt
Created April 4, 2011 17:14
The meter part of WMO1677 (cloud height) coding table.
# Code: VALUE (meter)
'00': <30,
'01': 30,
'02': 60,
'03': 90,
'04': 120,
'05': 150,
'06': 180,
'07': 210,
@yinyin
yinyin / daemonize.pl
Created May 11, 2011 18:12
An utility which runs program as daemon
#!/usr/bin/perl
use strict;
use POSIX;
our $PID = '/tmp/pid.txt';
our $WORKDIR = '/tmp';
our $TRMLOG = '/dev/null'; # '/tmp/terminal-log.txt';
our @DAEMON_CMD = ();
@yinyin
yinyin / endian.h
Created March 13, 2012 09:51
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__