Skip to content

Instantly share code, notes, and snippets.

@fjtkfm
fjtkfm / ignore.fish
Created February 13, 2023 02:22
Get ignore from github/ignore in fish (jq required)
function ignore -d 'gitignore file from github/ignore'
set command $argv[1]
switch $command
case list
__ignore_list
case '*'
__ignore_get $argv[2]
end
end
@fjtkfm
fjtkfm / convert_roman_num.py
Created August 8, 2021 04:37
入力された数値をローマ字記法に変換して返却する
# -*- coding: utf-8 -*-
M = 1000
C = 100
X = 10
I = 1
def num_to_roman(number=2015):
num_M = number / M
number = number % M
@fjtkfm
fjtkfm / write_csv.rb
Created August 8, 2021 04:34
CSV書き込みサンプル in ruby
require 'csv'
data = [1,2,3,4,5]
CSV.open("data.csv", "w") do |csv|
csv << data
end
@fjtkfm
fjtkfm / extract_mfcc_from_wav.jl
Created January 13, 2021 13:24
Juliaを使ってwavファイルからMFCCを抽出する
# using Pkg; Pkg.add('WAV'); Pkg.add('MFCC')
using WAV
using MFCC
y, _ = wavread("path/to/wavfile")
mfcc(y)
@fjtkfm
fjtkfm / make_scrapbox_link_for_ios.js
Created February 14, 2020 00:20
開いているページのScrapbox表記のリンクを作るためのブックマークレット iOS版
@fjtkfm
fjtkfm / make_scrapbox_link.js
Created February 14, 2020 00:19
開いているページのScrapbox表記のリンクを作るためのブックマークレット
@fjtkfm
fjtkfm / Dockerfile
Last active October 21, 2023 05:35
「ふつうのコンパイラをつくろう」のcbcを実行するためのDockerfile
FROM i386/centos:7
WORKDIR /work
RUN yum update -y && yum install -y wget gcc java-1.8.0-openjdk && yum clean all
RUN wget http://www.loveruby.net/archive/cbc/cbc-1.0.tar.gz
RUN tar xzf cbc-1.0.tar.gz
RUN cd cbc-1.0; ./install.sh
@fjtkfm
fjtkfm / converter.rb
Created February 2, 2020 02:17
md2sbした後のテキストを一括で取り込むためのJSONに変換するスクリプト
require 'json'
filenames = Dir.glob('docs/*')
result = {pages: []}
filenames.each do |filename|
File.open(filename, 'r') do |file|
title = filename.gsub(/docs\//, '').gsub(/\.md/, '')
lines = []
file.each_line do |line|
@fjtkfm
fjtkfm / tab_color.fish
Created February 2, 2020 01:26
Function to change item tab color with fish shell (inspired by [Change iTerm2 tab color when using SSH](https://gist.github.com/wadey/1140259) )
function tab_color --description "set iterm tab color"
set red $argv[1]
set green $argv[2]
set blue $argv[3]
echo -ne "\033]6;1;bg;red;brightness;$red\a"
echo -ne "\033]6;1;bg;green;brightness;$green\a"
echo -ne "\033]6;1;bg;blue;brightness;$blue\a"
end
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.