Skip to content

Instantly share code, notes, and snippets.

View bradclawsie's full-sized avatar

Brad Clawsie bradclawsie

View GitHub Profile
@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 / biff.el
Created December 5, 2010 06:43
biff for gnus
;; biff
(defvar foundnewmbox "")
(defun fmbiff ()
(interactive)
(save-excursion
(set-buffer "*Group*")
(beginning-of-buffer)
(defvar foundanymbox nil)
(cond ((re-search-forward "INBOX.ALL" nil t)
(setq foundanymbox t))
@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 / 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 / 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 / tmux.conf
Created December 5, 2010 06:36
tmux conf
set-option -g status-bg black
set-option -g status-fg white
set-option -g status-interval 60
set-option -g status-left "#($HOME/bin/imapbiff.pl)"
set-option -g status-right "#(/bin/date +\"%R %F\")"
@bradclawsie
bradclawsie / nginx ssl
Last active September 25, 2015 17:18
nginx ssl hardening highlights
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES128-SHA:AES256-CGM-SHA256:ECDHE-RSA-AES256-SHA256:RC4:HIGH:!aNULL:!MD5:-LOW:-SSLv2:-EXP;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains";
@bradclawsie
bradclawsie / pw.hs
Created May 9, 2011 06:03
haskell pw prompt
module Main where
import System.IO
import Data.Char
import System.Console.ANSI
-- ord val of 10 is return key
getPW = getPW' "" where
getPW' s = getChar >>= \x ->
if ((ord x) == 10) then return s
else cursorBackward 1 >> putStr "*" >> getPW' (s ++ [x])