Skip to content

Instantly share code, notes, and snippets.

@doloopwhile
doloopwhile / file0.rb
Last active July 25, 2016 11:05
gulpにもmakeにも不満なWebデベロッパーためのRake(コンパイル・パターンマッチ・ファイル監視・通知) ref: http://qiita.com/doloopwhile/items/6088ad6c1753806da7c0
# Rakefile
# パターンにマッチするファイルのリストを生成
Src = FileList['src/*.js']
# dist.jsの生成にはSrcに含まれるファイルが必要と定義
# do〜endの中で具体的な生成方法を定義
file 'dist.js' => Src do |t|
# t.sourcesがソースファイルのリストなので、それをスペースで連結したコマンドラインを生成
sh "browserify -o dist.js #{t.sources.join(' ')}"
end
@doloopwhile
doloopwhile / wine.py
Created September 9, 2017 06:43
ワインの等級を当ててみた
# インターネットから直接データをダウンロードする
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import datetime as dt
import statsmodels.formula.api as sm
import itertools
import math
import sys
import csv
import pandas as pd
from pprint import pprint
from sklearn import linear_model
from sklearn import svm
from sklearn.preprocessing import StandardScaler
def read_csv(filename):
df = pd.read_csv(filename)
@doloopwhile
doloopwhile / gist:8c6ec7dd4703e8a44e559411cb2ea221
Last active March 3, 2025 11:08
Why I decided to discontinue PyExecJS and Python-CoffeeScript ?

What is PyExecJS and Python-CoffeeScript.

They are Python libraries that I developped on 2011.

  • PyExecJS: Automatically picks the best runtime available to evaluate your JavaScript program.
  • Python-CoffeeScript: A bridge to the JS CoffeeScript compiler.

They are ports of ruby gems with same name (execjs and ruby-coffee-script).

The aim of them were to compile CoffeeScript code on Windows XP.

@doloopwhile
doloopwhile / git-sed
Created September 14, 2018 02:16
git-sed command
#!/bin/bash
set -euC
if [ "$#" -eq 0 ]; then
echo 'git sed COMMAND [PATH [PATH[...]]]' >&2
exit 1
fi
if which gsed > /dev/null; then
SED=gsed # for macOS
else
@doloopwhile
doloopwhile / file0.txt
Created September 14, 2018 02:20
Git 管理下のファイルを一括置換する git-sed コマンドを作った ref: https://qiita.com/tonluqclml/items/13b323cea92425b85218
$ git ls-files | xargs -n 1 sed -i 's|find_by_admin|find_by(type: :admin)|g'
@doloopwhile
doloopwhile / file0.rb
Created September 26, 2018 12:21
active_job / delayed_job を高速化するハック ref: https://qiita.com/tonluqclml/items/f6a0411a8fbe3031cb0d
class CsvFormController < ApplicationController
# 「名前・年齢・メールアドレス」のCSVファイルをアップロードして、Userを作れる画面
#
# 太郎,32,[email protected]
# 二郎,30,[email protected]
# 三郎,27,[email protected]
def upload
rows = CSV.parse(params[:file].read)
UserUploadJob.perform_later(rows: rows)
end
@doloopwhile
doloopwhile / .bashrc
Created November 1, 2018 05:03
The ultimate script to indicate git status on PS1
#!/bin/bash
# PS1の設定
C() {
case $1 in
black) echo -e -n "\033[1;30m";;
red) echo -e -n "\033[1;31m";;
green) echo -e -n "\033[1;32m";;
yellow) echo -e -n "\033[1;33m";;
blue) echo -e -n "\033[1;34m";;
@doloopwhile
doloopwhile / gist:1419f460fbe2c3561714a4cd3a20c390
Last active October 11, 2019 02:51
Variable width bytes representation of uint64_t
'''
Variable width bytes representation of uint64_t.
Inspired by Ruby interpreter。
https://techlife.cookpad.com/entry/2019/09/26/143000
> 0x0000000000000000 - 0x000000000000007f: 1byte | 1XXXXXXX |
> 0x0000000000000080 - 0x0000000000003fff: 2bytes | 01XXXXXX | XXXXXXXX |
> 0x0000000000004000 - 0x00000000001fffff: 3bytes | 001XXXXX | XXXXXXXX | XXXXXXXX |
> 0x0000000000020000 - 0x000000000fffffff: 4bytes | 0001XXXX | XXXXXXXX | XXXXXXXX | XXXXXXXX |
@doloopwhile
doloopwhile / qiita.ipynb
Created October 17, 2019 03:08
自分が投稿したQiita記事のLike数・View数を収集する
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.