Skip to content

Instantly share code, notes, and snippets.

# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails"
gem "mysql2"
end
@tomykaira
tomykaira / wire-rack-fastener.scad
Created September 17, 2021 13:32
Wire rack fastener
$fn = 100;
// dimension: mm
wire_dia = 1.5;
screw_head_dia = 9.0;
screw_hole_dia = 4.0;
head_width = 25;
head_height = 25;
fillet = 2;
a あ ア ア 0
i い イ イ 0
u う ウ ウ 0
e え エ エ 0
o お オ オ 0
ka か カ カ 0
ki き キ キ 0
ku く ク ク 0
ke け ケ ケ 0
ko こ コ コ 0
@tomykaira
tomykaira / How-to-use-github-repo-as-IDEA-setting-repo.md
Last active June 2, 2021 05:38
Memo, how to sync github repo as IDEA setting repository.

Official document: https://www.jetbrains.com/help/idea/settings-tools-settings-repository.html

Problem

With Personal Access Token (PAT), as far as I tried, it is impossible to push changes to private repos. Therefore it is impossible to use https:// git url as sync rpeo.

With git@github.com URL, jgit (jsch) emits authorization errors on sync even if the SSH pub key is added to your Github account. This is because jgsch does not support OpenSSH format ssh private keys.

#02: DeviceInformation
#03: Custom Service: b88612e9-b3c1-45ee-aaf5-5e145e2d9831
BLE: set #03
Selected service Custom Service: b88612e9-b3c1-45ee-aaf5-5e145e2d9831.
#00: Custom Characteristic: b88612ea-b3c1-45ee-aaf5-5e145e2d9831 W
#01: Custom Characteristic: b88612eb-b3c1-45ee-aaf5-5e145e2d9831 N
#02: Custom Characteristic: b88612ec-b3c1-45ee-aaf5-5e145e2d9831 R
#03: Custom Characteristic: b88612ed-b3c1-45ee-aaf5-5e145e2d9831 R
#04: Custom Characteristic: b88612ee-b3c1-45ee-aaf5-5e145e2d9831 R
The MIT License (MIT)
Copyright (c) 2017 Rusoto Project Developers
Copyright (c) 2020 tomykaira
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@tomykaira
tomykaira / README.md
Created December 16, 2019 01:46
How to set up TimeMachine drive on your NAS (but inefficient, slow).
  • Login to your SMB with Finder, and save the password to Keychain.
  • Create timemachine-macbook.sparsebundle under the SMB root directory.
  • Mount it to /Volumes/TimeMachine.
  • Run tmutil setdestination /Volumes/TimeMachine as root (with sudo).
  • Allow security command to access your keyring to automate mounting TimeMachine drive.
    • security find-generic-password -wa TimeMachineSparseBundlePass
@tomykaira
tomykaira / error.txt
Created August 28, 2019 19:33
Silly example case to reproduce "Unknown column" error on mysql 5.6, but not on mysql 8.0+
Unknown column 'x6.z' in 'where clause'
java.sql.SQLSyntaxErrorException: Unknown column 'x6.z' in 'where clause'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:970)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:387)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at slick.jdbc.StatementInvoker.results(StatementInvoker.scala:38)
@tomykaira
tomykaira / jupyter-remote.sh
Created February 11, 2019 17:37
Run remote jupyter server (server = windows + WSL + SSH)
#!/bin/sh
set -e
local_json=/tmp/jupyter-kernel.json
rm nohup.out
pkill -f "jupyter-kernel.exe"
nohup ssh win "/mnt/c/Users/tomyk_000.GALLERIAXTWIN81/Anaconda3/Scripts/jupyter-kernel.exe" &
sleep 1
# Monte Carlo (virtual kodoku)
import gym
import numpy as np
import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import gym
import random
import math