Skip to content

Instantly share code, notes, and snippets.

@amolloy
amolloy / tsp_nano.sh
Last active April 11, 2022 17:08
Get The Spaghetti Detective up and running with CUDA support in OpenCV on Jetson Nano. Intended to be run first thing after completing the first boot login process. The main difference from this and the instructions found elsewhere is that it builds OpenCV from source instead of installing a .deb.
#!/bin/bash
sudo apt-get remove -y libopencv-dev libvisionworks-dev libvisionworks-samples libvisionworks-sfm-dev libvisionworks-tracking-dev
sudo apt-get update && sudo apt-get -y dist-upgrade
sudo apt-get install -y curl python-pip python3-pip libffi-dev python-openssl
sudo -H pip install -U jetson-stats
# Follow instructions from https://www.thespaghettidetective.com/blog/2020/04/19/jetson-nano-spaghetti-detective-guide/
# except use my fork.
wget https://github.com/nefilim/docker-compose-aarch64/releases/download/1.25.4/docker-compose-Linux-aarch64
@amolloy
amolloy / importworld.sh
Created March 19, 2019 22:58
Import an existing minecraft server world into a new docker container
#!/bin/bash
if [ ! -d "$1" ]; then
echo Unknown directory $1, aborting.
exit 1
fi
re='^[0-9]+$'
if ! [[ $2 =~ $re ]]; then
echo Second argument must be the port number. Abording.
@amolloy
amolloy / pico-8.app
Created March 10, 2019 15:22
Launcher info for adding PICO-8 to the Kano OS desktop. Place in /usr/share/applications/. Adjust path to PICO-8 and icon as necessary.
{
"title": "PICO-8",
"tagline": "PICO-8 Fantasy Computer",
"description": "PICO-8 is a fantasy console for making, sharing and playing tiny games and other computer programs. When you turn it on, the machine greets you with a commandline and simple built-in tools for creating your own cartridges and exploring the PICO-8 cartverse.",
"slug": "pico-8",
"icon": "/usr/local/pico-8/lexaloffle-pico8.png",
"colour": "#34495E",
"categories": ["code"],
@amolloy
amolloy / RenameShows.pl
Last active January 6, 2018 18:50
Use mp4 TV Show metadata to rename files in a Plex-friendly format
#!/usr/bin/perl -w
use strict;
use local::lib;
use File::Basename;
use File::Util qw(escape_filename);
use File::Path qw(make_path);
use File::Spec;
use Getopt::Long;
@amolloy
amolloy / gist:c6f0d577e8e8d1eaf0e3
Created June 7, 2014 14:36
Dealing with instancesOrderedBy: being missing in Swift
Model.inDatabaseSync() { (db) in
let rs = db.executeQuery("SELECT * FROM model ORDER BY foo”, withArgumentsInArray:[])
self.results = Model.instancesFromResultSet(rs)
}
@amolloy
amolloy / gist:592a7ae4eb8a8de4bf20
Last active August 29, 2015 14:02
NSString* theId = jsonDict[@“response”][@“id”];, in Swift
let info : Dictionary<String, AnyObject!> = ...
var theId : String?
let reponseObj = info["response"]
if let response = reponseObj as? Dictionary<String, AnyObject!>
{
let idObj = response["id"]
if let id = idObj as? String
{
theId = id
}
@amolloy
amolloy / ASMBlurredImageBackgroundView.h
Last active December 16, 2015 14:59
A quick'n dirty reproduction of the Yahoo! Weather animated blurred background image. Requires GPUImage and AHEasing. Note that this is mostly an experiment and has several rough edges! To use it, create an instance and set it as a UITableView's backgroundView. You also need to provide the UITableView to the ASMBlurredImageBackgroundView.
//
// ASMBlurredImageBackgroundView.h
// Created by Andy Molloy on 4/19/13.
//
//
#import <UIKit/UIKit.h>
@interface ASMBlurredImageBackgroundView : UIView
@property (nonatomic, assign) double constant;
@amolloy
amolloy / README.txt
Last active December 15, 2015 00:59 — forked from danielpunkass/README.txt
The enclosed config.xml file will instruct Jenkins to check out and build llvm + clang, archiving the resulting clang binary.
The configuration will build daily and will retain builds for 5 days.
To add it to your Jenkins install, just copy the config.xml file to e.g.:
jobs/Clang/config.xml
Then "reload configuration" in Jenkins, or stop and start Jenkins to reload it implicitly.
@amolloy
amolloy / gist:3977826
Created October 30, 2012 01:41
NSCalendar grumpy assert
-[__NSCFCalendar rangeOfUnit:inUnit:forDate:]: date cannot be nil
I mean really, what do you think that operation is supposed to mean with a nil date?
An exception has been avoided for now.
A few of these errors are going to be reported with this complaint, then further violations will simply silently do whatever random thing results from the nil.
Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
#!/usr/bin/env ruby -wKU
require 'nokogiri'
require 'time'
receipt_file = ARGV.shift || ''
if receipt_file.empty?
puts "please point me to your receipt file"
exit 1
end