Skip to content

Instantly share code, notes, and snippets.

View Atlas7's full-sized avatar

Johnny Chan Atlas7

View GitHub Profile
@sengertwd
sengertwd / provision.sh
Created January 29, 2014 07:04
This is my vagrant provision bash script
echo "This is our provisioning script"
apt-get update
apt-get install -y python-software-properties python g++ make
add-apt-repository ppa:chris-lea/node.js
apt-get update
apt-get install -y nodejs
npm install -g grunt-cli
@kolodny
kolodny / actions.js
Last active May 17, 2018 18:42
testing redux thunk middleware
export const doTheThing = () => (dispatch, getState) => {
const users = getState();
dispatch({
type: 'THE_THING',
users,
});
};
@vgaidarji
vgaidarji / theme-son-of-obsidian.css
Created February 12, 2017 18:00
Son of Obsidian rouge theme
pre.highlight,
.highlight pre { background-color: #272822; }
.highlight .hll { background-color: #22282A }
.highlight .c { color: #99AA8A } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #93C763 } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #F1F2F3 } /* Name */
.highlight .o { color: #E8E2B7 } /* Operator */
.highlight .p { color: #F1F2F3 } /* Punctuation */
@mrcasals
mrcasals / gist:2788529
Created May 25, 2012 14:50
Rails: Reinstall postgreSQL via brew ang pg gem on Mac OS X
$ brew uninstall postgresql
$ gem uninstall pg # ALL OF THEM
$ rm -fr /usr/local/var/postgres
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
$ pg_ctl -D /usr/local/var/postgres stop -s -m fast # WE SHOULD HAVE ALL postgres SERVERS & PROCESSES STOPPED BY NOW
$ brew install postgres
$ env ARCHFLAGS="-arch x86_64" gem install pg
$ echo "DONE." >> /dev/null

TensorFlow Serving in 10 minutes!

TensorFlow SERVING is Googles' recommended way to deploy TensorFlow models. Without proper computer engineering background, it can be quite intimidating, even for people who feel comfortable with TensorFlow itself. Few things that I've found particularly hard were:

  • Tutorial examples have C++ code (which I don't know)
  • Tutorials have Kubernetes, gRPG, Bezel (some of which I saw for the first time)
  • It needs to be compiled. That process takes forever!

After all, it worked just fine. Here I present an easiest possible way to deploy your models with TensorFlow Serving. You will have your self-built model running inside TF-Serving by the end of this tutorial. It will be scalable, and you will be able to query it via REST.

@jychstar
jychstar / tensorboard_beginner.py
Created June 5, 2017 00:06
simple example to show how to use `tf.summary` to record image, scalar, histogram and graph for display in tensorboard
import argparse
import sys
from tensorflow.examples.tutorials.mnist import input_data
from time import time
t0 = time()
import tensorflow as tf
tf.summary.FileWriterCache.clear()
/* Based on Sublime Text's Monokai theme */
.cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;}
.cm-s-monokai div.CodeMirror-selected {background: #49483E !important;}
.cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;}
.cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;}
.cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;}
.cm-s-monokai span.cm-comment {color: #75715e;}
.cm-s-monokai span.cm-atom {color: #ae81ff;}
@olivierlacan
olivierlacan / launch_sublime_from_terminal.markdown
Created September 5, 2011 15:50
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

@hmldd
hmldd / scroll.py
Last active October 6, 2023 14:59
Example of Elasticsearch scrolling using Python client
# coding:utf-8
from elasticsearch import Elasticsearch
import json
# Define config
host = "127.0.0.1"
port = 9200
timeout = 1000
index = "index"
@hugobowne
hugobowne / tweet_listener.py
Last active October 6, 2023 18:48
NOTE: this code is for a previous version of the Twitter API and I will not be updating in the near future. If someone else would like to, I'd welcome that! Feel free to ping me. END NOTE. Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100…
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1