Skip to content

Instantly share code, notes, and snippets.

@jart
jart / npm.bashrc.sh
Last active October 11, 2016 19:38
NPM Transitive Deps Calculator
# NPM Dependency Calculator
#
# Author: Justine Tunney <jart@google.com>
# Copyright 2016 Google Inc. All Rights Reserved.
# Licensed under the Apache 2.0 license
# Last Updated on 2016-09-22
#
# This is a .bashrc addition that lets you inspect the transitive closure of
# dependencies for an NPM package. It does not require NPM or node.js to be
# installed on your system. It takes into consideration the fact that NPM
@jart
jart / BUILD
Created October 17, 2016 20:50
SWIG Bazel BUILD
licenses(["restricted"]) # GPLv3
exports_files(["LICENSE"])
cc_binary(
name = "swig",
srcs = [
"Source/CParse/cparse.h",
"Source/CParse/cscanner.c",
"Source/CParse/parser.c",
@jart
jart / fastio.py
Created October 23, 2016 06:44
Multithreaded Python os.walk
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@jart
jart / nasm.BUILD.py
Last active November 12, 2016 00:47
NASM build file
# http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/nasm-2.12.02.tar.bz2
licenses(["notice"]) # As of v2.07, nasm is licensed under the 2-clause BSD license.
cc_binary(
name = "nasm",
srcs = [
"assemble.c",
"crc64.c",
"directiv.c",
@jart
jart / java_import_external.bzl
Last active January 16, 2017 21:56
Bazel Java External Library Rule
# Copyright 2016 The Closure Rules Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@jart
jart / bazel-maven-repo-name.js
Last active January 16, 2017 21:36
Bazel Maven Repository Naming Algorithm
/**
* @fileoverview Bazel external repository naming algorithm for Maven.
*/
var CLEANSE_CHARS_ = new RegExp('[^_0-9A-Za-z]', 'g');
/**
* Turns Maven group and artifact into Bazel repository name.
*
* <p>This algorithm works by turning illegal characters into underscores and
@jart
jart / .bashrc.npm.sh
Last active December 6, 2020 10:55
NPM Dependency Calculator
# NPM Dependency Calculator
#
# Author: Justine Tunney <jart@google.com>
# Last Updated: 2016-09-22
#
# This is a .bashrc addition that lets you inspect the transitive closure of
# dependencies for an NPM package. It does not require NPM or node.js to be
# installed on your system. It takes into consideration the fact that NPM
# does not resolve diamond dependencies. It goes super fast.
#
@jart
jart / .bashrc
Last active October 6, 2017 00:08
TensorBoard Profiling Script
# pip install yappi
# tensorboard-profile-wall-time --logdir=/google/data/ro/users/ja/jart/tensorboard/userlogdirs/1
tensorboard-profile-wall-time() {
-tensorboard-profile wall "$@"
}
tensorboard-profile-cpu-time() {
-tensorboard-profile cpu "$@"
}
@jart
jart / .screenrc
Last active April 15, 2018 08:23
Justine's GNU Screen Configuration
# -*- conf -*-
## GNU Screen Configuration
## Justine Tunney <jart@google.com>
# GNU Screen + this config allow you to:
#
# - Have tabs inside your terminal.
#
# - Have your terminal sessions persist, even if you close your ssh connection.
# This is especially great if you hop between multiple computers or simply
@jart
jart / BUILD
Last active October 14, 2017 02:13
TensorFlow C++ PNG to JPG converter static binary
load("//tensorflow:tensorflow.bzl", "tf_cc_binary")
tf_cc_binary(
name = "png2jpg",
srcs = ["png2jpg.cc"],
linkstatic = 1,
deps = [
"//tensorflow/cc:cc_ops",
"//tensorflow/cc:client_session",
"//tensorflow/cc:scope",