Skip to content

Instantly share code, notes, and snippets.

@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 / 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);
[].__proto__.__proto__ = new Proxy({}, { get: (_, n) => n < 0 ? [] : [...[][n-1], n] })
// Proxy {}
[][5]
// (6) ["0", "1", "2", "3", "4", "5"]
[][42]
// (43) ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42"]
{
"ACL" : [
{
"GroupDomain" : "SystemInternal",
"GroupType" : "Privileged",
"ObjectId" : 1,
"ObjectType" : "RT::System",
"PrincipalType" : "Group",
"RightName" : "ShowApprovalsTab"
},