Skip to content

Instantly share code, notes, and snippets.

require 'mechanize'
require 'zip/zip'
agent = Mechanize.new
page = agent.get('http://mh.websimu.mydns.jp/4g_csv/')
filename = page.links[0].uri.to_s
puts "saved #{filename}"
File.write(filename, page.links[0].click.body)
keywords = %W(
穀物
野菜
乳製品
)
double = keywords.repeated_combination(2)
puts double.collect {|arr| arr.join("+") }.join("\n")
@kanetann
kanetann / irctest
Created November 7, 2011 09:48
AnyEvent::IRC::Client Sample
#!/usr/bin/perl
use strict;
use warnings;
use AnyEvent;
use AnyEvent::IRC::Client;
use Encode qw /encode decode_utf8/;
# 接続設定
@kanetann
kanetann / gist:1882529
Created February 22, 2012 06:46
MH3G csv shaping
#!/bin/sh
# http://mh.websimu.mydns.jp/3g_oma/mst/all.txt
cp CHARM.csv.org CHARM.csv
perl -pi -e 's/^(.*)$/$1s0/g' CHARM.csv
perl -pi -e 's/s1s0/s1/g' CHARM.csv
perl -pi -e 's/s2s0/s2/g' CHARM.csv
perl -pi -e 's/s3s0/s3/g' CHARM.csv
perl -pi -e 's/(\-?\d+)/,$1,/g' CHARM.csv
perl -pi -e 's/^(.*)s,0/兵士の護石,0,$1/g' CHARM.csv
codeigniterメモ
ディレクトリ構成
コードはCodeIgniter/system/application/controllersに書けばいい
views modelsもある
ログはCodeIgniter/logsを見る
config.php database.phpにいろいろ設定する
.htaccessにURLのindex.phpを除去する記述を追加する
MVC
@kanetann
kanetann / gist:3434589
Created August 23, 2012 09:23
preceed.cfg
#### Contents of the preconfiguration file (for squeeze)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US.UTF-8
d-i debian-installer/splash boolean false
# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string NL
#d-i debian-installer/locale string en_GB.UTF-8
cat ~/.ssh/id_rsa.pub | ssh user@xxx.xxx.xxx.xxx "mkdir -p ~/.ssh; cat - > ~/.ssh/authorized_keys"
%w{ apache2 supervisor postfix runit tmux sudo pxe_dust aws keystone horizon glance nova varnish tomcat sqlite samba python postgresql openldap ntp nagios nginx mysql cloudkick gecode chef-client build-essential windows logrotate partial_search php erlang apt database chef_handler yum users rabbitmq java logwatch openssh homebrew cron djbdns zsh webpi heartbeat rsyslog keepalived iis git freebsd maven chef-server application_ruby munin bluepill getting-started lvm ark application_nginx application motd-tail haproxy emacs firewall unicorn perl resolver subversion daemontools ossec openvpn passenger_apache2 ohai gunicorn wix application_python application_php couchdb memcached wordpress tftp swift whitelist-node-attrs mercurial xml dmg application_java powershell zenoss xfs vim ufw ucspi-tcp ubuntu transmission trac stompserver ssh_known_hosts snort sbuild reprepro radiant pdns pacman openssl maradns man kickstart jpackage jira jetty iptables imagemagick hadoop gnu_parallel gems dynect drbd chef apparmor ant th
execute "aptitude -y update" do
action :run
end
node['rbenv']['user_installs'] = [
{
'user' => 'vagrant',
'rubies' => ['1.9.3-p286'],
'global' => '1.9.3-p286',
}
" vundle settings
set nocompatible
filetype plugin indent off
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
call neobundle#rc(expand('~/.vim/bundle'))
endif
NeoBundle 'git://github.com/Shougo/neobundle.vim'