Skip to content

Instantly share code, notes, and snippets.

@howeyc
howeyc / Vigenere.lisp
Created December 14, 2011 13:21
Golden Ratio Challenge
;;; Golden Ratio Challenge: http://1.61803398874.com/
;;; https://en.wikipedia.org/wiki/Vigenère_cipher
;;;
;;; This implements the Vigenere cipher to solve the problem with one addition:
;;; Numbers are translated to letters. By glancing over the wikipedia page
;;; it seems as though the encryption algorithm is meant only for letters.
;;;
;;; Copyright Chris Howey
;;; Released under the ISC License
;;;
@howeyc
howeyc / p1.lisp
Created February 11, 2012 01:54
Embedly Challenge (apply.embed.ly)
(defun list-to-n (n)
(loop for x from 1 to n
collect x))
(defun fac (n)
(reduce #'* (list-to-n n)))
(defun num-to-str (num)
(with-output-to-string (str)
(format str "~a" num)))
@howeyc
howeyc / are-count-true.lisp
Created May 4, 2012 14:52
Lisp boolean m-of-n short circuiting
; Inspired by http://symbo1ics.com/blog/?p=1352
(defmacro are-count-true (num first-arg &rest args)
"Short circuit boolean expressions, finding if NUM are true."
(cond ((not (numberp num)) (error "Count must be number!"))
((minusp num) (error "What does negative number mean?"))
((zerop num) t)
((> num (1+ (length args))) nil)
((= num 1) `(or ,first-arg ,@args))
((= num (1+ (length args))) `(and ,first-arg ,@args))
(t
@howeyc
howeyc / watchalldirs.go
Created February 12, 2013 12:56
Watch for created directories.
package main
import (
"log"
"os"
"path/filepath"
"github.com/howeyc/fsnotify"
)
@howeyc
howeyc / s3cp.go
Last active January 21, 2021 20:07
Golang - copy files to / from s3
// From https://github.com/kr/s3/tree/master/s3cp
// Added public read for uploaded files
// Command s3cp copies a file to or from Amazon S3.
//
// Usage:
//
// s3cp file url
// s3cp url file
//
// The file does not need to be seekable or stat-able. You can use s3cp to
@howeyc
howeyc / fsnotify-additions.go
Created October 25, 2013 15:50
Additional OptionsWatcher interface. Didn't actually attempt to use, just an idea.
type FileNotification interface {
IsCreate() bool
IsDelete() bool
IsModify() bool
IsRename() bool
Path() string // relative path to the file
}
type OptionWatcher interface {
Close() error
@howeyc
howeyc / s3dl.go
Created November 14, 2013 22:53
Download an s3 bucket.
// Download a public s3 bucket.
//
// Relies on the directory listing being public.
//
// Example usage:
// s3dl -bucket <bucketName>
//
// -> Will download all files in the "<bucketName>" s3 bucket
// to "<bucketName>" folder.
package main
@howeyc
howeyc / s3size.go
Created May 24, 2015 11:52
Size of s3 bucket.
// Get the size of a public s3 bucket.
//
// Relies on the directory listing being public.
//
// Example usage:
// s3size -bucket <bucketName>
//
package main
import (
"encoding/xml"

Keybase proof

I hereby claim:

  • I am howeyc on github.
  • I am howeyc (https://keybase.io/howeyc) on keybase.
  • I have a public key whose fingerprint is 98D9 FC94 5C89 2216 376F 8E2D B96D 30AC D3C7 F8C3

To claim this, I am signing this object:

@howeyc
howeyc / GitHub-Forking.md
Last active October 22, 2018 13:48 — forked from Chaser324/GitHub-Forking.md
Fork & Pull Request Workflow

Git Forking Process

Right now the process has references to GitHub as it has been taken from a GitHub open source tutorial. This will be updated with references to our own local gitea instance once it has been setup.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or just head straight to the command line:

# Clone your fork to your local machine