Skip to content

Instantly share code, notes, and snippets.

View J-Swift's full-sized avatar

Jimmy Reichley J-Swift

  • Rockledge, FL
View GitHub Profile
@J-Swift
J-Swift / provision.sh
Created March 1, 2023 20:19
nix auto-updating system with flakes
#!/usr/bin/env bash
set -euo pipefail
readonly flake_name='u3macbook'
readonly real_script_dir=$( dirname $(readlink $HOME/.config/nixpkgs/flake.nix) )
header() {
local -r msg="${1:-}"
@J-Swift
J-Swift / auto_reload.py
Created November 17, 2022 18:16
iterm2 script for reloading all panes in a window
#!/usr/bin/env python3.7
import iterm2
async def get_last_line(session):
async with session.get_screen_streamer() as streamer:
ready = False
while ready != True:
content = await streamer.async_get()
for i in range(content.number_of_lines):
line = content.line(content.number_of_lines-i-1)
@J-Swift
J-Swift / App.cs
Created October 23, 2022 17:51
Basic example of programmatic ResourceDictionary configuration
public class App : Application
{
public App()
{
StyleUtils.ConfigureResources(Resources, new ThemeLight());
...
}
}
@J-Swift
J-Swift / build-ios.ps1
Created October 4, 2022 19:44
Generate an ipa/dsyms in Maui
#!/usr/bin/env pwsh
param(
[Parameter(Mandatory = $true)][string] $AppName,
[Parameter(Mandatory = $true)][int] $BuildNumber
)
$ErrorActionPreference = 'Stop'
$outDir = Join-Path '.' 'artifacts' 'ios'
@J-Swift
J-Swift / GetStream.Bindings.csproj
Last active February 15, 2023 01:50
Scratch pad of building maui net6.0-ios bindings with fat xcframeworks
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-ios</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsBindingProject>true</IsBindingProject>
<NoBindingEmbedding>true</NoBindingEmbedding>
<BindingPlatform>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</BindingPlatform>
</PropertyGroup>
<ItemGroup Condition="'$(BindingPlatform)' == 'ios'">
@J-Swift
J-Swift / code.swift
Created August 19, 2022 13:59
Runtime values of NSAttributedString.Key
print("attachment [\(NSAttributedString.Key.attachment.rawValue)]")
print("backgroundColor [\(NSAttributedString.Key.backgroundColor.rawValue)]")
print("baselineOffset [\(NSAttributedString.Key.baselineOffset.rawValue)]")
// print("cursor [\(NSAttributedString.Key.cursor.rawValue)]") // mac
print("expansion [\(NSAttributedString.Key.expansion.rawValue)]")
print("font [\(NSAttributedString.Key.font.rawValue)]")
print("foregroundColor [\(NSAttributedString.Key.foregroundColor.rawValue)]")
// print("glyphInfo [\(NSAttributedString.Key.glyphInfo.rawValue)]") // mac
print("kern [\(NSAttributedString.Key.kern.rawValue)]")
print("ligature [\(NSAttributedString.Key.ligature.rawValue)]")
@J-Swift
J-Swift / MainActivity.kt
Last active August 3, 2022 13:15
(Almost) fully programmatic creation of Jetpack Navigation graph
package com.example.myapplication
import android.os.Bundle
import android.util.Log
import android.view.Menu
import com.google.android.material.bottomnavigation.BottomNavigationView
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentContainerView
import androidx.navigation.NavGraph
@J-Swift
J-Swift / update_deployment.ps1
Created July 8, 2022 13:55
Capistrano-style IIS deployment helper
param(
[switch] $Rollback
)
################################################################################
# Config
################################################################################
$WebsiteName = "FIXME: IIS WEBSITE NAME"
$WaitForWebsiteTimeoutSeconds = 60
@J-Swift
J-Swift / ns.sh
Last active June 23, 2022 02:45
Function for quick nix shells
function ns() {
local pkgs=""
for arg in "$@"; do
local pkgs="nixpkgs#${arg} ${pkgs}"
done
echo "nix shell ${pkgs}"
nix shell $pkgs
}
@J-Swift
J-Swift / home.nix
Created April 19, 2022 15:31
Basic example of installing a binary through nix home manager
{ config, lib, pkgs, options, ... }:
let
carthage = pkgs.stdenv.mkDerivation rec {
pname = "carthage";
version = "0.38.0";
src = pkgs.fetchurl {
url = "https://github.com/Carthage/Carthage/releases/download/${version}/Carthage.pkg";
sha256 = "1d5s160vbd3c3fvx93zq7aw0qgp1l95ri3ayskjg7cc8c2qk1s0f";
};