Skip to content

Instantly share code, notes, and snippets.

Avatar
🚴‍♂️

takuma-saito

🚴‍♂️
View GitHub Profile
View in1.txt
0 0 2 21 2 23 15 18
4 22 24 17 12 4 11 19
3 3 11 15 5 12 6 8
18 23 6 12 18 24 15 11
9 7 19 18 16 18 14 18
2 17 10 6 5 7 20 7
5 24 5 24 18 0 1 3
24 21 6 8 21 23 18 13
@takuma-saito
takuma-saito / gist:12bc5d8c8594419824996111d4eeb1b1
Last active Nov 2, 2020
げんせん、源泉徴収額の計算の仕方
View gist:12bc5d8c8594419824996111d4eeb1b1
# げんせんちょうしゅうの計算の仕方, N = xxxxx
# 源泉徴収金額
echo $[floor(0.1021 * (N / 1.10))]
View socat.txt
socat Examples
===============
* 注意
- SYSTEM で : を使う時は必ずエスケープすること
* 相手に接続
# telnet, netcat, socat それぞれの場合
$ socat - TCP:127.0.0.1:8000
View 0_sudoku.rb
module Puzzle
class Board
include Enumerable
def initialize(board)
@board = board
end
def rows(row)
@board[row * 9, 9].compact
end
def cols(col)
@takuma-saito
takuma-saito / swift-avplayer.swift
Last active Oct 12, 2020
swift-avplayer.swift
View swift-avplayer.swift
import AVFoundation
import AVKit
import UIKit
extension CMTime {
var asDouble: Double {
get {
return Double(self.value) / Double(self.timescale)
}
View appstore-sign.sh
### [apple store, appstore]
# キーと公開鍵認証リクエストを作成
$ openssl req -newkey rsa:2048 -out server.csr -keyout server.pem -days 365 -subj '/emailAddress=your_mail_address@gmail.com/CN=YOUR NAME/C=JP' -batch -nodes
# キーのインポート
$ security import kaigi.pem
$ mv ~/Downloads/ios_distribution.cer kaigi.cer
$ openssl x509 -in kaigi.cer -inform DER -out kaigi.cer.pub -outform pem
@takuma-saito
takuma-saito / sign.sh
Last active Aug 20, 2020
ore-ore-sign
View sign.sh
$ openssl req -new -nodes -newkey rsa:2048 -keyout server.key -batch -subj '/C=JP/ST=Tokyo/L=Tokyo/O=Company/OU=Web/CN=example.jp' > server.csr # 組織の場合
$ openssl req -new -nodes -newkey rsa:2048 -keyout server.key -batch -subj '/emailAddress=your_mail_address@gmail.com/CN=YOUR NAME/C=JP' > server.csr # 個人の場合
$ openssl x509 -days 3650 -req -signkey server.key < server.csr > server.crt
$ diff <(openssl x509 -modulus -in server.crt | grep Modulus) <(openssl rsa -modulus -in server.key | grep Modulus)
# csr 確認
$ openssl req -text -in server.csr
# crt 確認
$ openssl x509 -text -in server.csr
@takuma-saito
takuma-saito / install_exporter.sh
Last active Jul 21, 2020
install_exporter.sh
View install_exporter.sh
#!/bin/bash -xe
# update apt packages
sudo apt-get -o Acquire::Check-Valid-Until=false update
##
# node exporter
##
version=1.0.1
View traversable.rb
require 'uri'
require 'open-uri'
require 'nokogiri'
module Traversable
Target = Struct.new(:url, :depth, keyword_init: true)
def traverse(root, max_depth = 2)
root_url = URI.parse(root)
host = root_url.host
targets = [Target.new(url: root_url, depth: 0)]
View url_mappable.rb
require 'open-uri'
module Concern
def self.extended(base)
base.instance_variable_set(:@__deps, [])
end
def included(base)
if (deps = base.instance_variable_get(:@__deps))
deps << self
else
You can’t perform that action at this time.