This is a semi-quick key/value store I put together for a quick way to store temporary data related to what's in my database, in a reliable way. For example, I'm using it to keep track of where a hourly and a daily crontask that processes statistics left off, so it can resume only processing and summarizing new data on the next run.
Code quality most likely is not great, but it works. And I will update this gist as I update my project.
The settings table has two columns, a key
and a value
column. The value
column is serialized, so you can technically store almost anything in there. Memcache is also used as a caching layer to minimize database calls.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################### | |
## Input | |
<source> | |
type tail | |
format /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<timestamp>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)" (?<response_time_micro_sec>[^ ]*))?$/ | |
path /home/ubuntu/log_maker/tmp/log.access | |
pos_file /var/log/td-agent/apache.access.pos | |
tag apache.access | |
</source> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GNU Screen configuration file | |
# seapy <iamseapy@gmail.com> | |
# | |
# Notes | |
# ----- | |
# 1. To change the colors of the hardstatus line, change this line: | |
# sorendition "+b +kG" | |
# Example: blue (+b) highlight with black text (k) on a green background (G) | |
# Example: sorendition "+r +kG" is red highlighting with black text on a green background | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_showDatepicker: function(input) { | |
input = input.target || input; | |
if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger | |
input = $("input", input.parentNode)[0]; | |
} | |
.......... 생략 | |
if (!$.datepicker._pos) { // position below input | |
$.datepicker._pos = $.datepicker._findPos(input); | |
$.datepicker._pos[1] += input.offsetHeight; // add the height | |
// patch start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 터미널 색 설정 | |
export TERM="xterm-color" | |
export CLICOLOR=1 | |
export LSCOLORS="gxfxcxdxbxegedabagacad" | |
# Alias 설정 | |
alias ll="ls -al" | |
# 마우스 오른쪽으로 다른프로그램 열기할때 중복으로 앱이 나오는거 제거하는 방법 | |
alias fixow='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user;killall Finder;echo "Open With has been rebuilt, Finder will relaunch"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Post < ActiveRecord::Base | |
belongs_to :user | |
attr_accessible :body, :title | |
after_destroy :after_destroy | |
private | |
def after_destroy | |
puts "Post after_destroy" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
require 'php_serialize' | |
# MySQL 접속 정보를 가지는 ActiveRecord 클래스 생성 | |
class SeapyBlog < ActiveRecord::Base | |
end | |
# 기존 MySQL DB 접속 정보 설정 | |
SeapyBlog.establish_connection( | |
:adapter => "mysql2", |