Skip to content

Instantly share code, notes, and snippets.

@sartak
sartak / a.md
Last active March 22, 2024 22:16
Anki 2 annotated schema
@sartak
sartak / Dockerfile
Created January 17, 2024 22:57
Anki sync server Dockerfile
FROM debian:sid-slim
ENV THROW_AWAY=0005
ENV DEBIAN_FRONTEND=noninteractive
RUN set -ex && apt update --fix-missing && apt install -y curl build-essential protobuf-compiler && rm -rf /var/lib/apt/
RUN curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN cargo install --git https://github.com/ankitects/anki.git --tag 23.12 anki-sync-server
use postgres::{Client, NoTls};
use rand::{
distributions::{Alphanumeric, DistString},
Rng,
};
use sea_query::*;
use sea_query_postgres::PostgresBinder;
use std::{hint::black_box, time::Instant};
#[derive(Iden)]
import { createContext, useContext, useEffect, useState } from "react";
import { type SpotlightActionData } from "@mantine/spotlight";
type ContextValue = Array<SpotlightActionData>;
type ContextType = [
ContextValue,
React.Dispatch<React.SetStateAction<ContextValue>>
];
const Context = createContext<ContextType>([[], () => {}]);
root@c546e96dead5:/app# bun --revision
1.0.3+25e69c71e70ac8a0a88f9cf15b4057bd7b2a633a
root@c546e96dead5:/app# which node bun
/root/.bun/bin/bun
root@c546e96dead5:/app# gdb `which bun` frontend/core
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
// ==UserScript==
// @name Monkeytype results
// @version 0.1
// @description Monkeytype results
// @author You
// @match https://monkeytype.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@sartak
sartak / 1-anki_mobile_card.html
Last active February 18, 2023 17:15 — forked from redoPop/anki_mobile_card.html
HTML used by AnkiMobile 2.0.88 to render card templates; a reference for creating advanced Anki card templates with special HTML/CSS
<html>
<head>
<meta
name="viewport"
id="viewport"
content="width=device-width,initial-scale=1.0,maximum-scale=10,user-scalable=1"
/>
<link type="text/css" rel="stylesheet" href="res/web/css/reviewer.css" />
<script src="res/web/js/vendor/jquery.min.js"></script>
<script src="res/web/js/vendor/css_browser_selector.min.js"></script>
@sartak
sartak / keymap.c
Last active December 26, 2022 18:44
Repeat Key
#include QMK_KEYBOARD_H
enum custom_keycodes {
REP = SAFE_RANGE
};
// use REP in the layout
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = ...
uint16_t key = 0;
@sartak
sartak / default-chords.csv
Last active October 11, 2022 17:27
Default CharaChorder1 chords for device shipped 2022-09-15
s + Dup say
y + b by
y + Dup why
n + Dup no
n + f find
l + f life
l + p people
l + s + p spell
l + n line
l + n + p plant
@sartak
sartak / gist:4a4a718c7d7ea05da7fd3551c975aa00
Created August 2, 2020 23:13
JavaScript for PC Anki (v2.1.19) and iOS AnkiMobile (2.0.63) to enable the card to automatically advance to the answer side
// Note: This assumes for iOS AnkiMobile that a midCenter tap advances to the answer side)
<script type="text/javascript">
$(document).ready(function () {
// see https://gist.github.com/sartak/581d3564dc42b689b604
if (window.anki && window.sendMessage) {
// delay to give Anki a chance to continue processing
setTimeout(function () {
window.sendMessage("ankitap", "midCenter");
}, 100);