Skip to content

Instantly share code, notes, and snippets.

Avatar

Yoshinari Takaoka mumumu

View GitHub Profile
@mumumu
mumumu / gist:80349
Created Mar 17, 2009
C++ Hello World
View gist:80349
#include <iostream>
int main(int argc, char *argv[])
{
std::cout << "Hello World!!" << std::endl;
return 0;
}
View thread safe, but non-portable randamize function.
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
//
// returns random number from zero to max.
// to compile this, run the following command.
// $ gcc -Wall -lm -lrt filename
View gist:171646
#include <stdio.h>
int main(int argc, char *argv[])
{
int a = 0;
// displays true!
if (a == 0) printf("true!\n");
else {
printf("false!\n");
View modified-pointer-error.c
#include <stdio.h>
#include <stdlib.h>
static const int BUFSIZE = 256;
int main(int argc, char *argv[])
{
char *buffer = (char *)malloc(BUFSIZE);
if (buffer == NULL) {
fprintf(stderr, "out of memory");
View gist:266996
#!/usr/bin/perl
use strict;
use warnings;
use Net::Twitter;
use Encode;
binmode(STDOUT, ":utf8");
my $ng_word_regex = decode("utf-8", "XXXXX");
View twitter_stats_blocker.user.js
// ==UserScript==
// @name Twitter Stats Blocker
// @varsion 1.00
// @description following, follower, listed の数を非表示にするスクリプト。follow, remove を気にしたくない人にお勧め(かもしれない)
// @include http://twitter.com/*
// @namespace http://www.mumumu.org/
// @author mumumuorg
// ==/UserScript==
(function(){
View My_Session_SaveHandler_DbTable.php
<?php
class My_Session_SaveHandler_DbTable extends Zend_Session_SaveHandler_DbTable
{
/**
* Read session data
*
* @param string $id
* @return string
*/
View marriage_date_calc.pl
#!/usr/bin/perl
#
# marriage paper submit date calculation program.
# usage: perl marriage_date_calc.pl [year] [month] [date]
#
use strict;
use warnings;
View aoi_face_rec.html
<html>
<head>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<!--
<script type="text/javascript" src="./excanvas.js"></script>
-->
<script type="text/javascript">
jQuery(document).ready(function() {
var canvas = document.getElementById('aoi_miyazaki_canvas');
View gist:650944
javascript:(function(d,r,o,l,x,y,u,a,b,n,m,s,i){n=d.createElement("pre");n.setAttribute("style","z-index:100;font-weight:bold;position:absolute;left:0px;top:0px;background:black;color:white"); var img =d.createElement("img"); img.setAttribute("src", "http://www.gravatar.com/avatar/0bafbcfcfb548a4ac20406692858f68b?s=140&d=http%3A%2F%2Fgithub.com%2Fimages%2Fgravatars%2Fgravatar-140.png"); img.setAttribute("style", "z-index:150;font-weight:bold;position:absolute;left:0px;top:150px;"); d.body.appendChild(img); s=new Array(o+1).join(" ");for(i=0;i<l;i++)n.appendChild(m=r[i]=d.createTextNode(s)),n.appendChild(d.createTextNode("\n"));function p(x,y,c,_){with(r[y])nodeValue=nodeValue.substring(0,x)+c+nodeValue.substring(x+c.length)}a=x,b=y,setInterval(function(i){p(x,y," ");for(i=u.length;--i>=0;)with(u[i])p(x--,y," "),x>0?p(x,y,"-"):u.splice(i,1);x=a,y=b,p(x,y,"<?php");},50);d.onkeydown=function(e){switch(e.keyCode){case 90:a=x>0?x-1:x;break;case 83:b=y>0?y-1:0;break;case 67:a=x<o-5?x+1:x;break;case 88:b=y<l-1?