Skip to content

Instantly share code, notes, and snippets.

@alvinthai
alvinthai / python_dual_log_setup.py
Created December 18, 2020 06:12 — forked from fonic/python_dual_log_setup.py
Python dual-logging setup (console and log file) supporting different log levels and colorized output
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# -
# Python dual-logging setup (console and log file), -
# supporting different log levels and colorized output -
# -
# Created by Fonic <https://github.com/fonic> -
# Date: 04/05/20 -

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

var version="0.22",alamode={reportError:function(t){$("<h1 class='mode-error'>").text(t).prependTo(document.body)},getColumnsFromQuery:function(e){var t=datasets.filter(function(t){if(t)return t.queryName==e})[0];return t?t.columns:(alamode.reportError("No such query: '"+e+"'"),[])},getDataFromQuery:function(e){var t=datasets.filter(function(t){if(t)return t.queryName==e})[0];return t?t.content:(alamode.reportError("No such query: '"+e+"'"),[])},makeId:function(t){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",a="",n=0;n<t;n++)a+=e.charAt(Math.floor(Math.random()*e.length));return a},addContainerElement:function(t,e){return e=e||!1,id=alamode.makeId(10),"body"==t?$("<div id='"+id+"'></div>").addClass(id).addClass("mode-graphic-container").appendTo(".mode-content"):0===$(t).length?alamode.reportError("No such element: '"+t+"'"):(e&&$(t).empty(),$(t).addClass("mode-graphic-container"),$(t).addClass(id)),"."+id},addLinksToTables:function(t){var i="#"+t.table_id,e=t.link_columns,a=t.link_urls,n=
@alvinthai
alvinthai / slack_webhook_post.py
Created October 12, 2018 18:02 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests
@alvinthai
alvinthai / rank_metrics.py
Created August 27, 2017 22:14 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@alvinthai
alvinthai / survival_random_forest.r
Last active December 23, 2021 07:54
survival_random_forest.r
# data laod ---------------------------------------------------------------
# download data set
actg320_colnames <- c('id','time','censor','time_d','censor_d','treatment','treatment_group',
'strat2','sex','raceth','ivdrug','hemophil','karnof','cd4','priorzdv','age')
actg320 <- read.table('https://raw.githubusercontent.com/WinVector/QSurvival/master/vignettes/AIDSdata/actg320.dat', col.names = actg320_colnames)
dim(actg320)
head(actg320)
# -*- coding: utf-8 -*-
"""
@author: Faron
"""
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
from datetime import datetime
'''
@alvinthai
alvinthai / t-SNE Tutorial.ipynb
Created February 25, 2017 01:11 — forked from awjuliani/t-SNE Tutorial.ipynb
A notebook describing how to use t-SNE to visualize a neural network learn representations
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alvinthai
alvinthai / .block
Created June 22, 2016 16:26
Fetching CSV
license: gpl-3.0
@alvinthai
alvinthai / .block
Last active June 22, 2016 14:37
Box Plots
license: gpl-3.0