Skip to content

Instantly share code, notes, and snippets.

Avatar

Brad Clawsie bradclawsie

View GitHub Profile
@bradclawsie
bradclawsie / go_tls_server_conf.go
Created Mar 6, 2014
A sample tls server configuration that scored reasonably well on the Qualys SSL test.
View go_tls_server_conf.go
srv := &http.Server{
Addr: ":443",
TLSConfig: &tls.Config{
CipherSuites: []uint16{
tls.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
tls.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA,
tls.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA,
View keybase.md

Keybase proof

I hereby claim:

  • I am bradclawsie on github.
  • I am bradclawsie (https://keybase.io/bradclawsie) on keybase.
  • I have a public key whose fingerprint is A241 EE39 764B 3F6B 7B8C F45D C518 3746 444A F753

To claim this, I am signing this object:

@bradclawsie
bradclawsie / bst
Created Mar 19, 2014
balanced search tree
View bst
data Tree = Empty | Node Tree Int Tree deriving (Show)
insert n Empty = Node Empty n Empty
insert n (Node l i r) = if n <= i then Node (insert n l) i r else Node l i (insert n r)
View ss
substring a b = ss a b
where
ss (x:xs) (y:ys) = if (x == y) then ss xs ys else substring a ys
ss (x:xs) _ = False
ss _ _ = True
View ss.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int ss(char *n, char *h) {
const size_t n_len = strlen(n);
// empty needle is in haystack
if (n_len == 0) return 1;
const size_t h_len = strlen(h);
// needle cannot be longer than haystack
View putjson.go
package main
import (
"fmt"
"os"
"time"
"net/http"
"encoding/json"
"github.com/smugmug/godynamo/conf"
View numberpuzzle.hs
module Main where
import Prelude as P
import Control.Monad as M
import Data.Text as T
import Data.Text.Read as TR
import Data.Either as E
import Data.List as L
import Data.Maybe as MB
-- http://programmingpraxis.com/2015/06/26/find-the-missing-number/
View 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
View gnus.el
(require 'smtpmail)
(require 'pgg)
;; -------------------------------------------------------------
;; location awareness
(if (run-at-home)
(setq user-mail-address "REDACTED")
(setq user-mail-address "REDACTED"))
;; -------------------------------------------------------------
View zshrc.sh
export HISTFILE=~/.histfile
export HISTSIZE=1000
export SAVEHIST=1000
bindkey -e
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
PS1="$ "
export PATH=""