Skip to content

Instantly share code, notes, and snippets.

View frijole's full-sized avatar
🌯

Ian Meyer frijole

🌯
View GitHub Profile
//
// RikerIpsum.h
//
// Based on http://www.rikeripsum.com
// Created by @frijole on 3/19/13.
//
#import <Foundation/Foundation.h>
@interface RikerIpsum : NSObject
@frijole
frijole / ImageScanner.swift
Created July 21, 2021 18:12
from a project to scan screenshots of the FlightRadar24 app
import UIKit
import Vision
class ImageScanner: NSObject {
struct ImageSlices {
var registrationSlice: UIImage
var operatorSlice: UIImage
var flightSlice: UIImage
var originSlice: UIImage
var destinationSlice: UIImage
say you have some files, maybe youtube-dl output, thats includes an mpeg 4 video file and captions in ttml format like this:
$ ls
Destroy the Technostructure.description
Destroy the Technostructure.en.ttml
Destroy the Technostructure.jpg
Destroy the Technostructure.mp4
and you want to prepare a nice mp4 file to use in Home Sharing with that subtitle track available like a real movie.
#!/usr/bin/env python3
import math
class Navigation:
def findDistanceAndBearing(_, lat, lon):
# TODO: Make location configurable
x1 = float(40.579640)
y1 = float(-73.839530)
x2 = float(lat)
@frijole
frijole / artdsb_sample_loop.py
Created February 2, 2021 21:59
sample of work-in-progress library for artdsb projects (http://frijole.info/art-dsb/)
def show_sample_loop():
matrix = artdsb_led.api_get_display()
draw, image = artdsb_led.api_get_drawing()
ttfFont = load_font()
artdsb_led.api_clear_screen(draw)
artdsb_led.api_draw_text(draw, ttfFont, "Ready.")
artdsb_led.api_display_image(image, matrix)
iteration = 0
@frijole
frijole / dmg_extract.sh
Last active December 12, 2020 02:02
a shell script to copy the `Icons` folder out of an IconFactory archive DMG download, based on https://stackoverflow.com/a/48251635
#!/bin/bash
dmg_path="$1"
# use process redirection to capture the mount point and dev entry
IFS=$'\n' read -rd '\n' mount_point dev_entry < <(
# mount the diskimage; leave out -readonly if making changes to the filesystem
hdiutil attach -readonly -plist "$dmg_path" | \
# convert output plist to json
@frijole
frijole / adsbstats.py
Last active July 1, 2020 19:00
how many planes? roughly based on sample code from adafruit's library for talking to the oled hat
import time
import subprocess
from board import SCL, SDA
import busio
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1305
import urllib.request, json
import sys
@frijole
frijole / gist:856ec212cc218b314490a90d87d934ed
Created November 1, 2018 14:45
Carthage 0.29.0 install
// If you have a later version of carthage installed:
$ brew uninstall --force carthage
// To install Carthage 0.29.0:
$ brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/45dd24d8dfa7a2fb69812c678ceb34be0c16e295/Formula/carthage.rb
@frijole
frijole / DynamicCollectionView.m
Created February 4, 2016 14:36
Resize a collection view to its content with AutoLayout via http://stackoverflow.com/a/26232188
@interface DynamicCollectionView : UICollectionView
@end
@implementation DynamicCollectionView
- (void) layoutSubviews
{
[super layoutSubviews];
@frijole
frijole / gist:3eafc99cfbc5bd2e96ae
Last active August 29, 2015 14:07
supportedInterfaceOrientations implementation that allows all orientations on iPad, all but upside-down on the iPhone 6 Plus, and portrait-only for others. But it feels dirty...
- (NSUInteger)supportedInterfaceOrientations
{
UIInterfaceOrientationMask rtnOrientationMask = UIInterfaceOrientationMaskPortrait;
if ( UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad ) {
rtnOrientationMask = UIInterfaceOrientationMaskAll;
} else if ( [UIScreen mainScreen].bounds.size.height > 600.0f || [UIScreen mainScreen].bounds.size.width > 600.0f ) {
rtnOrientationMask = UIInterfaceOrientationMaskAllButUpsideDown;
} else {
rtnOrientationMask = UIInterfaceOrientationMaskPortrait;