Skip to content

Instantly share code, notes, and snippets.

View espresso3389's full-sized avatar

Takashi Kawasaki espresso3389

View GitHub Profile
@espresso3389
espresso3389 / android_sdk_headless_ubuntu_24.04.md
Last active June 11, 2025 05:29
How to install Android SDK Headless on Ubuntu 24.04

Installation

# prerequisites
sudo apt update
sudo apt install unzip wget openjdk-21-jdk-headless

# https://developer.android.com/studio#cmdline-tools
CMDTOOLS_ZIP=commandlinetools-linux-13114758_latest.zip
@espresso3389
espresso3389 / wsl2-bitwarden-ssh-agent.md
Last active June 20, 2025 06:56
Bitwarden SSH Agent relay to WSL2
@espresso3389
espresso3389 / genesis-wsl2.md
Last active January 24, 2025 13:10
Run Hello, Genesis on WSL2 (Ubuntu 24.04)

Run Hello, Genesis on WSL2 (Ubuntu 24.04)

image

Install Python and venv

sudo apt install python python3-venv
@espresso3389
espresso3389 / find_cert.rb
Created December 10, 2024 18:42
Find a signing certificate of serial number from keychain
#!/usr/bin/env ruby
require 'openssl'
def print_usage
puts "Usage: #{File.basename($0)} [-s|-S|-C component] <serial_number> [keychain]"
puts "Options:"
puts " -s Show only certificate subject (single line)"
puts " -S Show only certificate subject (one parameter per line)"
puts " -C component Show only specified component (e.g., -C CN for Common Name)"
@espresso3389
espresso3389 / provprof.rb
Created December 10, 2024 18:41
Get info. such as signing certificate's serial number from provisioning profile
#!/usr/bin/env ruby
require 'openssl'
def print_usage
puts "Usage: #{File.basename($0)} <provisioning_profile_path>"
puts "Example: #{File.basename($0)} /path/to/profile.mobileprovision"
exit 1
end
@espresso3389
espresso3389 / winrt_formatters.h
Created December 9, 2024 03:08
C++23 std::formatter implementations for WinRT classes
#ifndef WINRT_FORMATTERS_H
#define WINRT_FORMATTERS_H
#include <windows.h>
#include <winrt/base.h>
#include <string>
#include <format>
@espresso3389
espresso3389 / html_image_embed.js
Created October 1, 2024 16:06
Node.js program that converts HTML with img files to a single HTML that uses embedded image data using data protocol
const fs = require('fs').promises;
const path = require('path');
const cheerio = require('cheerio');
const sharp = require('sharp');
const zlib = require('zlib');
const util = require('util');
const gzip = util.promisify(zlib.gzip);
async function optimizeAndConvertToDataURI(imagePath, baseDir, useLossless) {
@espresso3389
espresso3389 / flutter-build-env.ps1
Last active February 2, 2024 12:21
Create Flutter Android build environment on Windows
# Need to enable scripting before executing the file
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
cd ~
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
scoop install git
scoop bucket add java
@espresso3389
espresso3389 / nfkc.dart
Last active October 30, 2023 08:23
Using icu from Dart/Flutter
import 'dart:ffi';
import 'dart:io';
import 'package:ffi/ffi.dart';
import 'package:unorm_dart/unorm_dart.dart' as unorm_dart; // fallback
String _getLibicuModuleName() {
if (Platform.isAndroid) {
return 'libicu.so';
} else if (Platform.isWindows) {
@espresso3389
espresso3389 / wsl2-rootless-docker.md
Last active June 15, 2025 14:24
WSL2 configuration for developing using rootless docker

NOTE: WORK IN PROGRESS

WSL2 configuration for developing using rootless docker

This document assumes Windows Insider Preview Dev.

Install Ubuntu 22.04

Installing Ubuntu 22.04.1 LTS from Microsoft Store.