This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function xcode-select-dialog | |
# Get current Xcode | |
set CURRENT_XCODE (xcode-select -p | sed "s/\/Contents\/Developer//") | |
# Find all Xcodes on system | |
set XCODES (mdfind "kMDItemCFBundleIdentifier == 'com.apple.dt.Xcode' && kMDItemContentType == 'com.apple.application-bundle'") | |
# Build a dialog menu | |
set MENU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ErrorHandler { | |
var callback: (Error) -> Void | |
func handle(_ block: () throws -> Void) { | |
do { | |
try block() | |
} | |
catch { | |
callback(error) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct __ValueType__ { | |
} | |
struct __ValueType__Key: EnvironmentKey { | |
static var defaultValue = __ValueType__() | |
} | |
extension EnvironmentValues { | |
var __KeyName__: __ValueType__ { | |
get { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
### Fish function for setting up a Visual Studio Code python project using Poetry and Pyenv | |
### How to install: copy this into your ~/.config/fish/functions directory | |
### How to use: mkdir a project direct, cd into it, and run the code-python-setup function | |
### This function will: | |
### * install dependencies | |
### * select and/or install if necessary a particular python version (using pyenv) | |
### * set up a poetry virtual environment | |
### * configure the vscode project settings with the correct interpreter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
from pathlib import Path | |
import plistlib | |
import pinboard # install via pip | |
from shutil import which | |
PINBOARD_TOKEN = "< your pinboard token>" | |
subprocess.check_call( | |
[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func movement() async { | |
// TODO: Dont use async version because it hangs! | |
GCController.startWirelessControllerDiscovery { } | |
while !Task.isCancelled { | |
// Wait for any controller to become current | |
_ = await NotificationCenter.default.notifications(named: .GCControllerDidBecomeCurrent, object: nil).makeAsyncIterator().next() | |
guard let currentController = GCController.current, let gamepad = currentController.extendedGamepad else { | |
return | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filter1Password.py | |
# Quick script to help filter records from a 1Password .csv export for importing into Safari/iCloud Keychain | |
# Safari rejects records with no username, password or url. This script takes your 1Password export and "splits" it | |
# into two CSV file, one with these records filtered out, and one with just records with the required fields. You can then import the | |
# filtered .csv file directly into Safari and should not get import warnings. | |
# This script also filters out records with the "Archive" field set to true - these are 1Password records that you previously Trashed | |
import csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# %% | |
import pandas as pd | |
import numpy as np | |
import datetime as dt | |
from datetime import datetime | |
import calmap | |
# Data from https://www.gunviolencearchive.org/ | |
#events = pd.read_csv('ChildrenKilled.csv', parse_dates=['Incident Date']) | |
events = pd.read_csv('MassShootings.csv', parse_dates=['Incident Date']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
# brew tap charmbracelet/tap && brew install charmbracelet/tap/gum | |
function spm-init | |
gum style --foreground 11 "Package Type:" | |
set TYPE (gum choose "library" "executable" "empty" "system module" "manifest") | |
gum style --foreground 10 $TYPE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PlaygroundSupport | |
import SwiftUI | |
PlaygroundPage.current.setLiveView(ContentView()) | |
struct ContentView: View { | |
var body: some View { | |
Color.white.frame(width: 600, height: 800).touchVisualizer() | |
} | |
} |
OlderNewer