This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF | |
appify v3.0.1 for Mac OS X - http://mths.be/appify | |
Creates the simplest possible Mac app from a shell script. | |
Appify takes a shell script as its first argument: | |
`basename "$0"` my-script.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/function) | |
(struct command (subproc stdout stdin)) | |
(define (start cmd-str . args) | |
(define-values (subp out in _err) | |
(if (null? args) | |
; 'new is important - without it, killing the subprocess will not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/contract/base | |
racket/match | |
racket/symbol | |
txexpr | |
xml) | |
;; Function for calculating the length in characters of an x-expression if it | |
;; we converted to a string --- without actually converting it into a string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
;; Generate a form email to let someone know their SPF records are misconfigured for their current email provider. | |
;; | |
;; Run (fill-report "domain.com" "1.2.3.4") where the 2nd arg is the sending email server's IP address. | |
;; It will copy the completed report to the clipboard for you. | |
;; Only works on Windows for now. | |
(require net/dns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang scribble/lp2 | |
@(require scribble/manual | |
(for-label racket/contract | |
racket/base)) | |
@(declare-exporting "lp2.rkt") | |
@title[#:style manual-doc-style]{Example} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
;; Place all the files in this gist in the same folder | |
;; Then do: | |
;; racket -tm run-test.rkt -- simple.html.pm out.html template.html.p wax-template.html.rkt | |
;; | |
;; For comparison, also try doing "raco make wax-template.html.rkt" before running run-test.rkt | |
(require pollen/core | |
(prefix-in pollen: pollen/render)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require br/macro | |
pict | |
racket/class | |
racket/draw) | |
;; Make wallpaper for use on server desktops | |
(define mint-green (make-object color% 1 133 116)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require threading) | |
(define (slice-pairs slice-count) | |
(combinations (range slice-count) 2)) | |
;; Any two non-adjacent slices form a sandwich | |
(define (sandwich-pair? lst) | |
(and (list? lst) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ raco pollen render another.txt example.txt | |
pollen: rendering another.txt example.txt | |
pollen: rendering /another.txt.pm | |
pollen: rendered /another.txt (421 ms) | |
pollen: rendering /example.txt.pm | |
pollen: rendered /example.txt (339 ms) | |
❯ cat another.txt | |
Result: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
;; Comparing the speed of two methods for getting the first N words out of the string elements | |
;; of a tagged X-expression. | |
;; | |
;; Licensed under the Blue Oak Model License 1.0.0 (blueoakcouncil.org/license/1.0.0) | |
(require racket/list | |
txexpr) |
NewerOlder