Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# this script will setup dotfiles in repository to your home directory.
# please fix dotfiles_path before running this script (if needed).
HOME_PATH=~
DOTFILES_PATH=~/archives/dotfiles
mkdir ${HOME_PATH}/.old_dotfiles
for file in bashrc zshrc screenrc set_proxy elisp emacs.el
;; default encodingをutf-8に変更
(set-default-coding-systems 'utf-8)
;; status-barにカーソルのcolumn表示(4,29とか)
(column-number-mode t)
;; ファイル名補完で大文字小文字を区別しない
(setq completion-ignore-case t)
;; バックアップファイルを作らない
#! /usr/bin/ruby
class Position
def initialize(x, y)
@x = x
@y = y
end
def x
@x
#include<stdio.h>
#include<math.h>
typedef struct {
double x;
double y;
} position;
void print_position(position pos){
printf("(%.1lf, %.1lf)\n", pos.x, pos.y);
#! /usr/bin/ruby
def area_circle(circle)
circle.radius ** 2 * Math::PI
end
def dist_pos(pos1, pos2)
diffx = pos1.x - pos2.x
diffy = pos1.y - pos2.y
Math::sqrt(diffx ** 2 + diffy ** 2)
#include<stdio.h>
#include<stdlib.h>
/* human class (structure)
This structure has pointers to methods.
*/
typedef struct _human{
char* _name;
int _age;
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
def walk(hash, start, goal, level)
cur = start
level.times do |i|
now = { cur, hash[cur] }
puts "#{i+1}/#{level}: #{now.inspect}"
cur = hash[cur]
return false unless cur
return true if cur == goal and (i+1) == level
// 変だったところをちょっと直しました
#include<stdio.h>
#include<stdlib.h>
int main(void) // main関数の宣言が変だった
{
char *name[10];
char *buff;
int i;
#! /usr/bin/ruby
# generate hitode png
# 2009.01.05
# this script needs pureimage
# http://cappuccino.jp/keisuken/
require 'optparse'
require 'pureimage'
plugin 'group'
configatron.plugins.group.groups.update({
:rits => %w( hitode909 coconutsfine TXT_inaka y_tsuda hightwitter hakobe ytetsuwo epee_noir con_mame opopo isano
hirayasu_is hayato240 ritsgirl ken1nakata2 higtwitter yano moji1021 hayato240 shirokurostone tall_zelkova aibou
viton masa138 unagi1022 DrunkenTomato ymzkey imcat0514 _udonchan udonchan_ naruto5071 unagi1022 itoga
)})