Skip to content

Instantly share code, notes, and snippets.

Kenta Murata mrkn

Block or report user

Report or block mrkn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mrkn
mrkn / lambda_function.rb
Created Aug 24, 2019
The lambda function of daily_prime_check
View lambda_function.rb
require 'json'
require 'prime'
require 'net/http'
require 'uri'
SLACK_URL = 'https://hooks.slack.com/services/....'
def post_to_slack(url, message)
uri = URI.parse(url)
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
View first_commits.sh
git log --pretty=format:'%ct %h %cn' | \
sort -n | \
ruby -e "gets;c={};while line = gets;t, _, n = line.chomp.split(' ');puts %Q(#{c[n] = n} #{Time.at(t.to_i).strftime('%Y%m%dT%H%M%S')}) unless c[n];end"
View iruby_folium_sample_ja.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:8319b4c4b6b8477f519fc9504e7ab90d
===== LIMIT=1000 =====
Calculating -------------------------------------
Mysql2Test.test_pluck_by_arrow(n) 64.717M bytes - 100.000 times
Mysql2Test.test_pluck(n) 154.227M bytes - 100.000 times
Comparison:
Mysql2Test.test_pluck_by_arrow(n): 64716800.0 bytes
Mysql2Test.test_pluck(n): 154226688.0 bytes - 2.38x larger
===== LIMIT=2000 =====
View julia-dot-optimize
julia> function dot(a, b)
s = zero(eltype(a))
for i in 1:endof(a)
s += a[i] * b[i]
end
return s
end
dot (generic function with 1 method)
julia> a = ones(100000); b = ones(100000);
View gist:98e4bd96068a02b173cdd5e9e4c0df2a
```
$ python
Python 3.6.4 (default, Apr 3 2018, 09:35:44)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from mxnet.gluon.parameter import ParameterDict
>>> pd1 = ParameterDict()
>>> pd2 = ParameterDict()
>>> pd1.get('a')
Parameter a (shape=None, dtype=<class 'numpy.float32'>)
View gist:549e82c47f5ffe407dc1fce29b657be2
compiling arrow-nmatrix.c
arrow-nmatrix.c: In function ‘garrow_type_to_nmatrix_dtype’:
arrow-nmatrix.c:57:8: error: ‘GARROW_TYPE_BOOL’ undeclared (first use in this function)
case GARROW_TYPE_BOOL:
^
arrow-nmatrix.c:57:8: note: each undeclared identifier is reported only once for each function it appears in
arrow-nmatrix.c:34:3: warning: enumeration value ‘GARROW_TYPE_BOOLEAN’ not handled in switch [-Wswitch-enum]
switch (arrow_type) {
^
arrow-nmatrix.c: In function ‘nmatrix_dtype_to_garrow_data_type’:
@mrkn
mrkn / rgb2lab.py
Last active Mar 19, 2018
color space conversion from RGB to CIELAB in PIL/Pillow (Japanese article) ref: http://qiita.com/mrkn/items/670e1622d41d2dcd26b4
View rgb2lab.py
from PIL import Image, ImageCms
im = Image.open(image_path)
if im.mode != "RGB":
im = im.convert("RGB")
srgb_profile = ImageCms.createProfile("sRGB")
lab_profile = ImageCms.createProfile("LAB")
rgb2lab_transform = ImageCms.buildTransformFromOpenProfiles(srgb_profile, lab_profile, "RGB", "LAB")
View flu-roxonin.csv
time temp headache
0 38.5 1
20 38.4 1
25 38.3 1
30 38.1 1
35 37.9 1
40 37.6 1
45 37.6 1
50 37.3 1
55 37.1 0
View same_all_bench.rb
require 'benchmark'
LEN = 10000
TRY = 1000
s0 = 'x' * 100
s1 = 'x' * 99 + 'y'
cases = {
shuffle: Array.new(LEN) {|i| i }.shuffle,
You can’t perform that action at this time.