Skip to content

Instantly share code, notes, and snippets.

Avatar

結城浩 / Hiroshi Yuki hyuki

View GitHub Profile
@hyuki
hyuki / WebToScrapbox.js
Last active Feb 25, 2022
WebToScrapbox.js - ブラウザで見ているページのタイトルとURLをScrapboxに保存するBookmarklet
View WebToScrapbox.js
/*
* WebToScrapbox.js
* ブラウザで見ているページのタイトルとURLをScrapboxに保存するBookmarklet
*/
function start() {
const project = 'https://scrapbox.io/YOURPROJECT/';
const url = location.href;
const title = document.title;
const body1 = "\n " + title;
const body2 = "\n [" + title + ' ' + url + ']';
@hyuki
hyuki / bold.rb
Last active Jul 7, 2021
How do you convert "Hello, **world**!" to "Hello, <b>world</b>!" in Ruby?
View bold.rb
text = <<"EOD"
Lorem**ipsum**dolorsitamet,
con*secteturadipiscing**elit**,
**sed****do**eiusmod**temporincididunt
utlabore**etdoloremagnaaliqua.
EOD
html = <<"EOD"
Lorem<b>ipsum</b>dolorsitamet,
con*secteturadipiscing<b>elit</b>,
@hyuki
hyuki / commonmarker-test.rb
Created Jul 6, 2021
commonmarker-test.rb
View commonmarker-test.rb
require 'commonmarker'
md = '$$\begin{align}x\\\\y\end{align}$$'
puts "BEFORE:" + md
puts "AFTER :" + CommonMarker.render_html(md)
@hyuki
hyuki / BookMarkDown.js
Last active Jun 27, 2021
BookMarkDown.js - ブラウザで見ているページのタイトルとURLを、-[タイトル](URL)というMarkdown形式にするBookmarklet
View BookMarkDown.js
/*
* BookMarkDown.js
* ブラウザで見ているページのタイトルとURLを、
* - [タイトル](URL) という形式と、
* タイトル+改行+URL+改行 という形式と、
* [タイトル URL] という形式にする
* Bookmarklet
*/
function start() {
let url = location.href;
@hyuki
hyuki / text-to-speech-quick-example-with-azure-in-japanese.js
Created Jun 12, 2021
text-to-speech-quick-example-with-azure-in-japanese.js
View text-to-speech-quick-example-with-azure-in-japanese.js
// cf. https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/quickstart/javascript/node/text-to-speech/index.js
var subscriptionKey = "99999999999999999999999999999999"; // Your Subscription Key.
var serviceRegion = "japaneast"; // "westus"
var filename = "output.mp3";
var audioConfig = sdk.AudioConfig.fromAudioFileOutput(filename);
var speechConfig = sdk.SpeechConfig.fromSubscription(subscriptionKey, serviceRegion);
// https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechsynthesisoutputformat?view=azure-node-latest
@hyuki
hyuki / gserr.txt
Last active May 17, 2021
Troubleshoot: GPL Ghostscript 9.16: Can't find initialization file gs_init.ps.
View gserr.txt
$ dvipdfmx test.dvi
GPL Ghostscript 9.16: Can't find initialization file gs_init.ps.
$ gs --version
GPL Ghostscript 9.16 (2015-03-30)
$ brew info gs
ghostscript: stable 9.25 (bottled), HEAD
$ brew link ghostscript
@hyuki
hyuki / girlnote323-contains.java
Last active May 14, 2021
girlnote323-contains.java - Web連載「数学ガールの秘密ノート」 第323回 アルゴリズム、なかなか大変(前編)
View girlnote323-contains.java
// 注意:本文に近付けるため、Javaとしては不自然な書き方になっています
// cf: https://cakes.mu/posts/33738
class Node {
int value;
Node next;
public Node(int value, Node next) {
this.value = value;
this.next = next;
}
@hyuki
hyuki / girlnote323-contains-instance.java
Last active May 14, 2021
Web連載「数学ガールの秘密ノート」 第323回 アルゴリズム、なかなか大変(前編)
View girlnote323-contains-instance.java
// 注意:本文に近付けるため、Javaとしては不自然な書き方になっています
// cf: https://cakes.mu/posts/33738
class List {
Node head;
public List(int... values) {
this.head = new Node(0, null);
this.head.next = this.head;
Node p = this.head;
for (int i = values.length - 1; i >= 0; i--) {
View kuku.rb
yomi = {
"2" => 'に',
"3" => 'さ',
"4" => 'し',
"5" => 'ご',
"6" => 'む',
"7" => 'な',
"8" => 'は',
"9" => 'く',
}