Skip to content

Instantly share code, notes, and snippets.

@Mistobaan
Mistobaan / facets_colab.py
Last active May 2, 2020 07:20 — forked from creotiv/facets_colab.py
Colab snippets
import shutil
if os.path.exists('./facets'):
shutil.rmtree("./facets")
!git clone https://github.com/PAIR-code/facets
!jupyter nbextension install facets/facets-dist/
import sys
import os
sys.path.append(os.path.abspath('./facets/facets_overview/python/'))
@Mistobaan
Mistobaan / build.sh
Created May 2, 2020 04:38 — forked from stefanondisponibile/build.sh
Build TensorFlow Serving with Sentencepiece custom ops.
#!/bin/bash
CWD=$(pwd)
GPROTOBUF_URL=https://github.com/protocolbuffers/protobuf/releases/download/v3.7.0/protobuf-cpp-3.7.0.tar.gz
compile_gprotobuf () {
sudo apt-get install autoconf automake libtool curl make g++ unzip &&
wget $GPROTOBUF_URL &&
fname=protobuf-cpp-3.7.0.tar.gz &&
tar xvzf $fname && rm $fname &&
@Mistobaan
Mistobaan / release.sh
Created September 27, 2017 19:15 — forked from bclinkinbeard/release.sh
Bash script to automate the Git Flow tag/release process
#!/bin/bash
# current Git branch
branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
# v1.0.0, v1.5.2, etc.
versionLabel=v$1
# establish branch and tag name variables
devBranch=develop
@Mistobaan
Mistobaan / intra_parallelism.py
Last active November 16, 2016 06:03 — forked from yaroslavvb/gist:b73ff35424dd7ab762234620cf583aac
Example of restricting part of graph to run on single core
# try running cpu intensive test on two devices
import tensorflow as tf
import time
def matmul_op():
"""Multiply two matrices together"""
n = 2000
a = tf.ones((n, n), dtype=tf.float32)
# Example from http://jakevdp.github.io/blog/2013/06/01/ipython-notebook-javascript-python-communication/ adapted for IPython 2.0
# Add an input form similar to what we saw above
from IPython.display import HTML
from math import pi, sin
input_form = """
<div style="background-color:gainsboro; border:solid black; width:600px; padding:20px;">
Code: <input type="text" id="code_input" size="50" height="2" value="sin(pi / 2)"><br>
Result: <input type="text" id="result_output" size="50" value="1.0"><br>
@Mistobaan
Mistobaan / ipy_repl.py
Created May 15, 2016 23:00 — forked from MattDMo/ipy_repl.py
SublimeREPL ipy_repl.py for running IPython 4/Jupyter in Sublime Text
import os
import sys
import json
import socket
import threading
activate_this = os.environ.get("SUBLIMEREPL_ACTIVATE_THIS", None)
# turn off pager
os.environ['TERM'] = 'emacs'
@Mistobaan
Mistobaan / install-tensorflow.sh
Last active January 1, 2016 02:24 — forked from erikbern/install-tensorflow.sh
Installing TensorFlow on EC2
# Note – this is not a bash script (some of the steps require reboot)
# I named it .sh just so Github does correct syntax highlighting.
#
# This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5
#
# The CUDA part is mostly based on this excellent blog post:
# http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/
# Install various packages
sudo apt-get update
@Mistobaan
Mistobaan / min-char-rnn.py
Created December 30, 2015 00:26 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@Mistobaan
Mistobaan / ReCodeSign.md
Last active October 23, 2015 03:23 — forked from 0xc010d/ReCodeSign
Codesign an iOS app, with a different distribution certificate and mobileprovisioning file.
  • Copy the delivered ipa into a directory to work in.

  • export PlistBuddy="/usr/libexec/PlistBuddy" to get the PlistBuddy tool to your shell. If it is not added, all references to PlistBuddy will need to be written as the full path.

  • Take the delivered App.ipa and unzip it using the unzip command. This should produce a Payload directory containing the app and its resources.

  • Enter the command "codesign -d --entitlements :enterprise.plist Payload/PathToApp.app/" This pulls the entitlements out of the app, and prints them to a plist, without a leading "blob" of data. Pay particular attention to the colon before the enterprise.plist file name.

@Mistobaan
Mistobaan / FBAnimationPerformanceTracker.h
Last active September 14, 2015 21:36 — forked from clementgenzmer/FBAnimationPerformanceTracker.h
FBAnimationPerformanceTracker
/*
* This is an example provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN