Skip to content

Instantly share code, notes, and snippets.

View haruo31's full-sized avatar

Haruo Kinoshita haruo31

View GitHub Profile

Keybase proof

I hereby claim:

  • I am haruo31 on github.
  • I am haruo8231 (https://keybase.io/haruo8231) on keybase.
  • I have a public key ASA6CquUkOjcM5LkiBQi7d95A22LbQT4bORAcSM546J5ngo

To claim this, I am signing this object:

@haruo31
haruo31 / screw_util.scad
Created June 1, 2023 00:22
screw_util.scad
$fa = 24;
$fs = 0.1;
thread_profiles = [
["Tr", function (P) (
let (H1 = 0.5 * P, H = P / (tan(15) * 2), _w1 = P / H * (H + H1) / 2, _w = P / H * (H - H1) / 2)
[
[[_w1 * 0.5, -H1], [_w * 0.5, 0], [_w * -0.5, 0], [_w1 * -0.5, -H1]], // ext
@haruo31
haruo31 / stand_1.scad
Last active December 14, 2020 15:14
cross stand(mock)
$fa=4;
$fs=0.1;
for(x=[0,180]) {
rotate([0,x,0])
difference() {
union() {
rotate([0,90,0]) linear_extrude(75)
square(6, center=true);
@haruo31
haruo31 / sleeve.scad
Created November 19, 2020 09:54
openscad sleeve model
$fs = 0.1;
$fa = 3;
module sleeve(d=3, h=1, t=1) {
difference() {
cylinder(d=d, h);
cylinder(d=d-t*2, h);
}
}
@haruo31
haruo31 / board_leg_25mm.scad
Last active November 19, 2020 11:14
board_leg_25mm
$fa = 3;
$fs = 0.1;
module taper_cylinder(d=20, r=2, h=8) {
linear_extrude(h, scale=[(d-h*r)/d,(d-h*r)/d])
circle(d=d);
}
difference() {
@haruo31
haruo31 / Dockerfile
Created November 25, 2019 20:39
docker bootstrap for lsp perl-languageserver (wip)
FROM perl:5.10
ENV PERL_MM_USE_DEFAULT 1
ENV PERL_EXTUTILS_AUTOINSTALL --defaultdeps
RUN perl -MCPAN -e "install Perl::LanguageServer"
WORKDIR /
@haruo31
haruo31 / sample.sh
Created October 6, 2019 18:35
Find CD information and store into *.cdr image using diskutil information. (extra command xidel is required to work.)
diskutil list -plist |
xidel --data=- --extract "//*/string[.='CD_partition_scheme']/../*" |
awk 'NR % 2 == 1 { printf "%s\t", $0; } NR % 2 == 0 { print $0; }' |
IFS=$'\t' while read key value; do
case "$key" in
"DeviceIdentifier")
DEVICE=/dev/${value}
;;
"VolumeName")
VOLNAME="${value}"
@haruo31
haruo31 / result.md
Created April 24, 2019 11:38
output of jshell@OpenJDK-12
$ jshell
|  Welcome to JShell -- Version 12
|  For an introduction type: /help intro

jshell> /set feedback verbose
|  Feedback mode: verbose

jshell> var v = "AAA"
@haruo31
haruo31 / java-bytearray.md
Created March 26, 2019 14:41
The script converts 8bit hex string into integer list for java bytes array

The script converts 8bit hex string into integer list for java bytes array

e.g.

  • 0x94, 0x0a, 0xc0 -> -0x6c, 0x0a, -0x40
  • 94 0A C0 -> -0x6c, 0x0a, -0x40

this script uses Array.prototype.map().

input

@haruo31
haruo31 / script.js
Created March 24, 2019 23:16
Greesemonkey script generates json list from aliexpress order list.
// ==UserScript==
// @name AliExpress order collector
// @version 1
// @include https://trade.aliexpress.com/orderList.htm*
// ==/UserScript==
function run() {
var elem = document.querySelector('.me-menu-body').appendChild(document.createElement('textarea'));
elem.value = (JSON.stringify(
Array.prototype.slice.call(document.querySelectorAll('.order-item-wraper'))