- Disk space: at least 3× the size of the
/var/www/nextcloud
directory is available on/var/backups
- Nextcloud is installed into
/var/www/nextcloud
as userwww-data
- AWS cli is installed and configured with credentials
mysqldump
is installedrsync
is installed
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
import json | |
from datetime import datetime, timezone | |
LEVELS = { | |
"emergency": 7, | |
"alert": 6, | |
"critical": 5, | |
"error": 4, | |
"warning": 3, | |
"notice": 2, |
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 | |
net/http-easy) | |
(define (base-url path) | |
(string-append "https://httpbin.org" path)) | |
; request: GET | |
; response: plain string body |
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 | |
(provide | |
server-start) | |
(require | |
markdown | |
net/url | |
web-server/http | |
web-server/servlet-env |
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 (for-syntax racket/base)) | |
; Reading Quotes | |
; see: https://docs.racket-lang.org/reference/reader.html | |
; ' quote #' syntax | |
; ` quasiquote #` quasisyntax | |
; , unquote #, unsyntax | |
; ,@ unquote-splicing #,@ unsyntax-splicing |
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
[ | |
{ | |
"id": 1, | |
"radical": "一", | |
"pinyin": "yī", | |
"english": "one", | |
"strokeCount": 1 | |
}, | |
{ | |
"id": 2, |
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
(ns main (:gen-class)) | |
;; Snake :: [[int int]…] | |
;; vector of x,y tuples | |
;; head is first, tail is last | |
;; out-of-bounds? :: (int int int) -> bool | |
;; grid-size is 1-indexed, x+y are 0-indexed | |
(defn out-of-bounds? [grid-size x y] | |
(or (neg? x) (neg? y) (>= x grid-size) (>= y grid-size))) |
A predicate function returns a boolean true
or false
, and it's name ends with a ?
. Ran against Clojure 1.10.0.
({:ns clojure.string,
:predicates
({:fn ends-with?, :arglists ([s substr])}
{:fn starts-with?, :arglists ([s substr])}
{:fn includes?, :arglists ([s substr])}
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
const wrapPromise = fn => (...args) => | |
new Promise(resolve => setTimeout( | |
() => resolve(fn(...args)), | |
Math.floor(Math.random() * 1500) + 250) | |
) | |
const upper = wrapPromise(str => str.toUpperCase()) | |
const underline = str => `__${str}__` | |
const exclamate = wrapPromise(str => str + '!') | |
// Util: Create promise chain |
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
{ | |
// Tight coupling from A to B => A needs B to be defined, callable and adhere to an interface | |
// No coupling from B to A => B does not need A in any way (pure fn) | |
function a() { | |
b() | |
} | |
function b() {} | |
} | |
{ |