Skip to content

Instantly share code, notes, and snippets.

View rgbkrk's full-sized avatar
🌎
Think globally, act locally

Kyle Kelley rgbkrk

🌎
Think globally, act locally
View GitHub Profile
@rgbkrk
rgbkrk / notebook-require-usage.md
Last active June 1, 2017 07:49
What are notebooks requiring?

nteract doesn't support requirejs because we have the builtin require at our fingertips. Jupyter notebook however has long operated under the assumption that you can use the builtin requirejs for loading modules asynchronously:

require(['d3'], function(d3) {...

I started exploring the idea of providing some of these modules in a "quirks" sort of mode where we provide limited access to "requirejs" while still sandboxed. To find out what modules were commonly required, I turned to Google BigQuery, the GitHub dataset, and a User Defined Function (UDF) written in JavaScript.

I'll flesh out this gist or a blog post later. For now, I'll just provide my query code:

@rgbkrk
rgbkrk / big_query_examples.md
Created May 25, 2017 18:45 — forked from arfon/big_query_examples.md
BigQuery Examples for blog post

How many times shouldn't it happen...

-- https://news.ycombinator.com/item?id=11396045

SELECT count(*)
FROM (SELECT id, repo_name, path
        FROM [bigquery-public-data:github_repos.sample_files]
 ) AS F
@rgbkrk
rgbkrk / random_image.py
Last active May 24, 2017 18:58
Query giphy for random images
import IPython.display
import requests
def random_image_url(tags=None):
query = ""
if tags is not None:
query = "&tag=" + "+".join(tags)
api_url = "http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC" + query
resp = requests.get(api_url)
@rgbkrk
rgbkrk / javascript-proposal.ipynb
Last active July 27, 2017 03:42
Proposing some javascript bits
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rgbkrk
rgbkrk / table-with-schema.ipynb
Last active September 7, 2017 06:40
Using the new table schema with Pandas
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rgbkrk
rgbkrk / dabblet.css
Created January 12, 2017 01:32 — forked from LeaVerou/dabblet.css
The cicada principle in animations
/**
* The cicada principle in animations
* Remember the cicada principle that used prime numbers to make multiple overlaid repeated backgrounds seem more random?
* There’s no reason it can’t be applied to repeating linear animations too (using primes for the durations, divided by 10)
*/
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes radius { 50% { border-radius: 50%; } }
@keyframes color { 33% { color: rebeccapurple; } 66% { color: deeppink } }
@keyframes width { 50% { border-width: .3em; } }
@rgbkrk
rgbkrk / dabblet.css
Last active January 3, 2017 18:43 — forked from csssecrets/dabblet.css
Pseudorandom stripes
/**
* Pseudorandom stripes
*/
background: #D5D5D5;
background-image:
linear-gradient(89deg, #EEE 23px, transparent 0),
linear-gradient(97deg, #DDD 17px, transparent 0),
linear-gradient(101deg, #D0D0D0 23px, transparent 0);
background-size: 83px 100%, 61px 100%, 41px 100%;
@rgbkrk
rgbkrk / flights.R
Last active December 2, 2016 01:26
sparklyr
> flights_tbl
Source: query [3.368e+05 x 19]
Database: spark connection master=yarn-client app=sparklyr local=FALSE
year month day dep_time sched_dep_time dep_delay arr_time sched_arr_time
<int> <int> <int> <int> <int> <dbl> <int> <int>
1 2013 1 1 517 515 2 830 819
2 2013 1 1 533 529 4 850 830
3 2013 1 1 542 540 2 923 850
4 2013 1 1 544 545 -1 1004 1022
@rgbkrk
rgbkrk / kernel.json
Created November 26, 2016 00:17
Spark kernel
{
"display_name": "Python 2 (PySpark 1.6.1)",
"argv": [
"/usr/bin/python2",
"-m",
"ipykernel",
"-f",
"{connection_file}",
"--IPKernelApp.file_to_run=/path/to/spark_home/python/pyspark/shell.py"
],
@rgbkrk
rgbkrk / interpreter.sh
Created November 23, 2016 22:06
nteract-foundations
>>> import pandas as pd
>>> pd.read_csv("./gboeing/urban-data-science/07-Intro-to-Pandas/data/countries.csv").head()
country google_country_code country_group name_en name_fr name_de \
0 at AT eu Austria Autriche Österreich
1 be BE eu Belgium Belgique Belgien
2 bg BG eu Bulgaria Bulgarie Bulgarien
3 hr HR non-eu Croatia Croatie Kroatien
4 cy CY eu Cyprus Chypre Zypern
latitude longitude