Skip to content

Instantly share code, notes, and snippets.

@mutsune
mutsune / Pipfile
Last active November 4, 2017 14:26
ブロックチェーンを作ることで学ぶ 〜ブロックチェーンがどのように動いているのか学ぶ最速の方法は作ってみることだ〜 https://qiita.com/hidehiro98/items/841ece65d896aeaa8a2a のコード。タイポ修正やコメントを微妙に書き加えた
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[dev-packages]
[requires]
python_version = "3.6"
class Katakana2Hiragana {
public static void main(String args[]) {
System.out.println((char)("ガ".charAt(0) - 'ァ' + 'ぁ') == 'が');
}
}
@mutsune
mutsune / reading_list_on_chrome.scpt
Created April 6, 2018 05:25
Chrome で開いているタブを Safari の Reading List へ追加する AppleScript
tell application "Google Chrome"
set myURL to get URL of active tab of first window
set myTitle to get title of active tab of first window
end tell
tell application "Safari" to add reading list item myURL with title myTitle
@mutsune
mutsune / lang.c
Last active April 30, 2018 08:53
「ポーランド記法での四則演算」「関数定義とその実行」「関数の再帰呼び出し」を処理できる minimal な言語処理系の実装 https://www.youtube.com/watch?v=JAtN0TGrNE4
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
static char *p;
static char func[26][100];
__attribute__((noreturn)) static void error(char *fmt, ...) {
@mutsune
mutsune / file.c
Last active May 17, 2018 13:46
はじめてのOSコードリーディング リスト10.1 ファイル操作のサンプルコード
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main() {
int fd;
char buf[2];
fd = open("filename.txt", 2);
import java.io.File
object TrainSampleWithScala extends App {
def train() {
val parameter: Parameter = new Parameter(SolverType.AVERAGE, 10)
val model: PerceptronModel = PerceptronModel.train(docs, parameter)
return model
}
@mutsune
mutsune / client.js
Created September 21, 2018 15:21
minimum socket-io
const socketio = require('socket.io-client')
const socket = socketio('http://localhost:8888');
socket.on('update', d => console.log(d));
socket.on('dynamo', d => console.log(d));
// socket.on('connect', function(){});
// socket.on('event', d => console.log(d));
// socket.on('disconnect', function(){});
@mutsune
mutsune / play_next_on_end.js
Last active October 13, 2018 13:01
次の audio を自動再生する
const tunes = document.querySelectorAll('audio');
tunes.forEach((e, i) => e.onended = () => tunes[i + 1].play());
package sax;
import org.xml.sax.Attributes;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import java.io.File;