Skip to content

Instantly share code, notes, and snippets.

View yuchan's full-sized avatar

Yusuke Ohashi yuchan

View GitHub Profile
@yuchan
yuchan / hello
Created April 11, 2011 15:50
文字化けしない
#! /usr/bin/perl
use strict;
use warnings;
use utf8;
binmode STDIN, ':utf8';
binmode STDOUT, ':utf8';
binmode STDERR, ':utf8';
@yuchan
yuchan / heredocument.rb
Created April 17, 2011 17:07
you don't need break indents.
#! /usr/bin/env ruby
class Poem
def initialize
@text = <<-END.gsub(/^\s+/,'')
この支配からの卒業
(尾崎豊)
END
end
def shout
/*
git clone git://gist.github.com/1300263.git
./commondotfiles
*/
#! /bin/sh
INSTALLDIR=$HOME
for FILE in `find $PWD/dotfiles/ -name ".*" | grep -v "bak"` ; do
#! /bin/sh
#
# Make arbitrary directries, and execute this scripts.
# that's all. write your HTML5 Application!
#
{
cat <<EOF
<!DOCTYPE html>
<html lang="ja">
#! /usr/bin/env perl
=head
半角カタカナ→全角カタカナ変換を調べたのでメモ
=cut
use strict;
use warnings;
use Encode;
use Encode::JP::H2Z;
@yuchan
yuchan / python
Created April 10, 2012 01:34
Encryption By Hash
#! /usr/bin/env python
#-*- coding:utf-8 -*-
import os
import hashlib
from datetime import *
remote_addr = os.environ["REMOTEHOST"]
current_time = datetime.now()
ct = current_time.strftime("%y%m%d%H%M%S")
@yuchan
yuchan / gist:2833775
Created May 30, 2012 04:27
MarkDownStudy

theme

sub theme

title

title2

title

@yuchan
yuchan / substring.go
Created June 2, 2012 09:20
Substring #GoLang
//Original
func substr(s string,pos,length int) string{
bytes:=[]byte(s)
l := pos+length
if l > len(bytes) {
l = len(bytes)
}
return string(bytes[pos:l])
}
@yuchan
yuchan / gist:2862975
Created June 3, 2012 10:35
virtualenv+pip=portable
in a project directory,,,
>> virtualenv venv
>> . venv/bin/activate
>> pip install ...
>> ...
>> ...
>> pip freeze > requirements.txt
in any other project directory,,,
>> virtualenv venv
@yuchan
yuchan / wtfpmonitor.pl
Created September 30, 2012 05:13
tag feed of Pinboard.
#! /usr/bin/env perl
use strict;
use warnings;
use Encode;
use Data::Dumper;
use XML::FeedPP;
use File::Copy;
use File::Spec;
use diagnostics;