This file contains hidden or 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 ruby | |
# -*- coding: utf-8 -*- | |
# ๆๅ ณ Fiber ็่งฃ้: (ๆ็ งๆฐๆฎๆต็ๆนๅๅไธบไธค้จๅ) | |
# ๅจ `ไธป็บฟ็จ' ไธญไฝฟ็จ resume ๆนๆณๆฅๅฏๅจ(ๆ็ปง็ปญๆง่ก)ไธไธช `็บค็จ'. | |
# 1. ็ฌฌไธๆฌก่ฐ็จ fiber.resume, ไผๅฏๅจไธไธช็บค็จ, | |
# ๅฆๆ resume ่ฐ็จๆถๆไพไบๅฎๅ, ไผไฝไธบไปฃ็ ๅๅฝขๅไผ ๅ ฅไปฃ็ ๅ. | |
# 2. ๅฆๆ้็ฌฌไธๆฌก่ฐ็จ fiber.resume, ๅณ, `ๆขๅค' ไธไธช็บค็จ, ไผๅไธคไปถไบ: | |
# - ไปไธๆฌก็ฆปๅผ็บค็จ็้ฃไธชไฝ็ฝฎ(่ฐ็จ Fiber.yield ็ฆปๅผ็บค็จ็้ฃไธชไฝ็ฝฎ), ๆขๅค็บค็จ็ๆง่ก. |
This file contains hidden or 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
bak_dir=~/Downloads | |
name=ik_kefu | |
full_name=$bak_dir/${name} | |
keep_count=3 | |
date=$(date '+%Y-%m-%dT%H%M') | |
[ -e $full_name.zip ] && mv $full_name.zip "$full_name$date.zip" | |
bak_files=$(find $bak_dir/ -maxdepth 1 -name "${name}????-??-??T????.zip" |sort -V) |
This file contains hidden or 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 'epitools' | |
%w[gdbm sdbm cdb].each { |lib| require lib } | |
DBS = [ | |
[GDBM, GDBM], | |
[SDBM, SDBM], | |
[CDBMake, CDB ], | |
] | |
NUM = 100000 |
This file contains hidden or 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 | |
if ! fgrep -qs 'ctrl:new_ctrl = +new_ctrl(new_ctrl)' /usr/share/X11/xkb/rules/evdev; then | |
sudo sed -i.bak '/ctrl:nocaps[[:blank:]]*=[[:blank:]]*+ctrl(nocaps)/a\ | |
ctrl:new_ctrl = +new_ctrl(new_ctrl) | |
' /usr/share/X11/xkb/rules/evdev | |
fi | |
cat <<'HEREDOC' |sudo tee /usr/share/X11/xkb/symbols/new_ctrl | |
partial modifier_keys |
This file contains hidden or 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
def tarai(x, y, z) | |
x <= y ? y : tarai( | |
tarai(x-1, y, z), | |
tarai(y-1, z, x), | |
tarai(z-1, x, y) | |
) | |
end | |
require 'benchmark' |
This file contains hidden or 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 | |
sec=$(date '+%Y%m%d%H%M%S') | |
mkdir -p db/migrations | |
set -u | |
new_migration=db/migrations/${sec}_$1.rb | |
if [[ "$1" =~ ^create_join_table_for_(.+)_and_(.+) ]]; then | |
content="create_join_table" |
This file contains hidden or 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 ruby | |
puts 'test github token' |
This file contains hidden or 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
# System Info: | |
1. `uname -a`: | |
Linux zbook 5.12.12-arch1-1 #1 SMP PREEMPT Fri, 18 Jun 2021 21:59:22 +0000 x86_64 GNU/Linux | |
2. `lsb_release`: | |
`lsb_release` not found. | |
3. `/etc/lsb-release`: |
This file contains hidden or 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
res = [] | |
File.foreach('mastering-roda.org').each do |line_content| | |
line_content.scan(/(\b\w{2,}\b) (\b\k<1>\b)/).each do |e| | |
next if e == ['btn', 'btn'] | |
res << [line_content, e] | |
end | |
end |
This file contains hidden or 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 ruby | |
begin | |
require "bundler/inline" | |
rescue LoadError => e | |
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler" | |
raise e | |
end | |
gemfile(true) do |
OlderNewer