Skip to content

Instantly share code, notes, and snippets.

View futoase's full-sized avatar
🐱
Focusing

Keiji Matsuzaki futoase

🐱
Focusing
  • Japan
View GitHub Profile
@futoase
futoase / put-process-status.sh
Created March 15, 2019 05:59 — forked from michimani/put-process-status.sh
Put linux process status to Amazon CloudWatch.
###################################################################################
# check process aliving (count process number)
# return integer 1 (process is running) or 0 (process is dead) or 9 (some error)
###################################################################################
function is_process_alive() {
count=`ps awux | grep -v grep | grep -v "$0" | grep -w "$1" | wc -l`
if [[ $count =~ ^[0-9]+$ ]]; then
if [ $count != 0 ]; then
echo 1
else
@futoase
futoase / api_v1_01_introduction.md
Last active November 16, 2017 06:24 — forked from yokoji/api_v1_01_introduction.md
freee API v1.0

freee API v1.0

全自動クラウド会計ソフトfreeeの開発者向けAPIのドキュメントです。

概要

本APIを利用することで、あなたのアプリやサービスをfreeeと連携させることができます。

提供機能(2013/10/10現在)

@futoase
futoase / 0-Searchable list of companies with employees on Hacker News.md
Created March 1, 2016 05:19
Searchable list of companies with employees on Hacker News (from people saying "I work at ...")
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@futoase
futoase / pygments.css
Last active December 21, 2015 11:08 — forked from zmanji/pygments.css
.highlight {
background-color:#073642;
color:#93a1a1;
}
.highlight .c {
color:#586e75 !important;
font-style:italic !important;
}
-- 3.1.1 出版年別分布 --
td query -w -d book_crossing_dataset "
SELECT year, cnt
FROM
(
SELECT 1975 AS year, COUNT(year_of_publication) AS cnt
FROM books
WHERE year_of_publication < 1970
UNION ALL
-- 1.1.1 登録ユーザー数, アクティブユーザー数 --
td query -w -d book_crossing_dataset "
SELECT t1.cnt AS all_users, t2.cnt AS active_users, ROUND(t2.cnt/t1.cnt*100) AS active_rate
FROM
(
SELECT COUNT(distinct user_id) as cnt, 1 AS one
FROM users
) t1
JOIN
(
-- 4.1.1 ユーザーの評価回数平均 --
td query -w -d book_crossing_dataset "
SELECT ROUND(AVG(cnt)) AS avg
FROM
(
SELECT user_id, COUNT(book_rating) AS cnt
FROM ratings
GROUP BY user_id
) t1
"
-- 2.1.1 ユーザーの居住国分布 --
td query -w -d book_crossing_dataset -f csv -o user_dist_of_country.csv "
SELECT country, cnt, ROUND(cnt/total_cnt*10000)/100 AS rate
FROM
(
SELECT country, COUNT(*) as cnt, 1 AS one
FROM users
WHERE country != '' AND country != 'n/a'
GROUP BY country
ORDER BY cnt DESC
-- 6.1 共起分析:Simpson係数の高いブックペア上位20 --
td query -w -d book_crossing_dataset "
SELECT r2.title AS title1,
r2.year_of_publication AS year1,
r2.cnt AS cnt1,
r3.title AS title2,
r3.year_of_publication AS year2,
r3.cnt AS cnt2,
r1.cnt AS intersection,
r1.cnt/IF(r2.cnt<r3.cnt,r2.cnt,r3.cnt)*100 AS simpson