Skip to content

Instantly share code, notes, and snippets.

@kindlychung
kindlychung / tensorflow_gpu_gce_ubuntu_zesty.sh
Last active October 30, 2017 14:54 — forked from jedisct1/tensorflow_gpu_gce_ubuntu_zesty.sh
Tensorflow 1.1 with CUDA 8.0 for GCE on Ubuntu 17.04
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
cd /tmp # the next part is specific to your setup
# Get it here: https://developer.nvidia.com/cudnn
gsutil cp gs://tn-devel-ds/ubuntu/libcudnn5* .
ls libcudnn*.deb | sort | xargs sudo dpkg -i
sudo apt update
sudo apt install libopenblas-dev liblapack-dev python3-pip python3-pandas python3-venv python3-werkzeug
@kindlychung
kindlychung / build_lmms.sh
Created October 25, 2017 14:02 — forked from anonymous/build_lmms.sh
How to build lmms on ubuntu 17.10
git clone https://github.com/LMMS/lmms
cd lmms/
git checkout master
mkdir build target
cd build
sudo apt install libasound2-dev
sudo apt install libsndio-dev
sudo apt install libsndio-dev
sudo apt-get install libfftw3-dev
sudo apt-get install libfltk1.3-dev

Using Swift Package Manager with iOS

Step 1:

File > New > Project...

Step 2:

Create a Package.swift file in your root project directory, add dependencies, then run swift package fetch on the command line in the same directory. We’re not going to run swift build because it will just complain.

(function() {
var debug = false;
var root = this;
var EXIF = function(obj) {
if (obj instanceof EXIF) return obj;
if (!(this instanceof EXIF)) return new EXIF(obj);
this.EXIFwrapped = obj;
case class User(name: String, age: Int)
object User {
implicit val userPrinter: InfoPrinter[User] = new InfoPrinter[User] {
override def toInfo(value: User) = s"[User] name: ${value.name}, age: ${value.age}"
}
}
val userInfo = implicitly[InfoPrinter[User]].toInfo(User("Xiaohong", 24))
println(userInfo)
pub struct List<T> {
head: Link<T>,
}
type Link<T> = Option<Box<Node<T>>>;
struct Node<T> {
elem: T,
next: Link<T>,
}
@kindlychung
kindlychung / err
Last active September 21, 2016 18:59
warning: variable does not need to be mutable, #[warn(unused_mut)] on by default
--> src/eight_queens.rs:43:6
|
43 | let mut start: usize;
| ^^^^^^^^^
Finished debug [unoptimized + debuginfo] target(s) in 0.38 secs
use point::Point;
type PairDistance = (Point, Point, f64);
pub fn closest_pair(points: &mut Vec<Point>) -> PairDistance {
fn helper(points: &[Point]) -> PairDistance {
#[cfg(feature = "verbose")]
{
println!("{:?}", points);
use point::Point;
type PairDistance = (Point, Point, f64);
fn helper(points: &[Point]) -> PairDistance {
assert!(points.len() >= 2);
match points.len() {
2 => (points[0], points[1], points[0].distance(&points[1])),
3 => {
let p0 = points[0];
// Give the combination of these traits a name!
trait ZMod: Modulo<Output = Self> + Mul<Output = Self> + Sub<Output = Self> + Add<Output = Self> + Rem<Output = Self> + Copy {}
impl<T> ZMod for T
where T: Modulo<Output = T> + Mul<Output = T> + Sub<Output = T> + Add<Output = T> + Rem<Output = T> + Copy
{}