Skip to content

Instantly share code, notes, and snippets.

View chezou's full-sized avatar

Aki Ariga chezou

View GitHub Profile
@chezou
chezou / medium-html2tsv.py
Last active May 2, 2017 03:20
Create title and url list of Medium publication under 150 articles.
from bs4 import BeautifulSoup
from sys import argv
import re
if (len(argv) < 2):
print('Usage: python {} filename'.format(argv[0]))
quit()
target_html = open(argv[1])
# Borrowed from Java code https://spark.apache.org/docs/2.1.0/ml-features.html#n-gram
# and ml_lda https://github.com/rstudio/sparklyr/blob/9c830cecf3a91de0857dc33ef3b375c2f922ddd1/R/ml_lda.R#L15-L28
library(janeaustenr)
library(sparklyr)
library(dplyr)
## Configure cluster
config <- spark_config()
config$spark.driver.cores <- 2
@chezou
chezou / bibriography.py
Last active December 10, 2019 16:55
Sphinxで奥付を足す方法
#
# Sphinx extension to flush bibliography forcely (for LaTeX)
#
# Original code written by tk0miya: https://gist.github.com/5886e3f5fb86bd312fd784a7a7b57884
#
# Usage:
# 1. Write `.. bibliography::` where you want to flash citation. In this case, we assume all citations are in `bib.rst`
# 2. put this file into `ext` directory
# 3. Modify conf.py. See also source/conf.py
# 4. Add `postface.rst` into your `index.rst` after citation rst
@chezou
chezou / forward_sparklyr.sh
Last active January 17, 2017 02:24
autossh forwarding into your R Studio server
#!/bin/bash
set -ex
DIRECTOR_HOST=<REPLACE_YOUR_DIRECTOR_HOST>
GATEWAY_HOST=<REPLACE_YOUR_INTERNAL_GATWAY_HOST>
# Foward to your RStudio Server on gateway
#ssh -N -f -L 8787:$GATEWAY_HOST:8787 centos@$DIRECTOR_HOST
autossh -f -M 20010 -N -L 8787:$GATEWAY_HOST:8787 centos@$DIRECTOR_HOST
#ssh -f -CND 8157 centos@$DIRECTOR_HOST
target_packages = File.open("target_packages").read.split("\n")
puts '#/usr/bin/env ruby'
STDIN.each_line do |line|
m = line.match(/href="((.+?)_(.+?)\.tar\.gz)"/)
next unless m
file_name = m[1]
package_name = m[2]
version = m[3]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@chezou
chezou / Gemfile
Last active May 11, 2019 16:35
Example code of ruby with Amazon Polly
source 'https://rubygems.org'
gem 'nokogiri', '~>1.6'
gem 'aws-sdk', '~> 2'
diff --git a/Makefile.in b/Makefile.in
index 9ff4015..2da1c60 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -885,7 +885,7 @@ uninstall-am: uninstall-dist_resourceDATA \
.PRECIOUS: Makefile
-
+.NOTPARALLEL:
@chezou
chezou / cluster.conf
Created October 2, 2016 05:45
cluster configuration for cloudera director
name: aki-client
provider {
type: aws
accessKeyId: ${?AWS_ACCESS_KEY_ID}
secretAccessKey: ${?AWS_SECRET_ACCESS_KEY}
region: ap-northeast-1
subnetId: subnet-fdec2b8b
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.