Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# check color support
colors=$(tput colors)
if (($colors >= 8)); then
red='\033[0;31m'
nocolor='\033[00m'
else
red=
nocolor=
@christinakim
christinakim / getArticleText
Created April 2, 2020 04:34 — forked from shariq/getArticleText.js
getArticleText.js
function getArticleText() {
function textNodesUnder(node){
var all = [];
for (node=node.firstChild;node;node=node.nextSibling){
if (node.nodeType==3) all.push(node);
else all = all.concat(textNodesUnder(node));
}
return all;
}
let textNodes = textNodesUnder(document);
.DS_store
### Jekyll ###
_site/
.sass-cache
.jekyll-metadata
Gemfile.lock
.jekyll-cache/
@christinakim
christinakim / pretty_print_parameters.py
Last active November 6, 2020 16:44
print trainable parameters by layer
from prettytable import PrettyTable
def count_parameters(model):
table = PrettyTable(["Modules", "Parameters"])
total_params = 0
for name, parameter in model.named_parameters():
if not parameter.requires_grad: continue
param = parameter.numel()
table.add_row([name, param])
total_params+=param
@christinakim
christinakim / regex_to_mdfa.ipynb
Created November 18, 2020 22:24
regex_to_mdfa.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.