This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cf. https://html-preview.github.io/?url=https://github.com/hashids/hashids.github.io/blob/master/index.html | |
require "hashids" | |
puts "Default alphabet length: #{Hashids::DEFAULT_ALPHABET.length}" | |
hashids = Hashids.new("This is salt", 10) | |
puts <<MSG | |
Alphabet: #{hashids.alphabet} | |
Alphabet length: #{hashids.alphabet.length} | |
Seps: #{hashids.seps} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "js/web.jsx"; | |
class Util { | |
static function image2Canvas(image : HTMLImageElement) : HTMLCanvasElement { | |
var document = dom.window.document; | |
var canvas = document.createElement("canvas") as HTMLCanvasElement; | |
canvas.width = image.width; | |
canvas.height = image.height; | |
var ctx = canvas.getContext("2d") as CanvasRenderingContext2D; | |
ctx.drawImage(image, 0, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
PANE_MINIMUM=2 | |
usage() { | |
cat <<USAGE | |
Usage: $(basename $0) [-c COL] [-r ROW] [--ssh-option SSH_OPTIONS] HOST [HOST2 ...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parser for KNB corpus (http://nlp.ist.i.kyoto-u.ac.jp/kuntt/#ga739fe2) | |
# | |
# Copyright 2012- Takeshi Arabiki | |
# License: MIT License (http://opensource.org/licenses/MIT) | |
# | |
# Example: | |
# | |
# # KNB コーパスを data ディレクトリ下にダウンロードして解凍 | |
# # 返り値は解凍後のファイル名 | |
# dir <- KNB$downloadCorpus("data") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
require 'faker' | |
require 'google/cloud/bigquery' | |
PROJECT_ID = ENV['PROJECT_ID'] | |
DATASET_ID = ENV['DATASET_ID'] | |
TABLE_ID = 'json_extract_benchmark' | |
bigquery = Google::Cloud::Bigquery.new(project_id: PROJECT_ID) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit/ui/console/testrunner' | |
class TestUnitProfiler | |
Record = Struct.new(:test_name, :test_class, :start_time, :self_time, :total_time, :children, keyword_init: true) do | |
def to_h | |
{ | |
name: test_name, | |
class: test_class, | |
self: self_time, | |
total: total_time, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
image_id=$1 | |
if [ -z "$image_id" ]; then | |
echo "Usage: $(basename $0) IMAGE_ID" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
condition="" | |
fs="\t" | |
while getopts c:F: OPT; do | |
case $OPT in | |
c ) condition=$OPTARG;; | |
F ) fs=$OPTARG;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -* - coding: utf-8 -*- | |
import argparse | |
import inspect | |
import eyed3 | |
import eyed3.id3 | |
def convertID3Encoding(audiofile, backup = False): | |
tag = audiofile.tag | |
if not tag: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2015- Takeshi Arabiki | |
# License: MIT License (http://opensource.org/licenses/MIT) | |
library(data.table) | |
access_logs <- (function() { | |
set.seed(0) | |
USER_COUNT <- 10000 | |
PAGES <- c("page1", "page2", "page3") |
NewerOlder