Skip to content

Instantly share code, notes, and snippets.

@jordanisaacs
jordanisaacs / invalid.zig
Created April 7, 2024 01:27
Zig invalid pointer wrapper
const std = @import("std");
const builtin = @import("builtin");
const InvalidInt: isize = -1;
pub fn InvalidPtr(T: anytype, constant: bool) type {
const InvalidPtrType, const TPtrType = blk: {
if (constant) {
break :blk .{ *const anyopaque, *const T };
} else {
packages.objectbox-c = with pkgs; let
pname = "objectbox-c";
version = "0.18.1";
src = fetchurl {
url = "https://github.com/objectbox/${pname}/releases/download/v${version}/objectbox-linux-x64.tar.gz";
hash = "sha256-oYz8ZBNdoTG3NDOuiu0JbmiAmSg4jQf9DQQIMZaNfNQ=";
};
in
stdenv.mkDerivation rec {
inherit pname version src;
error:
… while evaluating the attribute 'buildInputs' of the derivation 'nix-shell'
at /nix/store/n66pr4d5aipxphyg3id30f3ddhywcwmy-source/pkgs/stdenv/generic/make-derivation.nix:293:7:
292| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
293| name =
| ^
294| let
@jordanisaacs
jordanisaacs / sieve
Created November 22, 2022 08:10
Fastmail Sieve Folders
if not string :is "${stop}" "Y"
{
### @xxx.com rules
if address :all :matches ["To", "Cc", "Bcc", "Resent-To", "X-Delivered-To"] "*@xxx.com"
{
if string :is ["deltachat"] "${1}" {
fileinto "INBOX.DeltaChat";
}
else {
fileinto :copy "INBOX.INBOX.personal";
@jordanisaacs
jordanisaacs / sway.log
Created October 12, 2022 06:47
sway firefox flicker log
00:00:00.000 [INFO] [sway/main.c:338] Sway version 1.8-dev
00:00:00.000 [INFO] [sway/main.c:339] wlroots version 0.16.0-dev
00:00:00.002 [INFO] [sway/main.c:120] Linux desktop 6.0.0 #1-NixOS SMP PREEMPT_DYNAMIC Sun Oct 2 21:09:07 UTC 2022 x86_64 GNU/Linux
00:00:00.002 [INFO] [sway/main.c:136] Contents of /etc/lsb-release:
00:00:00.002 [INFO] [sway/main.c:120] DISTRIB_CODENAME=raccoon
00:00:00.002 [INFO] [sway/main.c:120] DISTRIB_DESCRIPTION="NixOS 22.11 (Raccoon)"
00:00:00.002 [INFO] [sway/main.c:120] DISTRIB_ID=nixos
00:00:00.002 [INFO] [sway/main.c:120] DISTRIB_RELEASE="22.11"
00:00:00.002 [INFO] [sway/main.c:120] LSB_VERSION="22.11 (Raccoon)"
00:00:00.002 [INFO] [sway/main.c:136] Contents of /etc/os-release:
@jordanisaacs
jordanisaacs / myweechat.md
Created February 14, 2022 23:06 — forked from pascalpoitras/config.md
My always up-to-date WeeChat configuration (weechat-dev)

WeeChat Screenshot

The squares in the chanmon buffer at the top of weechat in the gif above are there only to hide the nicknames and the messages in the gif to respect users privacies

You need at least WeeChat 3.4-dev

Enable mouse

/mouse enable
@jordanisaacs
jordanisaacs / kagi-dark-theme.css
Last active November 6, 2023 11:03
Dark theme for Kagi based on DuckDuckGo (+ UI improvements)
:root {
--card-color: #222;;
--card-radius: 5px;
--card-padding: 20px;
--sub-result-inset: 20px;
--border-color: var(--header-border);
--related-item-bg: #222;
--search-result-gap: 8px;
--background-color: #161616; /* #222 */
--app-sidebar-bg: #161616;
@jordanisaacs
jordanisaacs / sessioncookie.py
Created April 3, 2021 22:13
Basic implementation with example of a FastAPI SessionCookie (compatible with OpenAPI and dependency injection)
from datetime import timedelta, datetime
from typing import Type, Optional, Dict, Any, Tuple
from uuid import uuid4
from abc import ABC, abstractmethod
from fastapi import FastAPI, Request, Depends, HTTPException, Response
from fastapi.security.api_key import APIKeyBase, APIKey, APIKeyIn
from base64 import b64encode, b64decode
from itsdangerous import TimestampSigner
from itsdangerous.exc import BadTimeSignature, SignatureExpired