Skip to content

Instantly share code, notes, and snippets.

View haruo31's full-sized avatar

Haruo Kinoshita haruo31

View GitHub Profile
@haruo31
haruo31 / generate_ios_icons.sh
Created October 31, 2017 07:36
batch script for generating and optimizing iOS icon image based https://github.com/smallmuou/ios-icon-generator
#!/bin/sh
#
# Copyright 2017 haruo31 <haruo31@underthetree.jp>
# Original by 2014 Wenva <lvyexuwenfa100@126.com>
#
# 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 furnished
@haruo31
haruo31 / ProcessBroker.java
Last active April 20, 2018 10:44 — forked from mapiondev/ProcessBroker.java
[java] 外部コマンド実行するクラス(スレッド安全版?)
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* ProcessBroker pb = new ProcessBroker("ps -ef | grep java".split(" "));
@haruo31
haruo31 / readme.md
Last active July 27, 2018 04:38
放送大学の単位認定試験 過去問PDFを Mac(もしくはLinux, 要はghostscriptで)でまとめる手順

目的

過去問と回答が大学Webサービスからダウンロードできるが、学期ごとに全部バラバラで非常に管理がしにくいので、科目ごとに結合して1つのPDFとして扱えるようにする。

準備

適当なディレクトリに必要な科目の過去問と回答をダウンロードして保存する。自分は2期分を保存した。

@haruo31
haruo31 / BreakUpCells.bas
Last active December 11, 2018 16:46
The Excel VBA script un-merge cells and copy contents to them. It runs on current worksheet. - Excelの開いているシートにある全ての結合セルを分解し、それぞれに内容をコピーするVBA
Option Explicit
Sub breakUpMergedCells()
Dim curSheet As Worksheet
Dim eCell As Range, curRange As Range
Dim curAddr As String
Dim fillCell As Range
Dim filledValue As String
Set curSheet = ActiveSheet
@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'))
@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 / 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&gt; var v = "AAA"
@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 / 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 / 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);
}
}