Skip to content

Instantly share code, notes, and snippets.

Travis Kaufman traviskaufman

Block or report user

Report or block traviskaufman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fc7627756370-6.py
# ipython-utils/researchenv/__init__.py
# imports...
from researchenv.magics import ResearchEnvMagics
from google.cloud import bigquery
def load_ipython_extension(ipython: InteractiveShell):
# previous logic...
bq = bigquery.Client(project='example-project-id')
ipython.register_magics(ResearchEnvMagics(shell=ipython, bq=bq))
View fc7627756370-5.py
# ipython-utils/researchenv/magics.py
from IPython.core.magic import Magics, magics_class, cell_magic, needs_local_scope
from IPython.core.magic_arguments import magic_arguments, argument, parse_argstring
from IPython.core.interactiveshell import InteractiveShell
from IPython.core.display import display
from google.cloud import bigquery
@magics_class
class ResearchEnvMagics(Magics):
View fc7627756370-4.sql
%%bq --name hn_daily_comment_counts
SELECT
TIMESTAMP_TRUNC(time_ts, DAY) as day,
COUNT(0) as comment_count
FROM
`bigquery-public-data.hacker_news.comments`
GROUP BY
day
ORDER BY
day ASC;
View fc7627756370-3.py
# ipython-utils/setup.py
setup(
name='ipython-utils',
packages=find_packages(),
install_requires=[
'ipython >= 4',
'notebook >= 4.3.1',
'jupyter',
'numpy',
'pandas',
View fc7627756370-2.py
# ipython-utils/researchenv/__init__.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.core.interactiveshell import InteractiveShell
def load_ipython_extension(ipython: InteractiveShell):
print('%matplotlib inline')
View fc7627756370-1.py
%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
View mdc-web-closure-compatibility.md

https://github.com/material-components/material-components-web/issues/134

Closure Compiler Support

Google Closure Compiler support is required in order to support the Google projects and properties which are built around this toolchain. Concretely, MDC-Web must be able to compile with ADVANCED_OPTIMIZATIONS enabled, and produce no errors or warnings. There are implications for internal support as well, but that is outside the scope of this issue.

Goals

  • Full compilation of MDC-Web using ADVANCED_OPTIMIZATIONS
  • Test infrastructure to verify both compilation, as well as runtime correctness, e.g. our closurized code behaves correctly
View mdc-web-tape2mocha.js
/**
* @fileoverview one-off script to transform MDC-Web's tests from tape to mocha.
* See https://github.com/material-components/material-components-web/issues/143
*/
const fs = require('fs');
const path = require('path');
const babylon = require('babylon');
const glob = require('glob');
@traviskaufman
traviskaufman / MLPMnistSingleLayerExample.scala
Created Oct 25, 2016
dl4j's MLPMnistSingleLayerExample in Scala
View MLPMnistSingleLayerExample.scala
/**
* @see https://github.com/deeplearning4j/dl4j-examples/blob/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/feedforward/mnist/MLPMnistSingleLayerExample.java
*/
import scala.collection.JavaConversions._
import org.deeplearning4j.datasets.iterator.impl.MnistDataSetIterator
import org.deeplearning4j.eval.Evaluation
import org.deeplearning4j.nn.api.OptimizationAlgorithm
import org.deeplearning4j.nn.conf.NeuralNetConfiguration
@traviskaufman
traviskaufman / tips-for-coming-to-rust-from-javascript.md
Last active Sep 12, 2016
Tips for Coming to Rust from Javascript (WIP)
View tips-for-coming-to-rust-from-javascript.md

The following are tips I put together which I would have found helpful after coming to rust from Javascript.

NOTE: If you've never used a statically-typed programming language before, I highly recommend checking out Liz Baille's illustrated survival guide presentation from RustConf 2016.

I've been using Javascript both personally and professionally as my primary language. In many cases, even exclusively. However, I actually got my start in systems programming, writing really bad C code for MaxMSP, and it therefore has a special place in my heart.

Rust is like C, but way better. The rust team has essentially taken the complexity of designing a high-level language runtime and pushed it down the compiler. This is insanely impressive, and produces ridiculously incredible results. This is systems programming language with things like traits, generics, very intelligent type inference,

You can’t perform that action at this time.