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
[core] | |
repositoryformatversion = 0 | |
filemode = true | |
bare = false | |
logallrefupdates = true | |
ignorecase = true | |
[remote "origin"] | |
url = git@github.com:paltman/<private_repo>.git | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
[branch "master"] |
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
(defun merb-console (app host user &optional env working-dir) | |
"Connect to a remote host and run merb" | |
(interactive) | |
(require 'inf-ruby) | |
(let ((buffer-name-for-comint (concat app "-console")) | |
(buffer-name (concat "*" app "-console*")) | |
(env (if env env "production")) | |
(working-dir (if working-dir working-dir | |
(concat "/data/" app "/current"))) | |
(cmdlist `("ssh" ,host "-t" |
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
(defun open-next-http-url () | |
"Search forward to the next http/https URL, and open it" | |
(interactive) | |
(save-excursion | |
(nonincremental-re-search-forward "https*://") | |
(browse-url-at-point)) | |
) |
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
for app in /merbapps/* ; do | |
echo "Starting $app" | |
cd $app | |
if [ -e bin/merb ] | |
MERB_ENV=production bin/merb | |
else | |
MERB_ENV=production merb | |
fi | |
cd .. | |
done |
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
(defvar user-temporary-file-directory | |
(concat temporary-file-directory user-login-name "/")) | |
(make-directory user-temporary-file-directory t) | |
(setq backup-by-copying t) | |
(setq backup-directory-alist | |
`(("." . ,user-temporary-file-directory) | |
(,tramp-file-name-regexp nil))) | |
(setq auto-save-list-file-prefix | |
(concat user-temporary-file-directory ".auto-saves-")) |
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
console 1: | |
merb : worker (port 4000) ~ Starting Mongrel at port 4000 | |
merb : worker (port 4000) ~ Successfully bound to port 4000 | |
^C ~ Reaping Workers | |
merb : worker (port 4000) ~ Exiting port 4000 | |
console 2: |
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
declare -a pids | |
i=0 | |
for pid in log/merb.*.pid ; do | |
if [ $pid != "log/merb.main.pid" ]; then | |
pids[$i]=`cat $pid` | |
fi | |
(( i++ )) | |
done |
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
declare -a pids | |
i=0 | |
for pid in log/merb.*.pid ; do | |
if [ $pid == "log/merb.main.pid" ]; then | |
echo "Killing master process" | |
kill -9 `cat $pid` | |
else | |
pids[$i]=`cat $pid` | |
fi |
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
def HTTP.get_truncated_response(uri_or_host, path = nil, port = nil, &block) | |
range = { 'Range' => "bytes=0-1000"} | |
if path | |
host = uri_or_host | |
new(host, port || HTTP.default_port).start {|http| | |
return http.request_get(path, range, &block) | |
} | |
else | |
uri = uri_or_host | |
new(uri.host, uri.port).start {|http| |
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
def fetch_with_limits(uri_str, limit = 10) | |
raise ArgumentError, 'HTTP redirect too deep' if limit == 0 | |
url = URI.parse(uri_str) | |
req = Net::HTTP::Post.new(url.path) | |
req.range = (0..1000) | |
response = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) } | |
case response | |
when Net::HTTPSuccess then response | |
when Net::HTTPRedirection then fetch(response['location'], limit - 1) |