Skip to content

Instantly share code, notes, and snippets.

@ymorimo
ymorimo / gist:955020
Created May 4, 2011 10:02
Set xattr after saving UTF-8 files in Emacs
(when (eq system-type 'darwin)
(defvar my-set-xattr-utf-8-modes '(text-mode org-mode ruby-mode js2-mode css-mode))
(defun my-set-xattr-if-utf-8()
(when (and (memq major-mode my-set-xattr-utf-8-modes)
(string-match "^utf-8" (prin1-to-string buffer-file-coding-system)))
(call-process "xattr" nil 0 nil "-w" "com.apple.TextEncoding" "UTF-8;134217984" buffer-file-name)))
(add-hook 'after-save-hook 'my-set-xattr-if-utf-8))
def daemon_monitoring(w, options = {})
# ...
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 30.seconds
c.running = false
c.notify = 'ymorimo'
end
end
# ...
RAILS_ROOT = File.dirname(File.dirname(__FILE__))
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
def daemon_monitoring(w, options = {})
w.interval = 30.seconds
w.start = "#{options[:script]} start"
w.restart = "#{options[:script]} restart"
w.stop = "#{options[:script]} stop"
w.grace = 30.seconds
RAILS_ROOT = File.dirname(File.dirname(__FILE__))
RAILS_ENV = ENV['RAILS_ENV'] || 'production'
God.watch do |w|
script = "env RAILS_ENV=#{RAILS_ENV} #{RAILS_ROOT}/script/daemons/scheduler"
w.name = "scheduler"
w.group = "example_app"
w.pid_file = "#{RAILS_ROOT}/log/scheduler_daemon.pid"
w.interval = 30.seconds
Daemons.run_proc('twitter_streaming_daemon',
:dir_mode => :normal,
:dir => File.join(APP_DIR, 'log'),
:multiple => false,
:backtrace => true,
:monitor => false,
:log_output => true
) do
EventMachine::run do
--- src/nsterm.m 2010-03-29 23:48:44 +0000
+++ src/nsterm.m 2010-05-14 09:56:22 +0000
@@ -4471,8 +4471,15 @@
? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
emacs_event->code = code;
- EV_TRAILER (theEvent);
- return;
+
+ /* HACK: pass shift+ascii to input manager */
(add-hook 'find-file-hook
(lambda()
(if (string-match "/Dropbox/" buffer-file-name)
(set (make-variable-buffer-local 'make-backup-files) nil))))
// ==UserScript==
// @name jnb_branch_001
// @namespace http://github.com/ymorimo
// @description Autofill JNB's branch number 001 on its login form
// @include https://www.japannetbank.co.jp/login.html
// ==/UserScript==
window.addEventListener('load', function() {
document.forms.wrappedJSObject.HOST.TenNo.value = '001';
}, false);