Skip to content

Instantly share code, notes, and snippets.

View zbowling's full-sized avatar
🌍
Mobile

Zac Bowling zbowling

🌍
Mobile
View GitHub Profile
@zbowling
zbowling / kwallet-to-libsecret.py
Created February 6, 2026 05:34
Import KWallet Chrome keys and portal tokens to GNOME Keyring
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.10"
# dependencies = []
# ///
"""
kwallet-to-libsecret.py
Import secrets from a KWallet XML export into GNOME Keyring (libsecret).
Primarily useful for migrating Chrome/Chromium Safe Storage keys after
@zbowling
zbowling / kwallet-to-libsecret.py
Created February 6, 2026 05:28
Import KWallet Chrome keys to GNOME Keyring after switching from KDE
#!/usr/bin/env python3
"""
kwallet-to-libsecret.py
Import Chrome/Chromium Safe Storage keys from a KWallet XML export into
GNOME Keyring (libsecret). This allows Chrome to decrypt its saved passwords
after switching from KDE Plasma to GNOME or another desktop environment.
Usage:
1. Export your KWallet: Open KWalletManagerFileExport as XML
import requests
from bs4 import BeautifulSoup
import xml.etree.ElementTree as ET
import ollama
def fetch_rss_feed(url):
response = requests.get(url)
response.raise_for_status()
return response.content
from collections import List, Dict
from utils.variant import Variant
@value
struct JsonNode(CollectionElement, Stringable):
var value: Pointer[Variant[NoneType, Bool, Float64, String, List[Self], Dict[String, Self]]]
fn __init__(inout self: Self, value: Variant[NoneType, Bool, Float64, String, List[Self], Dict[String, Self]]):
self.value = Pointer[Variant[NoneType, Bool, Float64, String, List[Self], Dict[String, Self]]].alloc(1)
self.value[0] = value
@zbowling
zbowling / conway.mojo
Last active November 23, 2023 18:51
conway.mojo
from python import Python
from random import randint
from memory import memset_zero, memcpy
from time import sleep
let show_change = True
struct Grid:
var data: DTypePointer[DType.uint8]
var rows: Int
//
// HCLevelModel.h
// HamsterCrunch
//
// Created by Zac Bowling on 2/25/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>

Improve Libc Portability

During the review process, add the following fields as needed:

@zbowling
zbowling / 0001-android-Add-locale-support.patch
Created September 29, 2014 18:02
libc++ patches from google
From 4cc54e7dcd19f78a3ebaaa3c6f05885029c53b01 Mon Sep 17 00:00:00 2001
From: David 'Digit' Turner <[email protected]>
Date: Wed, 12 Feb 2014 20:04:18 +0800
Subject: [PATCH 01/12] android: Add locale support.
This is based on the Bionic <ctype.h> declarations. Note that
unfortunately, the _ctype_ table exposed by this header has a bug
so a fixed copy is included here instead.
See src/support/android/locale_android.cpp for details.
@zbowling
zbowling / gist:3318310
Created August 10, 2012 21:47
Mountain Lion "locate" fix.

One of my favorite commands on most unix systems is the locate command which ships with the system. After upgrading Apple seems to have completely broken it.

It appears the built /usr/libexec/update.localdb script looks for a nobody user on Mountain Lion (this is the same version of this script since Snow Leopard). This user seems to be missing after an in-place Mountian Lion upgrade but may be missing in regular installs as well. Apple didn't seem to check to see if the locate script (Apple use's the version from FreeBSD) still worked after changing the default users in the local ldap on your machine. The locate.update script needs the user id for "nobody" to mark as the owner of the database files it creates.

Instead of modifying this script I found it easier to bring back the nobody user. This also fixes mysql upgrades from lion as well.

(nobody user on Lion was user 13)

sudo dscl . -create /Users/nobody
// HACK: Create an offscreen text view solely for calculating the height of table view cells
// containing text views. This bizarre hack is needed because:
//
// a.) UITextView is bizarre and uses WebKit instead of UIKit's methods for displaying strings,
// and NSString's sizeWithFont:constrainedToSize: does not calculate the height exactly as
// it does. (For instance, the height of strings with trailing whitespace are calculated
// differently, and UITextView some strange built-in padding and slightly
// different-than-usual line height that is annoyingly difficult to replicate, etc...,
// etc...).
//