Skip to content

Instantly share code, notes, and snippets.

View kasuganosora's full-sized avatar
🙎‍♀️
Working at home

KasuganoSora kasuganosora

🙎‍♀️
Working at home
View GitHub Profile
@rubyonrailsworks
rubyonrailsworks / import_file_to_gridfs.rake
Created October 30, 2012 16:57 — forked from HungYuHei/import_file_to_gridfs.rake
将 File System 的上传文件导入到 Mongodb 的 GridFS 里面
# coding: UTF-8
#
# 以下为 Rake 任务,功能是将普通文件系统里面的东西转移到 MongoDB GridFS 里面
# 此代码片段来自于 Homeland 项目: https://github.com/huacnlee/homeland/tree/mysql
# 场景:
# 老架构 Linux File Store, Paperclip, hash 目录:"https://github.com/huacnlee/homeland/blob/ca0bdd8ab26da7b780e2dae7eba12b79f41e6d65/config/initializers/paperclip_hashpath.rb"
# 新架构 Mongodb GridFS, Garrierwave, 继续沿用 Paperclip 目录兼容: https://github.com/huacnlee/homeland/tree/7100ce4c506cc2c4387f25e50c533e5bbcac6cc2/app/uploaders
# 整个过程不会修改任何原始数据库和上传文件
#
require 'mongo'
@robertpitt
robertpitt / socks5.js
Created July 30, 2012 01:30
SOCKS5 Server as per rfc1928 (nodejs)
/**
* SOCKS5 Proxy as per RFC1928
* @see : http://www.ietf.org/rfc/rfc1928.txt
*/
/**
* Load Dependancies
*/
var net = require('net'),