Skip to content

Instantly share code, notes, and snippets.

View tnwei's full-sized avatar

tnwei

  • PETRONAS Research
View GitHub Profile
@tnwei
tnwei / findFirstCodeCell.js
Created January 19, 2020 16:07
Finding first code cell in a Jupyter notebook with Javascript
window.findFirstCodeCell = function findFirstCodeCell() {
var cells = Jupyter.notebook.get_cells();
for (var i = 0; i < cells.length; i++) {
if (cells[i]["cell_type"] == "code" ){
return i;
}
}
}
@tnwei
tnwei / Recreating World Health Chart by Gapminder
Created October 17, 2020 09:15
Recreates the World Health Chart visualization by Gapminder in Python, written as part of Week 4 of Exposure to Code.
"""
# Recreating World Health Chart by Gapminder
Wrote this as part of week 4's course contents for Exposure to Code.
Chart in question: https://www.gapminder.org/fw/world-health-chart/
## Before running this script
Obtain data required from https://www.gapminder.org/data/:
+ Select "Income" and download CSV, should have file name income_per_person_gdppercapita_ppp_inflation_adjusted.csv
+ Select "Life expectancy" and download CSV, should have file name "life_expectancy_years.csv"
@tnwei
tnwei / jb-serve.py
Created September 3, 2021 15:19
Live reload script for Jupyter Book
import subprocess
from pathlib import Path
import os
import click
from livereload import Server
@click.command()
@click.argument("pathsource", default=".", type=Path)
@click.option("-o", "--outputdir", default="_build/html", type=Path, show_default=True)
@tnwei
tnwei / citf-schema-changes.txt
Last active July 11, 2022 13:46
Changes in data schema for Malaysia COVID19 vaccination statistics (https://github.com/CITF-Malaysia/citf-public)
Data schema changes in CITF repo
================================
Format is <+ or -><filename>: <columnname>.
'+' means added column, '-' means removed column.
Data source: https://github.com/CITF-Malaysia/citf-public
Generated with: https://github.com/tnwei/msia-covid-api/blob/master/generate-data-schema-changelog.py
Changes in commit 9739fc on (2021-07-01 10:17:21+08:00)
-------------------------------------------------------
@tnwei
tnwei / moh-schema-changes.txt
Last active July 11, 2022 13:45
Changes in data schema for Malaysia COVID19 case statistics (https://github.com/MoH-Malaysia/covid19-public/)
Data schema changes in MOH repo
===============================
Format is <+ or -><filename>: <columnname>.
'+' means added column, '-' means removed column.
Data source: https://github.com/MoH-Malaysia/covid19-public
Generated with: https://github.com/tnwei/msia-covid-api/blob/master/generate-data-schema-changelog.py
Changes in commit 6fbffa on (2021-07-21 12:29:42+08:00)
-------------------------------------------------------
@tnwei
tnwei / tracking-model-repo-demo-status-public.md
Last active September 28, 2021 13:41
Tracking model repo and demo status for malay-huggingface

Background

goal is to get a better understanding of how knowledge neurons develop through training. The motivating theory here is that by combining methods in an interactive tool, we can better understand specific circuits, or at least prune the search space of things to try. But there are a lot of ways to combine the methods, so I think another effective use of effort is to experiment with radically different interfaces.

Methods used

TODO: Brief explanation

@tnwei
tnwei / api-docs.md
Created March 8, 2022 13:55
MetMalaysia API docs - accessed Jan 2, 2022 Sun

Mirrored from https://api.met.gov.my/dashboard/docs, accessed Jan 2, 2022 Sun

Getting Started

Malaysian Meteorological Department API is a web service which provides methods for accesing specific resources at canonical URL. We do not support any specific programming language or tools and we expect users already have the necessary understanding of the underlying technology, namely HTTP and JSON. All examples given in this documentation will assume a working knowledge of HTTP and JSON.

Base URL

https://api.met.gov.my/v2.1/