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
| --[[ | |
| Copyright (C) 2017 AMM | |
| This program is free software: you can redistribute it and/or modify | |
| it under the terms of the GNU General Public License as published by | |
| the Free Software Foundation, either version 3 of the License, or | |
| (at your option) any later version. | |
| This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
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
| -- youtube-quality.lua | |
| -- | |
| -- Change youtube video quality on the fly. | |
| -- | |
| -- Diplays a menu that lets you switch to different ytdl-format settings while | |
| -- you're in the middle of a video (just like you were using the web player). | |
| -- | |
| -- Bound to ctrl-f by default. | |
| local mp = require 'mp' |
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 "murmur3.rkt") | |
| (require data/bit-vector) | |
| (require racket/serialize) | |
| (provide make-bloom-filter make-recommended-bloom-filter bloom-filter-recommender bloom-filter-member? bloom-filter-batch-member? bloom-filter-add! false-positive-rate ) | |
| (define (murmur-int x seed) (murmur-hash (integer->integer-bytes x 8 false false) seed)) | |
| (define (h1 x) (murmur-int x 583)) | |
| (define (h2 x) (murmur-int x 2387)) |
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 json | |
| racket/port | |
| racket/unix-socket | |
| racket/async-channel) | |
| (provide mpv/fire-and-forget) | |
| (define (mpv/fire-and-forget files) | |
| (match-let-values | |
| ([(_ _ to-mpv _) (subprocess (open-output-file "/dev/null" #:exists 'append) |
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
| (define (rmap proc target) | |
| (cond | |
| [(list? target) (map (curry rmap proc) target)] | |
| [(vector? target) (vector-map (curry rmap proc) target)] | |
| [else (proc target)])) |
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/gui | |
| (require framework) | |
| (define swapping-tab-panel% | |
| (class tab-panel% | |
| (inherit get-selection set-selection set) | |
| (super-new [callback | |
| (lambda (b e) | |
| (when (eq? 'tab-panel (send e get-event-type)) | |
| (send swapper-panel active-child |
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 "observer-app.rkt") | |
| ;; > (hash-set! (observers-namespace) '+ `(,(lambda (a . b) (printf "adding ~a to ~a~n" a b)))) | |
| ;; > (+ 1 2 3) | |
| ;; adding 1 to (2 3) | |
| ;; 6 | |
| (provide (rename-out [observer-app #%app]) | |
| observers-namespace) |
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
| (define (sync/vector evts-v) | |
| (let ([sync-vec (build-vector (vector-length evts-v) | |
| (lambda (n) | |
| (wrap-evt | |
| (vector-ref evts-v n) | |
| (lambda (r) (cons n r)))))]) | |
| (let loop () | |
| (let ([remaining-evts (filter evt? (vector->list sync-vec))]) | |
| (unless (empty? remaining-evts) | |
| (let ([res (apply sync remaining-evts)]) |
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 db | |
| memo | |
| "util.rkt" | |
| racket/serialize) | |
| (provide #%app | |
| #%datum | |
| #%top |
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
| ;; Remove a given tag from a set of file ids. | |
| ;; If any of the file ids is not tagged with the given tag, they are silently skipped | |
| ;; without hassling the user. If a tag is empty after this operation, it is deleted. | |
| ;; | |
| ;; TODO: This procedure performs up to three database writes. If those writes | |
| ;; happened to be interleaved with other writes which are associated with | |
| ;; the same tag, screwy things might happen. Therefore these two/three | |
| ;; writes should be performed in a single transaction. | |
| (define (untag-files tag . file-ids) | |
| (let* ([tag-id (get-tag-id tag)] |
NewerOlder