Skip to content

Instantly share code, notes, and snippets.

View BenjaminKim's full-sized avatar

김재호 BenjaminKim

View GitHub Profile
@BenjaminKim
BenjaminKim / xiaomi_xiaopang_video_merge.rb
Last active September 3, 2017 02:52
It merges xhiaopang's 1 minute videos to 1 day video. 샤오팡의 1분짜리 결과물들을 모아서 하루짜리 비디오로 합쳐줍니다.
require 'fileutils'
require 'filemagic'
fm = FileMagic.new
entries = Dir.glob('*').select {|f| File.directory? f}
entries.each do |dir|
puts "PWD: #{Dir.pwd}"
Dir.chdir(dir)
puts "PWD: #{Dir.pwd}"
@BenjaminKim
BenjaminKim / msn_xml_log_converter.rb
Created May 18, 2017 11:07
It parses msn old xml format log and converts it to general txt format.
require 'nokogiri'
def convert
name = '/home/benjamin/Downloads/msn_file_name.xml'
File.open('/home/benjamin/Downloads/result.txt', 'w+') do |f|
doc = Nokogiri::XML(File.read(name))
doc.xpath('//Message').each do |message|
from = message.at_xpath('From/User/@FriendlyName')
to = message.at_xpath('To/User/@FriendlyName')
content = message.at_xpath('Text').content
@BenjaminKim
BenjaminKim / vimrc
Created January 28, 2015 02:05
benjamin's vimrc
set nocompatible " be iMproved, required
filetype off " required
set enc=utf8
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
@BenjaminKim
BenjaminKim / gist:6590816
Last active September 7, 2017 15:57
Calculate average of response time in Rails 3 server.
cat log/production.log| grep "^Completed .* in [0-9]*ms .*" | sed "s/.* in \([0-9]*\)ms.*/\1/" | awk '{ s += $1 } END { print "sum: ", s, " average: ", s/NR, " samples: ", NR }'