This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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) |
This file contains hidden or 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
| Not Authenticated | |
| Log In* | |
| authenticate -> Authenticated | |
| Authenticated | |
| Reservation Display* | |
| log out -> Log In | |
| enter reservation -> Reservation Display | |
| enter message -> Reservation Display | |
| click own reservation -> Edit Reservation |
This file contains hidden or 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 txexpr) | |
| (define (string-reverse str) | |
| (list->string (reverse (string->list str)))) | |
| (define (replace-first-space str) | |
| (string-replace str " " " " #:all? #f)) |
This file contains hidden or 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 pollen | |
| ◊define-meta[title]{Chapter I} | |
| Travellers left and entered our car at every stopping of the train. Three persons, however, remained, bound, like myself, for the farthest station... |
This file contains hidden or 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 | |
| # This script will push any changes in a local dev environment (both files and | |
| # a SQL database) to a prod server. It assumes you have passwordless SSH login | |
| # set up on the remote server, and that you already have a database of the same | |
| # name created on the remote server. | |
| # This script stores SQL usernames and passwords in plain text. If you use it, | |
| # make sure you store it in a safe place, don't include it in version control, | |
| # and chmod its permissions to 700! |
This file contains hidden or 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
| # Load functions for validating email addresses | |
| from email.utils import parseaddr | |
| from dns.resolver import query | |
| from dns.exception import DNSException | |
| def check_address(addr): | |
| addr_parsed = parseaddr(addr)[1] | |
| # An empty string at this point means the address was wildly invalid | |
| if addr_parsed == '': |
This file contains hidden or 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 | |
| # Script to find a line in a text file (based on an environment variable) and increment a value within that line | |
| # In this example, the text file has several lines of the form "<ip address>,<number>" | |
| # Add a line for this IP address if it doesn't exist | |
| grep -q -F $REMOTE_ADDR hits.txt || echo "$REMOTE_ADDR,0" >> hits.txt | |
| # Increase the count for this IP address | |
| sed -r -i 's/'"$REMOTE_ADDR"',([0-9]+)/echo "$REMOTE_ADDR,$((\1+1))"/ge' /d2a/4weeks/shipreporthits.txt |