Skip to content

Instantly share code, notes, and snippets.

View davidphasson's full-sized avatar

David Hasson davidphasson

  • Los Angeles, CA
View GitHub Profile
@davidphasson
davidphasson / gist:100840
Created April 23, 2009 23:34 — forked from anonymous/gist:100838
Dump exchange databases to pst files
# Script for dumping exchange database to .pst files.
# Globals
$Now = Get-Date
$Days = "7"
$TargetFolder = "C:\Users\jtrout\"
$LastWrite = $Now.AddDays(-$days)
$Files = get-childitem $TargetFolder -include *.pst -recurse | Where {$_.LastWriteTime -le "$LastWrite"}
@davidphasson
davidphasson / .vimrc
Created April 23, 2009 18:31
Current .vimrc from mac laptop
set number
set shiftwidth=4
set tabstop=4
syntax on
set smartindent
" Tab key mappings
nmap th :tabprev<cr>
nmap tl :tabnext<cr>
nmap tn :tabnew<cr>
@davidphasson
davidphasson / gist:100663
Created April 23, 2009 18:26
Getting OpenBSD source code
# cd /usr
# cvs -qd [email protected]:/cvs get -rOPENBSD_4_5 -P src
@davidphasson
davidphasson / .kshrc
Created April 23, 2009 17:45
Setting up pkg_path in openbsd
export PKG_PATH=http://openbsd.berkeley.edu/pub/OpenBSD/4.4/packages/i386/
@davidphasson
davidphasson / render404.rb
Created April 22, 2009 22:57 — forked from bensie/render404.rb
Method for rendering a 404
# Painless method for rendering a 404 (not found) whenever it might be useful
def render_404
respond_to do |format|
format.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => :not_found }
format.xml { head :not_found }
end
end
#!/usr/bin/php
<?
$api_key = "xxxx";
$url = "xxxx";
foreach( glob("*.xml") as $filename)
{
$cmd = "curl -u $api_key:X -H 'Content-type: application/xml' -d \@$filename $url";
$result = `$cmd`;
@davidphasson
davidphasson / gist:93177
Created April 10, 2009 17:00 — forked from anonymous/gist:93135
PPTP from Dr. Trout
/etc/options
#debug
proxyarp
#+MSChap-V2 mppe-128 mppe-stateless
##require-mschap-v2
##require-mppe-128
ms-dns 192.168.100.1
/etc/options.pptpd
# Authentication
@davidphasson
davidphasson / gist:92124
Created April 8, 2009 23:22
Mac pbcopy
[~/.ssh]$ cat id_dsa.pub | pbcopy
@davidphasson
davidphasson / application_controller.rb
Created April 8, 2009 22:33 — forked from bensie/application_controller.rb
HTTP Basic Authentication
def authenticate
authenticate_or_request_with_http_basic do |username, password|
username == "joe" && password == "secret"
end
end
@davidphasson
davidphasson / show.html.erb
Created April 8, 2009 03:42
ERB and the case statement
# Doesn't work
<p>
<% case @request.author_hosted %>
<% when "yes" %>
The school <b>has</b> hosted an author before.
<% when "no" %>
The school <b>has not</b> hosted an author before.
<% end %>
</p>