Skip to content

Instantly share code, notes, and snippets.

@tmiz
tmiz / rdf
Created December 1, 2010 09:52
Show diff between current and specified revision's one on Subversion
#!/bin/bash
TEMPFILE=/var/tmp/tmptxt
DIFF=diffmerge
if [ $# -ne 2 ]; then
echo "usage:"$0" <REVISION> <FILE>" 1>&2
exit 1
fi
@tmiz
tmiz / cpuvender.c
Created December 9, 2010 12:07
Get x86 CPU Vender and Brand Name
//!(C)tmiz.net
#include <stdio.h>
#define X86_VENDERNAME_ARRAY_LENGTH 13
#define X86_BRANDNAME_ARRAY_LENGTH 49
extern void GetX86CPUVenderName(char*outVendername);
extern void GetX86CPUBrandName(char*brandname);
int main() {
char vender[X86_VENDERNAME_ARRAY_LENGTH];
@tmiz
tmiz / YouTubeAutoRec.scpt
Created February 19, 2011 03:18
Sample Apple Script for SimplyRec + ChromeLauncherWithExtraAudio with Google Chrome
-- Sample Apple Script for SimplyRec + ChromeLauncherWithExtraAudio with Google Chrome
-- SimplyRec http://tg.tmiz.net/softwares/sr/index-e.html
-- ChromeLauncherWithExtraAudio http://tg.tmiz.net/softwares/clwea/
-- Google Chrome for Mac http://www.google.co.jp/chrome/
-- SoundFlower http://code.google.com/p/soundflower/
-- This scirpt can be executed by iCal and Automator, Apple Script Editor
-- Please select input device "SoundFlower" on SimplyRec before executing.
tell application "ChromeLauncherWithExtraAudio"
@tmiz
tmiz / c_quiz.c
Created March 8, 2011 07:52
C Quiz 001
#include <stdio.h>
int main() {
if ((int) -1 < (unsigned int) 5) {
printf("(A)\n");
} else {
printf("(B)\n");
}
return 0;
}
// Which is output?
@tmiz
tmiz / C_quiz_1.c
Created March 8, 2011 08:01
C QUIZ 001_01
#include <stdio.h>
#define ELEMENTSNUM (sizeof(array) / sizeof(array[0]))
int array[] = {10,20,30,40,50,60,70};
int main()
{
int d;
for(d=-1;d <= (ELEMENTSNUM-2);d++)
printf("%d\n",array[d+1]);
return 0;
}
@tmiz
tmiz / addday.c
Created April 16, 2011 15:23
n日後
#include <stdio.h>
#include <time.h>
struct mydate { int year,month,day; };
int addDay(struct mydate *d, int n)
{
struct tm birthday = {0,0,0,d->day,d->month,d->year-1900,0,0,0,0,NULL};
time_t birthday_sec = mktime(&birthday);
birthday_sec += (n*24*60*60);
struct tm *pHA = localtime( &birthday_sec );
@tmiz
tmiz / getopencv_fw_for_current_mac.sh
Created April 26, 2011 03:26
An easy way to build OpenCV.framework(i386/x86_64, 10.6 or later) for Mac OS X
svn co https://opencvlibrary.svn.sourceforge.net/svnroot/opencvlibrary/trunk/opencv opencv
cd opencv
curl -O http://tg.tmiz.net/test/opencv_mac_framework_i386_x86_64_only.patch
patch -p0 < opencv_mac_framework_i386_x86_64_only.patch
sh make_frameworks.sh
@tmiz
tmiz / sleepsort.py
Created May 19, 2011 17:02
sleepsort.py
# sleep sort
import threading
import time
class SleepAndAppend(threading.Thread):
def __init__(self, value, targetList):
threading.Thread.__init__(self)
self.value = value
self.targetList = targetList
def run(self):
@tmiz
tmiz / genEmbeddedFloatTable.py
Created September 7, 2011 04:11
genEmbeddedFloatTable
#!/usr/bin/env python
import sys,os
"""
$ ./genEmbeddedFloatTable txtCopyFromExcel.txt aCertainCoefTable
const float aCertainCoefTable[24] = {
0.10f , 0.09f , 0.09f , 0.08f , 0.07f , 0.07f , 0.07f , 0.06f , 0.06f , 0.06f ,
0.05f , 0.04f , 0.04f , 0.04f , 0.03f , 0.03f , 0.02f , 0.01f , 0.01f , 0.06f ,
0.06f , 0.06f , 0.06f , 0.06f
};
@tmiz
tmiz / copyUrlAndTitleFromSafari
Created October 14, 2011 11:00
copy url and title from Safari
tell application "Safari"
if not (exists front document) then return
set _title to name of front document
set _url to URL of front document
end tell
set the clipboard to _url & return & _title & return