Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View christianramsey's full-sized avatar

Fanli (Christian) Ramsey christianramsey

View GitHub Profile
@christianramsey
christianramsey / TensorFlow GPU CUDA 10 Ubuntu 18.04
Last active May 15, 2020 14:55
Install TensorFlow GPU for Ubuntu 18.04 - the easy way
# Add NVIDIA package repository
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt install ./cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt update
# Install CUDA and tools. Include optional NCCL 2.x
sudo apt install cuda10.0 cuda-cublas-10-0 cuda-cufft-10-0 cuda-curand-10-0 \
import numpy as np
import tensorflow as tf
import tensorflow.contrib.layers as tflayers
x = tflayers.real_valued_column(np.linspace(0, 100, 101))
buckets = np.linspace(0, 100, 5).tolist()
x2 = tflayers.bucketized_column(x, buckets)
print(x2)
var toObservable = request => Rx.Observable.create(observer => {
var req = request.end((err, res) => {
if(err) {
observer.onError(err)
} else {
observer.onNext(res)
observer.onComplete()
}
})
return Rx.Disposable.create(() => {
@sebmarkbage
sebmarkbage / Enhance.js
Last active January 31, 2024 18:33
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
@staltz
staltz / introrx.md
Last active April 20, 2024 14:15
The introduction to Reactive Programming you've been missing
@chenghan
chenghan / gist:7456549
Last active February 5, 2022 20:17
Instructor code that was shown on screen
import sys
salesTotal = 0
oldKey = None
for line in sys.stdin:
data = line.strip().split("\t")
if len(data) != 2:
# Something has gone wrong. Skip this line.
continue