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
| #include "tco.h" | |
| #include <stdlib.h> | |
| #include <stdarg.h> | |
| conscell cons_f(void *car, void *cdr) | |
| { | |
| conscell ret = malloc(sizeof(struct conscell_str)); | |
| ret->car = car; | |
| ret->cdr = cdr; |
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 THREAD(thread_id, fun, ...) \ | |
| __extension__ pthread_create(thread_id, NULL, ({ \ | |
| void *func() { \ | |
| fun(__VA_ARGS__); \ | |
| return NULL; \ | |
| } \ | |
| func;\ | |
| }), NULL) |
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
| ; global registers: | |
| ; r0 - no man's land | |
| ; r1 - return address | |
| ; X (r26,r27) - frame pointer | |
| ;function frame: | |
| ;--------------------------- | |
| ; return address | |
| ; arg0 | |
| ; ... |
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] CWG5oZB593w: Downloading webpage | |
| [youtube] CWG5oZB593w: Downloading video info webpage | |
| [info] Available formats for CWG5oZB593w: | |
| format code extension resolution note | |
| 249 webm audio only DASH audio 53k , opus @ 50k, 7.95MiB | |
| 250 webm audio only DASH audio 69k , opus @ 70k, 9.97MiB | |
| 171 webm audio only DASH audio 125k , vorbis@128k, 17.30MiB | |
| 140 m4a audio only DASH audio 129k , m4a_dash container, mp4a.40.2@128k, 21.23MiB | |
| 251 webm audio only DASH audio 132k , opus @160k, 18.76MiB | |
| 160 mp4 256x144 144p 112k , avc1.4d400c, 25fps, video only, 9.43MiB |
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
| local mp = require 'mp' | |
| local msg = require 'mp.msg' | |
| local time_saved = 0 -- TODO keep running system total | |
| local last_time = 0 -- FIXME reset this on on_load? | |
| local last_speed = 1 -- FIXME not necessarily true, set this for real on on_load | |
| local last_tick_time = 0 |
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
| -- placed in .config/mpv/user-builtins/ | |
| local msg = require 'mp.msg' | |
| local function ping() | |
| msg.error("PONG") | |
| end | |
| return { | |
| ping = ping, |
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
| (query-exec (sqldb-param) | |
| (prepared (string* "INSERT OR REPLACE INTO TagCardinalities (a,b,cardinality)" | |
| " SELECT min($1,t.tag_id),max($1,t.tag_id),ifnull(sub.cnt,0) " | |
| " FROM Tags t LEFT JOIN" | |
| "(SELECT tag_id, COUNT(*) as cnt FROM FileTags WHERE file_id IN " | |
| "(SELECT file_id FROM FileTags WHERE tag_id=$1)" | |
| "GROUP BY tag_id) AS sub" | |
| "ON t.tag_id = sub.tag_id")) | |
| a-id))) |
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
| > .schema | |
| CREATE TABLE Files( file_id INTEGER PRIMARY KEY, filename VARCHAR(4096) NOT NULL UNIQUE, last_modified INTEGER, size INTEGER, num_tags INTEGER DEFAULT 0); | |
| CREATE TABLE sqlite_stat1(tbl,idx,stat); | |
| CREATE TABLE FileTags( file_id INTEGER NOT NULL, tag_id INTEGER NOT NULL, probability DOUBLE NOT NULL, PRIMARY KEY (file_id, tag_id), FOREIGN KEY(file_id) REFERENCES Files(file_id), FOREIGN KEY(tag_id) REFERENCES Tags(tag_id)); | |
| CREATE TABLE Tags(tag_id INTEGER PRIMARY KEY, tag_name VARCHAR[50] NOT NULL UNIQUE, num_files INTEGER DEFAULT 0); | |
| CREATE TABLE TagCardinalities( | |
| a INTEGER NOT NULL, | |
| b INTEGER NOT NULL, | |
| cardinality INTEGER, | |
| PRIMARY KEY (a,b), |
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)] |
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 |
OlderNewer