Skip to content

Instantly share code, notes, and snippets.

View yuchan's full-sized avatar

Yusuke Ohashi yuchan

View GitHub Profile
@yuchan
yuchan / p1.cpp
Created November 21, 2012 14:57
project euler problem #1
#include <iostream>
using namespace std;
int main()
{
int sum = 0;
for(int i = 1; i < 1000; i++){
if(i % 3 == 0 ||
i % 5 == 0)
sum += i;
@yuchan
yuchan / unixtips.mkdn
Created October 30, 2012 09:21
unix tips

忘れがちなものをメモ

tar 圧縮

tar -cvf file_B.tar dir_A
tar -cvzf file_B.tar.gz dir_A

スワップ 無効・有効切り替え(mac)

スワップを無効にする

@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;
@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 / 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:2833775
Created May 30, 2012 04:27
MarkDownStudy

theme

sub theme

title

title2

title

@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")
#! /usr/bin/env perl
=head
半角カタカナ→全角カタカナ変換を調べたのでメモ
=cut
use strict;
use warnings;
use Encode;
use Encode::JP::H2Z;
#! /bin/sh
#
# Make arbitrary directries, and execute this scripts.
# that's all. write your HTML5 Application!
#
{
cat <<EOF
<!DOCTYPE html>
<html lang="ja">
/*
git clone git://gist.github.com/1300263.git
./commondotfiles
*/
#! /bin/sh
INSTALLDIR=$HOME
for FILE in `find $PWD/dotfiles/ -name ".*" | grep -v "bak"` ; do