Skip to content

Instantly share code, notes, and snippets.

@achamian
achamian / com.achamian.network.plist
Created November 21, 2013 07:09
Change Security configuration based on network SSID
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.achamian.network.plist</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/networkchange</string>
@achamian
achamian / emacs
Created April 10, 2012 10:02
Launch emacs
#!/usr/bin/env sh
if [ -z $1 ]; then
LAUNCH_DIR=$PWD
else
LAUNCH_DIR=$1
fi
open -a Emacs $LAUNCH_DIR
@achamian
achamian / gist:1065427
Created July 5, 2011 17:58
el-get config for defunkt/textmate.el
;; local sources
(setq el-get-sources
'((:name textmate
:type git
:url "https://github.com/defunkt/textmate.el.git"
:features textmate
:after (lambda () (textmate-mode)))))
@achamian
achamian / ssh-copy-id
Created June 9, 2011 05:54
Copy public key to authorized_keys
#!/usr/bin/env sh
# Copy public key to authorized_keys of a remote machine
if [ -z $1 ] || [ -z $2 ];then
echo "Usage"
echo "ssh-copy-id hostname /path/to/public/key"
exit
fi
KEYCODE=`cat $2`
ssh -q $1 "mkdir ~/.ssh 2>/dev/null; chmod 700 ~/.ssh; echo "$KEYCODE" >> ~/.ssh/authorized_keys; chmod 644 ~/.ssh/authorized_keys"
@achamian
achamian / gist:662788
Created November 4, 2010 17:13
Nginx configuration options
./configure --prefix=/usr --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_gzip_static_module --with-http_secure_link_module --with-http_stub_status_module --with-md5-asm --with-sha1-asm --with-cpu-opt=amd64
module PoxPaginate
module ActiveSupport
end
end
require "#{PoxPaginate::Root}/pox_paginate/active_support/core_hash_ext"
ActiveSupport::CoreExtensions::Hash::Conversions::ClassMethods.send :include, PoxPaginate::ActiveSupport::CoreHashExt
# config/routes.rb
MyApp::Application.routes.draw do
resources :users
end
# app/controllers/users_controller.rb
class UsersController < ApplicationController
def new
end
end
#!/bin/sh
# replace all occurrences of
# require File.dirname(__FILE__) + "/../spec_helper"
# with
# require "spec_helper"
find ./**/*_spec.rb -type f | xargs sed -e 's/^require.*spec_helper.*$/require \"spec_helper\"/g' -i .sed.back
find ./**/*_spec.rb.sed.back -type f | xargs rm
require 'fileutils'
require 'active_support'
require 'commands/servers/base'
puts "=> Ctrl-C to shutdown listener"
tail_thread = tail(Pathname.new("#{File.expand_path(RAILS_ROOT)}/log/#{RAILS_ENV}.log").cleanpath)
trap(:INT) { exit }