Skip to content

Instantly share code, notes, and snippets.

View kuenishi's full-sized avatar
🎴

UENISHI Kota kuenishi

🎴
View GitHub Profile
@kuenishi
kuenishi / gist:90202
Created April 4, 2009 13:08
NetBSD basic pkgsrc installation automation script
BINDIR=/usr/pkg/bin/
TARGET=/usr/pkg/bin/python /usr/pkg/bin/ruby /usr/pkg/bin/erl \
/usr/pkg/bin/emacs /usr/pkg/bin/vim /usr/pkg/bin/valgrind \
/usr/pkg/bin/svn /usr/pkg/bin/hg /usr/pkg/bin/automake \
/usr/pkg/bin/autoconf /usr/pkg/bin/pcc
all: $(TARGET)
/usr/pkg/bin/python: py-readline
cd /usr/pkgsrc/lang/python25 && make && make install
@kuenishi
kuenishi / template_thread_test.cpp
Created May 3, 2009 02:24
test code for do-not-use-stack-space too much in normal function
#include <pthread.h>
#include <iostream>
#include <string>
// > $ g++ -g template_thread_test.cpp -lpthread
// > $ ./a.out
using namespace std;
template <typename Type1, typename Type2>
class Hoge{
@kuenishi
kuenishi / gist:114548
Created May 20, 2009 01:22 — forked from gimite/gist:113234
Colordiff by shin_h
#!/usr/bin/env python
# Copyright (c) 2009, Shinichiro Hamaji
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
@kuenishi
kuenishi / How to use gcore.c
Created May 27, 2009 13:09
How to use gcore
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main(){
char cmd[1024];
sprintf(cmd, "gcore -o hoge %d", getpid() );
system(cmd);
}
/* test_hook.c : dynamic library with a callback function for julius;
who inputs result of speech recognition. the result will be redirected
to twitter CLI client and posted to twitter.com. */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int
get_plugin_info(int opcode, char *buf, int buflen)
{
switch(opcode) {
@kuenishi
kuenishi / bijint.erl
Created September 30, 2009 14:18
bijint.erl
% Copyright (c) 2009 UENISHI Kota
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the "Software"), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in
@kuenishi
kuenishi / bijint.py
Created September 30, 2009 14:19
bijint.py
# Copyright (c) 2009 UENISHI Kota
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@kuenishi
kuenishi / hiko.py
Created September 30, 2009 23:02
ひこにゃんに画像を収集するスクリプト
# Copyright (c) 2009 UENISHI Kota
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
%% MessagePack for Erlang
%%
%% Copyright (C) 2009 UENISHI Kota
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
% for(i=0; i < number ; i++){
% sum +=i;
% }
% for(i=0; i < number ; i++){
% sum = sum+i;
% }
range(To,To) when is_integer(From), is_integer(To)->
[To];
range(From,To) when is_integer(From), is_integer(To), From < To->