Skip to content

Instantly share code, notes, and snippets.

@kev009
kev009 / multibyte
Created November 7, 2010 20:09
some multibyte testing
#include <event2/buffer.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct evbuffer* buf;
const char* msg = "abcdefghijklmn\n"; //ف ಠ_ಠ\n";
char* msg2;
int ret, len;
[root@mail1 ~]# iostat -m
Linux 2.6.32.21-168.fc12.x86_64 (mail1.xxx) 11/11/2010 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.15 0.01 0.16 0.17 0.03 99.49
Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn
xvda 1.77 0.00 0.01 5129 9591
@kev009
kev009 / gist:676268
Created November 15, 2010 00:42
handshake
/* pid 0x02 */
struct packet_handshake
{
uint8_t pid;
int16_t ulen;
char *username;
};
/* Use a non-authenticating handshake for now */
struct packet_handshake s_hs;
@kev009
kev009 / gist:710891
Created November 22, 2010 23:00
libevent-2.0.8rc Irix warnings
cc-3970 c99: WARNING File = event.c, Line = 168
conversion from pointer to same-sized integral type (potential portability
problem)
unsigned u = (unsigned) ((ev_uintptr_t) e->ptr);
^
cc-1185 c99: WARNING File = event.c, Line = 937
An enumerated type is mixed with another type.
@kev009
kev009 / mcstring.c
Created November 25, 2010 05:48
Minecraft strings
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <pthread.h>
#include <event2/buffer.h>
#include "craftd-config.h"
#include "util.h"
@kev009
kev009 / gist:732405
Created December 7, 2010 21:01
chunk test
/*
* Copyright (c) 2010 Kevin M. Bowling, <[email protected]>, USA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
NOTICE: Loading chunk (-5, 0)
ERR: cannot parse chunk '/home/kev009/World1/1n/0/c.-5.0.dat'
NOTICE: Loading chunk (-5, 1)
ERR: cannot parse chunk '/home/kev009/World1/1n/1/c.-5.1.dat'
NOTICE: Loading chunk (-5, 2)
ERR: cannot parse chunk '/home/kev009/World1/1n/2/c.-5.2.dat'
NOTICE: Loading chunk (-5, 3)
ERR: cannot parse chunk '/home/kev009/World1/1n/3/c.-5.3.dat'
NOTICE: Loading chunk (-5, 4)
ERR: cannot parse chunk '/home/kev009/World1/1n/4/c.-5.4.dat'
bsdmail2# pkg_info
nano-2.2.4 Small and friendly text editor (a free replacement for Pico)
openldap-client-2.4.23 Lightweight Directory Access Protocol libraries and client programs
pam-ldap-184nb3 Pluggable authentication module for LDAP directories
nss_ldap-260nb1 LDAP client for nsswitch
digest-20080510 Message digest wrapper utility
perl-5.12.2nb1 Practical Extraction and Report Language
lintpkgsrc-4.82 Sanity checks on the complete pkgsrc tree
libidn-1.19 Internationalized Domain Names command line tool
wget-1.12nb1 Retrieve files from the 'net via HTTP and FTP
RewriteEngine on
RewriteCond %{SERVER_NAME} ^(www\.)?wiki\.vg\.?$ [NC]
RewriteCond %{REQUEST_URI} !^/wiki
RewriteRule ^/(.*)$ /wiki/$1
RewriteRule ^$ /wiki/
(gdb) thread apply all bt
Thread 5 (Thread 0x7ffff57cc700 (LWP 3503)):
#0 0x00007ffff7360d7c in pthread_cond_wait () from /lib/libpthread.so.0
#1 0x000000000040bf87 in run_worker (arg=<value optimized out>) at network/worker.c:79
#2 0x00007ffff735be1c in start_thread () from /lib/libpthread.so.0
#3 0x00007ffff70b1e1d in clone () from /lib/libc.so.6
Thread 4 (Thread 0x7ffff5fcd700 (LWP 3502)):
#0 0x00007ffff7360d7c in pthread_cond_wait () from /lib/libpthread.so.0