Skip to content

Instantly share code, notes, and snippets.

View shirakaba's full-sized avatar
💭
🧙‍♂️

Jamie Birch shirakaba

💭
🧙‍♂️
View GitHub Profile
@shirakaba
shirakaba / Changing timestamp on commit.md
Created July 12, 2024 03:43
Changing timestamp on commit
# Interactively rebase the current branch onto `main`
git rebase -i main

Modify the commit dates of first commit and second commit but leave third commit unchanged.

pick c40f82d first commit
exec git commit --amend --no-edit --date "Wed Jul 10 08:30:00 2024 +0900"
@shirakaba
shirakaba / Getting Biome to behave in a monorepo.md
Last active July 18, 2024 07:38
Getting Biome to behave in a monorepo

How to get Biome to behave in a monorepo

At the time of writing, namely v1.8.3, Biome does not fully support monorepos yet, but you can wrestle it into working.

Below, we have a typical monorepo (with the changes we're about to make marked in green). It has some workspaces under apps and packages, and at each level of the repo, there are a mixture of files we want to format or ignore.

  .
  ├── .gitignore
+ ├── .vscode
@shirakaba
shirakaba / I hate pip.md
Last active December 29, 2023 08:27
Fixing pip when even `pip --version` fails

A very common failure pattern of pip is the following:

> pip --version
/usr/local/bin/pip:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/pkg_resources/__init__.py", line 631, in _build_master
    ws.require(__requires__)
  File "/opt/homebrew/lib/python3.11/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
@shirakaba
shirakaba / gist:85297b286c7c4fd6097c2e2c49d8ff1e
Last active December 27, 2023 11:43
Setting up deDRM with Calibre

Go to apprenticeharper/DeDRM_tools and download the latest release.

Follow the plugin's installation instructions:

Open calibre's Preferences dialog. Click on the "Plugins" button. Next, click on the button, "Load plugin from file". Navigate to the unzipped DeDRM_tools folder, find the file "DeDRM_plugin.zip". Click to select the file and select "Open". Click "Yes" in the "Are you sure?" dialog box. Click the "OK" button in the "Success" dialog box.

Once the DeDRM plugin appears in the Calibre plugins menu, double-click it to get the Customise DeDRM popup. From there, click "eInk Kindle ebooks".

Add the serial number for your preferred Kindle (the one you intend to download files for) via the Manage Your Content and Devices section of the Amazon site (instructions here).

@shirakaba
shirakaba / react-native-jsi-bridge-2+1.0.0.patch
Last active September 29, 2023 23:11
react-native-webview jsi patch
diff --git a/node_modules/react-native-jsi-bridge-2/ios/JsiBridgeEmitter.h b/node_modules/react-native-jsi-bridge-2/ios/JsiBridgeEmitter.h
index 62da923..cae7aee 100644
--- a/node_modules/react-native-jsi-bridge-2/ios/JsiBridgeEmitter.h
+++ b/node_modules/react-native-jsi-bridge-2/ios/JsiBridgeEmitter.h
@@ -9,16 +9,16 @@
#import <Foundation/Foundation.h>
#import "_JsiBridge.h"
-typedef void (^JsiBridgeCallback)(id data);
+typedef void (^CustomJsiBridgeCallback)(id data);
@shirakaba
shirakaba / Bun exiting without debug.md
Created September 24, 2023 02:46
Bun exiting without debug

We're going to be calling into Python from Bun, so ensure that you have Python 3 and Pip and install these packages for Python:

# https://github.com/polm/fugashi
pip install fugashi

# https://github.com/polm/unidic-py
pip install unidic
@shirakaba
shirakaba / UniDic Licence.txt
Last active August 9, 2023 01:42
UniDic fields
Copyright (c) 2011-2021, The UniDic Consortium
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
@shirakaba
shirakaba / Creating an Expo app in 2023.md
Created July 12, 2023 08:08
Creating an Expo app in 2023

Creating an Expo app in 2023

12th July, 2023. I'm going to try creating an iOS app called Paranovel, using Expo. My environment for mobile app dev (Xcode, Ruby, etc.) should be in reasonably good shape already as I frequently develop with React Native and NativeScript.

Creating the app

Go to https://docs.expo.dev, and see the Quick Start: npx create-expo-app paranovel

This runs with no problem, then I get this macOS system popup:

@shirakaba
shirakaba / How to install pip and six on macOS with Nix and home-manager.md
Created January 25, 2023 08:45
How to install pip and six on macOS with Nix and home-manager

Given the following Nix packages (you may be able to install six manually rather than managing it by Nix, but anyway, this was my setup):

pkgs.python310Full
pkgs.python310Packages.six

I would very often run into this situation:

/usr/local/bin/pip: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory

@shirakaba
shirakaba / clang ast dumping.md
Last active January 18, 2023 09:44
How dump the ASTs for an Obj-C file using the clang CLI tool

For example, for the NSString.h header:

clang \
  -Xclang \
  -ast-dump \
  -fsyntax-only \
  -x objective-c \
  -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Foundation.framework/Headers \
 -F/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks \