Skip to content

Instantly share code, notes, and snippets.

View alexdong's full-sized avatar

Alex Dong alexdong

View GitHub Profile
@alexdong
alexdong / EmbeddingVectorSearchEngine.swift
Last active July 18, 2023 22:40
Measure the performance of loading 10,000 Embeddings with 1024 Float32 from a binary data file
import Accelerate
import Dispatch
import Foundation
import os
let logger = Logger(subsystem: "photos.keepers", category: "EmbeddingVectorSearchEngine")
typealias Embedding = [Float32]
typealias Distance = Float32
@alexdong
alexdong / torchvision_datasets_overview.md
Last active December 27, 2021 18:31
torchvision datasets

Quick summary of all the datasets contained in torchvision.

  • Caltech101: Pictures of objects belonging to 101 categories. About 40 to 800 images per category. Most categories have about 50 images. Collected in September 2003 by Fei-Fei Li, Marco Andreetto, and Marc 'Aurelio Ranzato. The size of each image is roughly 300 x 200 pixels. We have carefully clicked outlines of each object in these pictures, these are included under the 'Annotations.tar'. There is also a matlab script to view the annotaitons, 'show_annotations.m'.
  • Caltech256: Collection of all 30607 images: 256_ObjectCategories.tar
  • CelebA: CelebFaces Attributes Dataset (CelebA) is a large-scale face attributes dataset with more than 200K celebrity images, each with 40 attribute annotations. The images in this dataset cover large pose variations and background clutter. CelebA has large diversities, large quantities, and rich annotations. The dataset can be employed as the training and test sets for the following computer vision tasks: face
@alexdong
alexdong / VNClassifyImageRequest.supportedIdentifiers
Last active September 27, 2021 23:28 — forked from geor-kasapidi/classes.txt
VNClassifyImageRequest.knownClassifications(forRevision: VNClassifyImageRequestRevision1)
abacus
accordion
acorn
acrobat
adult
adult_cat
agriculture
aircraft
airplane
airport
Verifying that +alexdong is my Bitcoin username. You can send me #bitcoin here: https://onename.io/alexdong
@alexdong
alexdong / FLG360 to choir.io.js
Last active August 29, 2015 14:03
Takes a new lead webhook from FLG 360 and create a new event in choir.io
/*
To use this script, replace the {{YOUR_TORPIO_KEY}} with your torpio.io API key
and replace {{{{YOUR_CHOIR_IO_KEY}} with your choir.io key when you create an API source.
*/
var settings = {};
@alexdong
alexdong / color_picker.js
Created May 25, 2014 23:28
This implements a stateful function in javascript using closure. The same construct requires either a singleton class or a static variable in other languages.
var pick_color = (function(str) {
// We use a circular buffer here to allocate the colors. `label_color_map`
// is a hash with key as `str` and value is the index into the `colors`
// list. The following 'static' variables keep the state within the function.
var label_color_map = {},
current_color_idx = 0,
colors = ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99',
'#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'];
return function(str) {
@alexdong
alexdong / pre-commit
Last active August 29, 2015 14:01
jshint pre-commit hook
#!/bin/sh
files=$(git diff --cached --name-only --diff-filter=ACM | grep ".js$")
if [ "$files" = "" ]; then
exit 0
fi
pass=true
for file in ${files}; do
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
#!/bin/sh
echo "Decompile into smali format ..."
apktool b ${1} /tmp/${1}-pack.apk
echo "\n\nSign the package. Password is mykey ..."
jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore mykey.keystore /tmp/${1}-pack.apk mykey
echo "\n\nZip align the apk ..."
zipalign -f -v 4 /tmp/${1}-pack.apk /tmp/${1}.apk
@alexdong
alexdong / threadpool.py
Created July 20, 2013 00:58
Guess a random number using a home-made ThreadPool.
import random
import threading
class ThreadPool(object):
def __init__(self, pool_size):
self.pool_size = pool_size
self.threads = []
def wait_for_thread(self):