Skip to content

Instantly share code, notes, and snippets.

@rampion
rampion / try-catch-ex.c
Created April 8, 2009 02:35
TRY/CATCH/FINALLY macros for C
// gcc -o try-catch-ex try-catch.c try-catch-ex.c
#include <stdio.h>
#include "try-catch.h"
// Example of use for try-catch.h
int main(int argc, char *argv[])
{
int i = 101;
printf("before try block...\n");
anonymous
anonymous / qrcode.xml
Created July 25, 2009 05:08
HaarCascade file for QR-Code Detecting.
<?xml version="1.0"?>
<opencv_storage>
<qrcode type_id="opencv-haar-classifier">
<size>
48 48</size>
<stages>
<_>
<!-- stage 0 -->
<trees>
<_>
@code-walkers
code-walkers / MyApp.cpp
Created January 29, 2010 20:31
Writing win32 Service Application
/*The win32 service runs with its current working directory set to C:\Windows\System32
*You might need to place anyrun-time configuration scripts there.
*If you run into any confusion with the above detail, it is worthwhile to
*set the current working directory to your application installation directory like I did
*/
MyApp::OnInit()
{
//
//
@yagitoshiro
yagitoshiro / transport.py
Created February 7, 2011 09:32
マルチバイトのディレクトリ名が混ざっていても動作するようにした
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Make an iOS project transportable so that it can be zipped and
# sent to another machine
#
import os, sys, shutil, codecs, glob
template_dir = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
@nashby
nashby / BitmapFromBitmapSource.cs
Created April 12, 2011 20:18
Bitmap <-> BitmapSource converter
public Bitmap GetBitmap(BitmapSource source)
{
Bitmap bmp = new Bitmap
(
source.PixelWidth,
source.PixelHeight,
System.Drawing.Imaging.PixelFormat.Format32bppPArgb
);
BitmapData data = bmp.LockBits
@kimoto
kimoto / avi2avi.cpp
Created May 27, 2011 10:51
無圧縮AVIを、任意のコーデックで圧縮するコード
/*
* 無圧縮AVIファイル"input.avi"を
* GUIで選択した圧縮形式で圧縮して、"output.avi" に出力するだけのプログラム
*/
#include <Windows.h>
#include <tchar.h>
#include <Vfw.h>
#pragma comment(lib, "vfw32.lib")
#include <GdiPlus.h>
@kimoto
kimoto / dwmswitch.cpp
Created June 3, 2011 11:44
toggle Windows Aero (Aeroを有効/無効切り替えるためのコード)
#include "dwmswitch.h"
void ShowLastError(void){
LPVOID lpMessageBuffer;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
@kosh04
kosh04 / curl_writefunction.c
Created August 1, 2011 18:46
[cURL]コールバック関数を利用してURLの内容をバッファに溜め込む
/* $ gcc -Wall -g [-DDEBUG] curl_writefunction.c -lcurl */
/* $ ./a.out [URL] */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
#define BUFFER_MAX 0x10000
size_t write_length = 0;
@kumagi
kumagi / pythonmemcache.py
Created November 15, 2011 13:42
pythonから使えるmemcachedクライアントの比較(シングルスレッド)
import time
def bench(fn):
begin = time.time()
fn()
return time.time() - begin
n = 100000
def setwork(cl):
for i in range(0, n):
@hamajyotan
hamajyotan / extconf.rb
Created December 6, 2011 10:56
Data_Wrap_Struct example
require "mkmf"
$libs += " -lstdc++ "
create_makefile("human")