Skip to content

Instantly share code, notes, and snippets.

Avatar

Aki Ariga chezou

View GitHub Profile
View prelims.diff
diff --git a/prelims/handler.py b/prelims/handler.py
index d4d416d..014bc7d 100644
--- a/prelims/handler.py
+++ b/prelims/handler.py
@@ -1,16 +1,18 @@
from .post import Post
import os
-
+from pathlib import Path
@chezou
chezou / code-server.ipynb
Created July 17, 2020 00:56
code-server.ipynb
View code-server.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chezou
chezou / ex2-3_plot_saled_prediction.ipynb
Created May 27, 2020 02:56
Ex2-3_plot_saled_prediction.ipynb
View ex2-3_plot_saled_prediction.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pytd_simple.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chezou
chezou / github_vulns.py
Created December 25, 2019 09:08
GitHub SecurityVulnerabilities
View github_vulns.py
import requests
class GitHubClient:
def __init__(self, apikey, session=None):
self.headers = {"Authorization": f"Bearer {apikey}"}
if not session:
self.sess = requests.Session()
else:
self.sess = session
@chezou
chezou / plot_prophet_with_mpl.py
Last active December 9, 2019 08:44
Plot Facebook Prophet without model
View plot_prophet_with_mpl.py
import matplotlib as mlp
import pandas as pd
mlp.use("agg")
from matplotlib import pyplot as plt
from matplotlib.dates import (
MonthLocator,
num2date,
AutoDateLocator,
AutoDateFormatter,
@chezou
chezou / mt2md.rb
Created December 1, 2019 13:48
hatena blog 2 markdown
View mt2md.rb
#!/usr/bin/env ruby
# Forked from: http://hamasyou.com/blog/2014/02/13/movable-type-to-octopress/
require 'date'
require 'mustache'
require 'stringex'
require 'cgi'
require 'reverse_markdown'
@chezou
chezou / as_msgpack_stream.R
Last active October 26, 2019 13:05
Convert R data frame to msgpack stream
View as_msgpack_stream.R
devtools::install_github("crowding/msgpack-r")
library(msgpack)
x <- data.frame(a=1:3, b=4:6)
conn <- gzfile("test.msgpack.gz", open="w+b")
apply(x, 1, function(x) {writeMsg(c(x, time=as.integer(Sys.time())), conn)})
flush(conn)
close(conn)
@chezou
chezou / rand.dig
Created May 8, 2019 04:17
Parallel example with py> operator
View rand.dig
+t1_1:
py>: rand.rand_params
docker:
image: 'digdag/digdag-python:3.6.8-stretch'
n_iter: 5
+t1_2:
echo>: ${param_list}
+t1_3:
@chezou
chezou / calc_multiclass_precision_recall.sql
Last active March 15, 2019 06:26
Calculate multiclass micro/macro precision and recall in SQL
View calc_multiclass_precision_recall.sql
with agg as (
select
p.label, p.probability, t.survived
from
prediction_rf p
join
test t on (p.rowid = t.rowid)
order by
probability desc
),