Skip to content

Instantly share code, notes, and snippets.

View jbnunn's full-sized avatar
:octocat:

Jeff Nunn jbnunn

:octocat:
View GitHub Profile
@jbnunn
jbnunn / SignInView.swift
Last active January 15, 2024 02:02
SwiftUI + PhoneNumberKit implementation
import SwiftUI
import UIKit
import PhoneNumberKit
struct PhoneNumberTextFieldView: UIViewRepresentable {
@Binding var phoneNumber: String
private let textField = PhoneNumberTextField()
func makeUIView(context: Context) -> PhoneNumberTextField {
textField.withExamplePlaceholder = true
@jbnunn
jbnunn / requirements.txt
Last active February 9, 2023 13:11
Conda DL environment for Mac M1/M2 (PyTorch)
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-arm64
# Set the platform to arm64 with `conda env config vars set CONDA_SUBDIR=osx-arm64`
# For HuggingFace see https://huggingface.co/docs/accelerate/usage_guides/mps
accelerate=0.16.0=pyhd8ed1ab_0
aiohttp=3.8.3=pypi_0
aiosignal=1.3.1=pypi_0
async-timeout=4.0.2=pypi_0
@jbnunn
jbnunn / update.py
Last active December 4, 2022 13:57
Update a Lambda function from the command line (Mac OS X)
"""
$ python update.py
Updates an AWS Lambda function with all the latest goodies.
To use, create a directory containing all the files and requirements required to
execute your Lambda function. Supply the directory, ARN of your Lambda function,
and AWS profile (defaults to `default`) as arguments to `update.py`, e.g.,
python update.py <directory> <lambda_arn> <aws_profile>
@jbnunn
jbnunn / Install CARLA.md
Last active September 17, 2022 01:03
Installing Ubuntu Desktop w/ CARLA on AWS

Using the CARLA autonomous driving simulator on an NVidia virutal machine

First, launch the Nvidia Gaming PC for Ubuntu 18.04 AMI from https://aws.amazon.com/marketplace/pp/B07SSKJMBJ?ref=cns_1clkPro.

Test initial installation

After the AMI boots, SSH in and check nvidia-smi to confirm you have NVIDIA drivers by default. If you don't see something similar to the below, you've launched the wrong instance.

+-----------------------------------------------------------------------------+
@jbnunn
jbnunn / Gist
Last active April 6, 2021 16:38 — forked from kurokikaze/gist:350fe1713591641b3b42
Install Google Chrome from Powershell
$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor = "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)
@jbnunn
jbnunn / Acceleration Vectors
Last active December 18, 2020 13:55
Learning Lua by building Asteroids. This function moves the spaceship given thrust input.
playerShip = {
position = {
x = 100,
y = 60
},
rotation = 0,
velocity = {
speed = 12.0,
direction = 0
},
@jbnunn
jbnunn / gist:3743541
Created September 18, 2012 14:50
Clean Install – Mountain Lion OS X 10.8 DP3
@jbnunn
jbnunn / process.py
Created October 18, 2019 16:24
Line detection in videos or images w/ Python and CV2
import os, sys
import cv2
import numpy as np
"""
Get source video, then:
1. Convert to grayscale
2. Gaussian blur
3. Detect edges
@jbnunn
jbnunn / seeder.py
Last active September 25, 2019 00:57
Dynamo DB Seeder
"""
This script populates a DynamoDB table with seed data. Add seeds into a JSON file, named the same as your table. Place the file in a `./seeds/` directory, e.g.,
/seeds/PetCategories.json.
The file should contain data that matches your database schema.
[
{
"petCategory": 1,
@jbnunn
jbnunn / gist:b935ef203d6e694d90405cc433bb06f8
Last active September 24, 2019 16:56
Rekognition Indexer
'''
A trigger function for AWS Lambda that listens for object creation in an S3 bucket,
takes images, finds faces, and tags with metadata into a DDB table.
'''
import boto3
from decimal import Decimal
import json
import urllib