Skip to content

Instantly share code, notes, and snippets.


Tony Hung tbass134

  • Upstate New York
View GitHub Profile
View connectToColab.js
function ConnectButton(){
console.log("Connect pushed");
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click()
choongng /
Last active Dec 29, 2019
Swift for TensorFlow quick start with Docker on Mac

A good way to get a taste of Swift for Tensorflow language and tools is to set it up with Jupyter with the fastai Swift notebooks. I wanted a quick setup, which the Mac install experience currently not, so instead I installed the release binaries in a Ubuntu container via Docker. The setup process for this scenario is not well documented, so here it is for you / future me.

What we're about to do is install the S4TF 0.4 release and the fastai v3 Swift notebooks on Ubuntu 18.04. Generally we follow the swift-jupyter docker file, but install cpu-only release versions of the packages.

Below are some of the references I looked at:

Rationale for S4TF and background reading

Alex-Just /
Last active Oct 15, 2020
Python regex to strip emoji from a string
import re
RE_EMOJI = re.compile('[\U00010000-\U0010ffff]', flags=re.UNICODE)
def strip_emoji(text):
return RE_EMOJI.sub(r'', text)
'''This script goes along the blog post
"Building powerful image classification models using very little data"
It uses data that can be downloaded at:
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
View WatchConnectivitySingletonDemo.swift
// WatchSessionManager.swift
// WatchConnectivityDemo
// Created by Natasha Murashev on 9/3/15.
// Copyright © 2015 NatashaTheRobot. All rights reserved.
import WatchConnectivity
gillesdemey / querystring.swift
Last active Jun 20, 2020
Retrieve specific query string parameter from NSURL
View querystring.swift
func getQueryStringParameter(url: String, param: String) -> String? {
let url = NSURLComponents(string: url)!
(url.queryItems? as [NSURLQueryItem])
.filter({ (item) in == param }).first?

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

View ArrayHelpers.swift
extension Array {
func first() -> Element? {
if isEmpty {
return nil
return self[0]
func last() -> Element? {
santhoshtr / Logger.js
Last active Oct 17, 2018
Winston based configurable node logger
View Logger.js
var winston = require( 'winston' ),
fs = require( 'fs' ),
logDir = 'log', // Or read from a configuration
env = process.env.NODE_ENV || 'development',
winston.setLevels( winston.config.npm.levels );
winston.addColors( winston.config.npm.colors );
if ( !fs.existsSync( logDir ) ) {
stephenhardy / git-clearHistory
Created Apr 26, 2013
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin<YOUR ACCOUNT>/<YOUR REPOS>.git
You can’t perform that action at this time.