Skip to content

Instantly share code, notes, and snippets.

View carbocation's full-sized avatar

James Pirruccello carbocation

View GitHub Profile
@carbocation
carbocation / multi-face.ipynb
Created January 3, 2020 17:13 — forked from yang-zhang/multi-face.ipynb
Multi-task Deep Learning Experiment using fastai Pytorch
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@carbocation
carbocation / Fast.ai install script.py
Last active September 27, 2018 05:02 — forked from gilrosenthal/Fast.ai install script
Fast.ai Install on Google Colab
!pip install pathlib
!pip install fastai
!apt-get -qq install -y libsm6 libxext6 && pip install -q -U opencv-python
import cv2
from os import path
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag())
accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu'
@carbocation
carbocation / Subtitle.go
Created July 13, 2018 14:35 — forked from bemasher/Subtitle.go
Subtitle decoder basic functionality written in Golang.
package main
import (
"io"
"os"
"fmt"
"log"
"bytes"
"image"
"image/png"
@carbocation
carbocation / loghistplot.R
Last active February 14, 2018 02:22 — forked from sckott/loghistplot.R
Plot logistic regression with bar plots for distribution of 0 and 1 values on top and bottom x-axes.
# Define the function
loghistplot <- function(data) {
require(ggplot2); require(gridExtra) # load packages
names(data) <- c('x','y') # rename columns
# get min and max axis values
min_x <- min(data$x)
max_x <- max(data$x)
@carbocation
carbocation / gist:17af347fd38bb302dafc21f77832e4b5
Last active October 22, 2017 16:50 — forked from bigsnarfdude/gist:95c19664f5f8aa5b8b403308c5d42b23
training tensorflow and saving my MNIST model
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
#import data
mnist = input_data.read_data_sets("data/", one_hot=True)
sess = tf.InteractiveSession()
# Create the model
x = tf.placeholder(tf.float32, [None, 784])
@carbocation
carbocation / upgrade-postgres-9.5-to-9.6.md
Last active May 30, 2017 00:36 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04

TL;DR: This script upgrades postgres 9.5 to 9.6 on a server that uses a custom data directory.

sudo echo 'deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main' > /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
  sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6
@carbocation
carbocation / tumblr-gist.js
Created May 5, 2017 19:54 — forked from slezica/tumblr-gist.js
tumblr gist embedder
var real_docwrite = document.write,
body = $('body');
(function insertGists(a_tags) {
if (a_tags.length > 0) {
a_tag = a_tags.shift()
document.write = function(stylesheet) {
$('head').append(stylesheet);
@carbocation
carbocation / Router.swift
Last active September 16, 2015 00:01
Uploading a file with SWIFT via POST multipart/form-data (PHP)
import Foundation
import Alamofire
public enum Router:URLRequestConvertible {
public static let baseUrlString:String = "http://testapi.example.com"
case Upload(fieldName: String, fileName: String, mimeType: String, fileContents: NSData, boundaryConstant:String);
var method: Alamofire.Method {
switch self {
case Upload: