Skip to content

Instantly share code, notes, and snippets.

View matthew-brett's full-sized avatar

Matthew Brett matthew-brett

View GitHub Profile
""" Recipe for nbconvert using library
Sets custom output directory, and output prefix.
"""
import nbformat
from traitlets.config import Config
from nbconvert import MarkdownExporter
from nbconvert.writers import FilesWriter
nb = nbformat.read('data_frame_intro.ipynb', 4)
.ipynb_checkpoints/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
""" Example to test SQL query
"""
import numpy as np
import pandas as pd
data = pd.DataFrame()
things = np.repeat(['One', 'Two', 'Three'], [100, 10, 1])
np.random.shuffle(things)
data['things'] = things
other_things = np.repeat(['this', 'that'], [70, 41])
things other_things
0 One this
1 One this
2 One this
3 One this
4 One this
5 One this
6 One this
7 One this
8 One this
/* Below I load a table prepared by "make_thingies.py".
It has a column "things" that have 100 instances of "one", 10 instances of
"two" and one instance of "three".
*/
use things;
DROP TABLE IF EXISTS `thingies`;
CREATE TABLE thingies (
id INT,
things VARCHAR(255) NOT NULL,
/* Inspired by
https://www.mysqltutorial.org/mysql-subquery/
*/
DROP TABLE IF EXISTS stids;
CREATE TABLE stids SELECT steamid FROM (
SELECT DISTINCT steamid FROM Games_1) AS stids
WHERE rand() < 0.1;
SELECT steamid, appid, playtime_forever FROM Games_1
WHERE steamid in (SELECT steamid FROM stids)
""" Utilities for using CoCalc via the API
Refs:
* https://doc.cocalc.com/api/index.html
* https://doc.cocalc.com/api/query.html
* https://share.cocalc.com/share/65f06a34-6690-407d-b95c-f51bbd5ee810/Public/README.md
* https://github.com/sagemathinc/cocalc/blob/master/src/smc-util/db-schema/db-schema.ts
"""

Getting Travis-CI docker image for builds

Covered in this SO post.

As of December 31st 2019:

  • Inspect Worker section of build log for line of form:

instance: travis-job-e823b3ef-f193-4b66-a4b2-bf847bc386ee travis-ci-sardonyx-xenial-1553530528-f909ac5 (via amqp)