Skip to content

Instantly share code, notes, and snippets.

View carlpch's full-sized avatar

Carl Huang carlpch

  • Singapore
  • 21:04 (UTC +08:00)
View GitHub Profile
@zhanwenchen
zhanwenchen / export_tf_model.py
Last active November 4, 2024 16:26
Minimal code to load a trained TensorFlow model from a checkpoint and export it with SavedModelBuilder
import os
import tensorflow as tf
trained_checkpoint_prefix = 'checkpoints/dev'
export_dir = os.path.join('models', '0') # IMPORTANT: each model folder must be named '0', '1', ... Otherwise it will fail!
loaded_graph = tf.Graph()
with tf.Session(graph=loaded_graph) as sess:
# Restore from checkpoint
loader = tf.train.import_meta_graph(trained_checkpoint_prefix + '.meta')
@heyalexej
heyalexej / pytz-time-zones.py
Created November 16, 2016 09:14
list of pytz time zones
>>> import pytz
>>>
>>> for tz in pytz.all_timezones:
... print tz
...
...
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
@natanfelles
natanfelles / domain.tld.conf
Last active May 12, 2024 03:51
Nginx Virtual Host example to work on localhost
# Location: /etc/nginx/sites-available/domain.tld.conf
server {
listen 80;
# listen 443 ssl;
# include snippets/snakeoil.conf;
root /var/www/domain.tld/public;
index index.html index.php;
@benmarwick
benmarwick / 000-eScience_presentation.Rmd
Last active August 17, 2020 00:18
notes on docker and rstudio
# Reproducible Research using Docker and R
# Challenges of reproducibility
- dependencies
- isolation and transparency
- portability of computationational environment
- extendability and resuse
- ease of use
@skranz
skranz / s_dplyr
Created March 21, 2014 07:48
Wrappers to dplyr's data modification functions like arrange, select,... that work with string arguments.
# Helper functions that allow string arguments for dplyr's data modification functions like arrange, select etc.
# Author: Sebastian Kranz
# Examples are below
#' Modified version of dplyr's filter that uses string arguments
#' @export
s_filter = function(.data, ...) {
eval.string.dplyr(.data,"filter", ...)
}
@zr-tex8r
zr-tex8r / 00README.md
Last active November 22, 2016 02:30
LaTeX: CJK パッケージで日本語する
@dsparks
dsparks / CoefficientPlot.R
Last active November 29, 2017 22:36
ggplot2 coefficient plot, with discrete interval bounds
CoefficientPlot <- function(models, alpha = 0.05, modelnames = ""){
# models must be a list()
Multiplier <- qnorm(1 - alpha / 2)
CoefficientTables <- lapply(models, function(x){summary(x)$coef})
TableRows <- unlist(lapply(CoefficientTables, nrow))
if(modelnames[1] == ""){
ModelNameLabels <- rep(paste("Model", 1:length(TableRows)), TableRows)
} else {