Skip to content

Instantly share code, notes, and snippets.

View bradclawsie's full-sized avatar

Brad Clawsie bradclawsie

View GitHub Profile
@bradclawsie
bradclawsie / .emacs
Created December 5, 2010 04:00
public .emacs
;; -------------------------------------------------------------
(defun run-at-home ()
(interactive)
(string-match "192" (shell-command-to-string
"/sbin/ifconfig -a|awk '/inet /'")))
(defun run-on-inside ()
(interactive)
@bradclawsie
bradclawsie / xmonad.hs
Created December 5, 2010 04:07
xmonad.hs
import XMonad
import qualified XMonad.StackSet as SS
import qualified XMonad.Layout as L
import qualified XMonad.Util.CustomKeys as C
import qualified XMonad.Actions.Warp as W
import qualified Data.Map as M
main :: IO ()
main = xmonad $ defaultConfig
{ borderWidth = 0
@bradclawsie
bradclawsie / w3m.el
Created December 5, 2010 04:08
public w3m.el
(require 'w3m-search)
(eval-after-load "w3m-search"
'(progn
(add-to-list 'w3m-search-engine-alist
'("quote"
"http://finance.google.com/finance?q=%s"
nil))
(add-to-list 'w3m-search-engine-alist
'("ports"
"http://www.freebsd.org/cgi/ports.cgi?query=%s"
@bradclawsie
bradclawsie / gnus.el
Created December 5, 2010 04:09
public .gnus.el
(require 'smtpmail)
(require 'pgg)
;; -------------------------------------------------------------
;; location awareness
(if (run-at-home)
(setq user-mail-address "REDACTED")
(setq user-mail-address "REDACTED"))
;; -------------------------------------------------------------
@bradclawsie
bradclawsie / zshrc.sh
Created December 5, 2010 04:10
public .zshrc
export HISTFILE=~/.histfile
export HISTSIZE=1000
export SAVEHIST=1000
bindkey -e
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
PS1="$ "
export PATH=""
@bradclawsie
bradclawsie / fractal.hs
Created December 5, 2010 04:13
haskell fractal benchmark
{-# OPTIONS -fexcess-precision -fvia-C -fbang-patterns
-optc-O2 -optc-mfpmath=sse -optc-msse2 -optc-march=pentium4 #-}
module Main where
import System.Time
-- in the spirit of http://www.timestretch.com/FractalBenchmark.html
m :: Double -> Double -> Integer
m x y = f 0.0 0.0 (y - 0.5) x 0
@bradclawsie
bradclawsie / findports.hs
Created December 5, 2010 04:14
find new bsd ports
{-
this is a trivial script to tell us when a freebsd port has been updated
within the last N days, where N is the argument provided to the script on the
command line.
this code is licensed under a "bsd" license, which is stated below
Copyright (c) 2007, Brad Clawsie. All rights reserved.
http://b7j0c.org/stuff/license.txt
@bradclawsie
bradclawsie / news.hs
Created December 5, 2010 04:15
generate static news page with haskell
{-
this code is licensed under a "bsd" license, which is stated below
Copyright (c) 2007, Brad Clawsie. All rights reserved.
http://b7j0c.org/stuff/license.txt
-}
{-# LANGUAGE Arrows, NoMonomorphismRestriction #-}
@bradclawsie
bradclawsie / imapbiff.py
Created December 5, 2010 06:25
imap biff in python
#!/usr/bin/python
import imaplib
M = imaplib.IMAP4_SSL('imap.gmail.com')
if (M.login('YOU@gmail.com','PASSWORD')[0] != 'OK'): exit("no conn")
c = (M.select('Inbox'))[1][0]
if (c != '0'):print c
M.shutdown()
@bradclawsie
bradclawsie / imapbiff.pl
Created December 5, 2010 06:35
imap biff in perl
#!/usr/bin/env perl
use Net::IMAP::Simple::SSL;
$| = 1;
my $server = 'imap.gmail.com';
my $user = 'YOU@gmail.com';
my $pass = 'PASSWORD';
my $imap = Net::IMAP::Simple::SSL->new($server);
$imap->login($user => $pass) || die "cannot connect";
my $messages = $imap->select('Inbox');
my $count = 0;