Skip to content

Instantly share code, notes, and snippets.

View bradclawsie's full-sized avatar

Brad Clawsie bradclawsie

View GitHub Profile
@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 / 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 / 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 / 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 = '[email protected]';
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;
@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('[email protected]','PASSWORD')[0] != 'OK'): exit("no conn")
c = (M.select('Inbox'))[1][0]
if (c != '0'):print c
M.shutdown()
@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 / 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 / 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 / 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 / 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"))
;; -------------------------------------------------------------