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
(ns tofino | |
(:require [clojure.string :as str])) | |
(defn rows [page] | |
(map #(str/split % #"\s+") | |
(str/split-lines (slurp page)))) | |
(defn barcode [row] | |
(first row)) |
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
(ns ytdl | |
(:require ["ytdl-core$default" :as ytdl] | |
["fluent-ffmpeg$default" :as FFmpeg] | |
["fs" :as fs] | |
[promesa.core :as p])) | |
(defn save | |
"Fetches a YouTube url and writes it to a file." | |
[url name] | |
(p/let [stream (ytdl url)] |
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
// https://web.archive.org/web/20170715041035/http://www.willvillanueva.com/the-web-audio-api-from-nodeexpress-to-your-browser/ | |
var express = require('express'); | |
var fs = require('fs'); | |
var ejs = require('ejs'); | |
var path = require('path'); | |
var app = express(); | |
app.use(express.static(__dirname + '/public')); |
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
ffmpeg -i 'in.mp4' -af acompressor=threshold=-30dB:ratio=20:makeup=10 -c:v copy out.mp4 |
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
;; https://adventofcode.com/2021/day/1 | |
(ns day01 | |
(:require [clojure.string :as str])) | |
(def input (map #(Integer/parseInt %) (str/split-lines (slurp "day01.txt")))) | |
;; this is like levels of tired->wired etc... | |
;; there was a loop-based solution in https://www.youtube.com/watch?v=q_I3r0JGhR8 by onthecodeagain | |
;; which received some comments from Erik Grundy and Sebastian Anklamm offering a more functional solution: |
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
(ns example | |
(:require ["fs" :as fs] | |
["web-audio-api$default" :as wa])) | |
(def ^:dynamic context (wa/AudioContext.)) | |
(set! (.-outStream context) (.-stdout js/process)) | |
(fs/readFile "outfoxing.mp3" | |
(fn [err buffer] | |
(when err (throw err)) |
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
(defn svg-node [label x y] | |
[:g [:ellipse {:fill "none" :stroke "black" :cx x :cy y :rx 27 :ry 18}] | |
[:text {:text-anchor "middle" :x x :y (+ 4 y) :font-family "Monospace" | |
:font-size 14} label]]) | |
(defn svg-edge [label x y path points] | |
[:g | |
[:path {:fill "none" :stroke "black" :d path}] | |
[:polygon {:fill "black" :stroke "black" :points points}] | |
[:text {:text-anchor "middle" :x x :y y :font-family "Monospace" :font-size 14.00} label]]) |
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
(defn svg-node [label x y] | |
[:g [:ellipse {:fill "none" :stroke "black" :cx x :cy y :rx 27 :ry 18}] | |
[:text {:text-anchor "middle" :x x :y (+ 4 y) :font-family "Monospace" | |
:font-size 14} label]]) | |
(defn svg-edge [label x y path points] | |
[:g | |
[:path {:fill "none" :stroke "black" :d path}] | |
[:polygon {:fill "black" :stroke "black" :points points}] | |
[:text {:text-anchor "middle" :x x :y y :font-family "Monospace" :font-size 14.00} label]]) |
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
(defn dag3 [] | |
[:svg {:width "100%" :viewBox "0 0 566 305"} | |
[:g {:transform "scale(1,1), rotate(0), translate(4,301)"} | |
[:polygon {:fill "white" :stroke "none" :points "-4,4 -4,-301 562,-301 562,4 -4,4"}] | |
[svg-node "14" 315 -18] | |
[svg-node "12" 459 -18] | |
[svg-node "11" 171 -18] | |
[svg-node "10" 243 -18] | |
[svg-node "13" 531 -18] | |
[svg-node "4" 99 -105] |
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
(ns selection | |
(:require [reagent.core :as r])) | |
(defn button [label onclick] | |
[:button | |
{:on-click onclick} | |
label]) | |
(defn polygon [& points] | |
[:polygon |