Skip to content

Instantly share code, notes, and snippets.

View yantene's full-sized avatar
:fishsticks:
I'm new to being human.

Shuhei YOSHIDA yantene

:fishsticks:
I'm new to being human.
View GitHub Profile
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
jumap = File.open('jisx0213-2004-std.txt') { |f|
f.each_line.map { |l|
next if l =~ /^#/
l.split("\t").tap { |j, u|
break if j.empty? || u.empty?

Keybase proof

I hereby claim:

  • I am yantene on github.
  • I am yantene (https://keybase.io/yantene) on keybase.
  • I have a public key ASDSfLeH17Ls539qZ-oBkXWjBpSFzgH66b-lMhBW-TZmvgo

To claim this, I am signing this object:

@yantene
yantene / Dockerfile.sandbox
Last active October 31, 2018 09:10
`docker build -t yantene/sandbox /path/to/dockerfiledir` and `docker run --rm -it -v `pwd`:/mnt -p 10022:22 yantene/sandbox`
FROM base/devel
MAINTAINER yantene <contact@yantene.net>
# ユーザ作成
RUN \
useradd -m -g users -G wheel username;\
echo "username:password" | /usr/bin/chpasswd
RUN \
echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel;\
chmod 0440 /etc/sudoers.d/wheel
@yantene
yantene / priority_queue.rb
Created September 17, 2017 05:50
An implementation of priority queue with binary heap.
class PriorityQueue
def initialize(desc = false)
@a = []
@s = desc ? -1 : 1
end
[:size, :empty?, :clear].each { |m| define_method(m) { @a.send(m) } }
def enq(*vs)
vs.each do |v|
#!/bin/bash
input_svg=$1
output=$2
tmpdir=`mktemp -d`
rsvg-convert -w 256 -h 256 -f png $input_svg -o $tmpdir/input.png
(
class Array
def flat_pack
self.flat_map { |c| Range === c ? c.to_a : c }.map { |c| [c].pack('U*') }
end
end
Hentaigana = {
'あ' => [0x1b002..0x1b005].flat_pack,
'い' => [0x1b006..0x1b009].flat_pack,
'う' => [0x1b00a..0x1b00e].flat_pack,
[global]
unix charset = UTF-8
dos charset = CP932
workgroup = WORKGROUP
server string = Yantene Server
security = user
log file = /var/log/samba/%m.log
max log size = 50
browseable = yes
@yantene
yantene / mstfollet.js
Created May 3, 2017 16:34
マストドン横断検索にフォローリンクを追加するブックマークレット
javascript:(function() {
let mst_refs_xpath = "//div[@class='mst_ref']";
let mst_refs = document.evaluate(mst_refs_xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < mst_refs.snapshotLength; i++) {
let node = mst_refs.snapshotItem(i);
/* get account */
let reflink = node.getElementsByTagName('a')[0];
let toot_url = reflink.href;
let matched = toot_url.match(/https?:\/\/([^/]+)\/@([^/]+)\/.+/);
set noautofocus
set cncpcompletion
set smoothscroll
let barposition = 'top'
let hintcharacters = 'qwerasdfzxcv'
let locale = 'jp'
let completionengines = ['google']
let defaultengine = 'google.co.jp'
public class Ayeaye{
public static void ayeaye(){
System.out.println("アイアイ");
switch ((int) (Math.random() * 6)) {
case 0:
ayeaye();
break;
case 1:
osarusanda();
break;