Skip to content

Instantly share code, notes, and snippets.

@tochiz
tochiz / counter.cpp
Created August 3, 2011 12:34
C++ fastcgi sample
#include <iostream>
#include <fstream>
#include <fcgi_stdio.h>
#include <unistd.h>
int main( int argc , char * argv[] )
{
int result;
unsigned long long cnt = 0;
const char* output = NULL;
@tochiz
tochiz / doxygen-1.7.4-macosx-lion.patch
Created August 11, 2011 18:25
gentoo prefix app-doc/doxygen patch for mac os x lion
diff -ruN doxygen-1.7.4.orig/qtools/qglobal.h doxygen-1.7.4/qtools/qglobal.h
--- doxygen-1.7.4.orig/qtools/qglobal.h 2011-08-12 03:16:23.000000000 +0900
+++ doxygen-1.7.4/qtools/qglobal.h 2011-08-12 03:18:35.000000000 +0900
@@ -89,7 +89,10 @@
# if !defined(MAC_OS_X_VERSION_10_6)
# define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1
# endif
-# if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_6)
+# if !defined(MAC_OS_X_VERSION_10_7)
+# define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
@tochiz
tochiz / gist:1153018
Created August 18, 2011 00:37
util-linux want_libuuid ebuild diff (for macosx gentoo prefix testing)
--- util-linux-2.18-r1.ebuild.bak 2011-01-08 23:01:34.000000000 +0900
+++ util-linux-2.18-r1.ebuild 2011-08-18 09:22:46.000000000 +0900
@@ -85,8 +85,8 @@
}
want_libuuid() {
- # bug #350841, currently only not on OS X Snow Leopard
- [[ ${CHOST} != *-darwin10 ]]
+ # bug #350841, currently only not on OS X Snow Leopard & Lion
+ [[ ${CHOST} != *-darwin10 && ${CHOST} != *-darwin11 ]]
@tochiz
tochiz / gist:1160550
Created August 21, 2011 12:32
diff php-5.3.6-r1 gentoo prefix for testing
--- dev-lang/php/php-5.3.6-r1.ebuild.orig 2011-05-12 05:01:26.000000000 +0900
+++ dev-lang/php/php-5.3.6-r1.ebuild 2011-08-21 19:50:35.000000000 +0900
@@ -346,7 +346,7 @@
src_prepare() {
eblit-run src_prepare v3 ;
- if [[ ${CHOST} == *-darwin* ]] ; then
+ if [[ ${CHOST} == *-darwin* ]] && [[ ${CHOST} != *-darwin11 ]] ; then
# http://bugs.php.net/bug.php?id=48795, bug #343481
sed -i -e '/BUILD_CGI="\\$(CC)/s/CC/CXX/' configure || die
@tochiz
tochiz / gist:1160558
Created August 21, 2011 12:38
eselect-php fix for prefix
--- app-admin/eselect-php/eselect-php-0.6.4.ebuild.orig 2011-02-28 21:34:04.000000000 +0900
+++ app-admin/eselect-php/eselect-php-0.6.4.ebuild 2011-08-21 20:48:02.000000000 +0900
@@ -19,6 +19,12 @@
src_install() {
mv eselect-php-${PV} php.eselect
+
+ # install to prefix usr/bin
+ sed -i -e 's/file \/usr\/bin/file "\${EPREFIX}"\/usr\/bin/' php.eselect || die
+ sed -i -e 's/php-cgi \/usr\/bin/php-cgi "\${EPREFIX}"\/usr\/bin/' php.eselect || die
@tochiz
tochiz / gist:1170899
Created August 25, 2011 15:18
cairo-1.10.2 for gentoo prefix work on lion patch.
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -61,6 +61,10 @@
* This macro can be used to conditionally compile backend-specific code.
*/
+/* These functions have been removed on 10.7; as a workaround, just do
+ * a cast as the ATSFontRef and ATSUFontID should have the same value... */
+#define FMGetATSFontRefFromFont(x) ((ATSFontRef) x)
+
@tochiz
tochiz / CMakeLists.txt
Created November 5, 2011 03:08
OpenCVsample CMake
PROJECT( opencvtest_proj )
FIND_PACKAGE( OpenCV REQUIRED )
FILE(GLOB SRCS *.cpp)
ADD_EXECUTABLE( opencvtest ${SRCS} )
TARGET_LINK_LIBRARIES( opencvtest ${OpenCV_LIBS} )
@tochiz
tochiz / sample.cpp
Created November 5, 2011 03:36
Sample for OpenCV for image input & output.
#include <cmath>
#include <cv.h>
int main()
{
// Mat形式の画像データを作る
cv::Mat img;
//
img = cv::imread("input.png");
@tochiz
tochiz / delete_inbox.php
Created November 15, 2011 13:33
delete all mail in inbox from imap mail box.
<?php
/*
* delete_inbox.php
* inboxを空にする。cronなどで回す
*/
// IDとパスワードとホスト名。SSL検証はエラー出るので回避。
$id = '';
$ps = '';
$host = '{imap.ezweb.ne.jp:993/imap/ssl/novalidate-cert}';
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit eutils
DESCRIPTION="fswebcam is a neat and simple webcam app."
HOMEPAGE="http://www.firestorm.cx/fswebcam/"
SRC_URI="http://www.firestorm.cx/fswebcam/files/${P}.tar.gz"
LICENSE="GPL-2"