Skip to content

Instantly share code, notes, and snippets.

@yukioc
yukioc / YouTubeDataAPITest.html
Created February 27, 2011 13:47
YouTube DataAPI sample program
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript">
function yt_search(){
var keyword=encodeURIComponent(document.getElementById("keyword").value);
var script=document.createElement("script");
script.type="text/javascript";
script.src="http://gdata.youtube.com/feeds/api/videos?"
+ "vq=" + keyword + "&alt=json-in-script&max-results=30&callback=yt_cb";
var yt_view=document.getElementById("yt_view");
@yukioc
yukioc / mini-uploader.cgi
Created March 21, 2011 14:19
mini CGI file uploader and browser.
#!/usr/bin/perl
# mini uploader ver.0.1 (2011-03-21) by yukioc
# Ver.0.1 2011-03-21 new.
use strict;
use warnings;
use POSIX 'strftime';
use CGI;
use CGI::Carp 'fatalsToBrowser';
use File::Basename 'basename';
use HTML::Template;
@yukioc
yukioc / .htaccess
Created March 26, 2011 12:12
mini memo cgi script like notepad on web browser.
Options ExecCGI
AddHandler cgi-script .cgi
DirectoryIndex mini-memo.cgi
@yukioc
yukioc / tepco-today.html
Created March 27, 2011 12:30
Today's TEPCO power consumption for power saving
<html>
<body>
<div id="view"><i>Now loading TEPCO power consumption graph</i></div>
<script>
var cbTepco;
function getTepco(id,day){
var s=document.createElement("script");
s.type="text/javascript";
s.src="http://tepco-usage-api.appspot.com/"+day+".json?callback=cbTepco"
cbTepco=(function(id,day){
@yukioc
yukioc / .htaccess
Created April 10, 2011 15:33
mini bbs script
Options ExecCGI
AddHandler cgi-script .py
DirectoryIndex mini-bbs.py
@yukioc
yukioc / svn-ci-mail.pl
Created April 17, 2011 16:14
svn commit notification mail sender
#!/usr/bin/env perl
use strict;
use warnings;
use Encode;
use Net::SMTP;
my $svn_rev=shift or die;
my $svn_dir=shift or die;
my $smtp_url='xxx.yyy.zzz';
@yukioc
yukioc / cgi-env.pl
Created April 30, 2011 23:15
cgi environment values
#!/usr/bin/env perl
print "Content-Type: text/html\n\n";
print "<html><body><table border='1'>";
print "<tr><th>$_</th><td>$ENV{$_}</td></tr>" for (sort(keys(%ENV)));
print "</table></body></html>";
@yukioc
yukioc / cgi-cookie.py
Created May 5, 2011 03:42
test python SimpleCookie
@yukioc
yukioc / fizzbuzz.c
Created September 18, 2011 16:41
fizz buzz
#include <stdio.h>
void main(){
int i;
for(i=1;i<100;i++){
if(printf("%s%s",
(i%3==0)?"Fizz":"",
(i%5==0)?"Buzz":"")==0){
printf("%d",i);
}
puts("");
@yukioc
yukioc / arg.c
Created September 20, 2011 08:38
get command line options
/*
$ gcc arg.c
$ ./a.out -f -s 10 --longflag --longparam=20 aaa
option f
option s with value 10
option longflag
option longparam with value 20
last option aaa
*/
#include <stdio.h>