Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'mini_magick'
image = MiniMagick::Image.open("abc.png")
image.colorspace('Gray')
image.colors(16)
image.write "bcd.png"
david@david-laptop:~/test/rails$ templater myapp
create
create README
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
@ruanwz
ruanwz / README.mkd
Created December 30, 2010 15:04
Gist.vim
doc1=
"_id" : 12345678
"starttime" : "20101207010500"
"length" : 300
"interval" : 60
"device_data" :
"2323" :
"123" :
"ca" : [ 4, 7, 3, 3, 3 ]
"cd" : [ 7, 3, 6, 9, 8 ]
@ruanwz
ruanwz / .vimrc
Created September 25, 2010 14:24
" Don't use abbreviations! Spelling things out makes grepping easy.
" Let Pathogen bring in all the plugins
filetype off
call pathogen#runtime_append_all_bundles()
set modelines=0
filetype indent plugin on
syntax on
@ruanwz
ruanwz / .vimrc
Created September 21, 2010 04:15
" vimsy's .vimrc
"
" This is my vimrc as of August 2010. The vim-update-bundles parts are
" closer the bottom.
"
" Don't use abbreviations! Spelling things out makes grepping easy.
" Let Pathogen bring in all the plugins
filetype off
call pathogen#runtime_append_all_bundles()
@ruanwz
ruanwz / .vimrc
Created September 21, 2010 01:11
nmap <silent> <Leader>t :TlistToggle<CR>
nmap <silent> <Leader>n :NERDTreeToggle<CR>
*bundles.txt* Bundles Version 0.1
These are the bundles installed on your system, along with their
versions and release dates. Downloaded on Mon Sep 20 14:40:42 +0800 2010.
A version number of 'n/a' means upstream hasn't tagged any releases.
- |surround| v1.90-1-g27710a2 2010-09-09
- |taglist| n/a 2007-09-21
- |command-t| 0.8.1-2-g195dedc 2010-09-14
- |ruby| vim7.3-21-g5560a2f 2010-09-12

Socket

[Document on ruby-doc.org] [ruby_doc]

Introduction

Ruby provides a standard library Socket for networking programming in lower layer, such as TCP and UDP. There are also other libraries for application layers like HTTP, FTP and TELNET, they are not included in this tutorial.

What is Socket

Socket

[Document on ruby-doc.org] [ruby_doc]

Introduction

Ruby provides a standard library Socket for networking programming in lower layer, such as TCP and UDP. There are also other libraries for application layers like HTTP, FTP and TELNET, they are not included in this tutorial.

What is Socket