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/sh | |
PROFILE=hoge | |
regions=$(aws ec2 describe-regions | jq -r '.Regions[].RegionName') | |
for region in $(echo ${regions}) | |
do | |
echo "region: $region" | |
detector_id=$(aws --profile ${PROFILE} \ |
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
<details> | |
<summary>title</summary> | |
<pre> | |
<code> | |
hoge | |
moge | |
fizz | |
buzz | |
</code> | |
</pre> |
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
curl https://kenzo0107.hatenablog.com/rss -o hatena-rss.xml | |
sudo gem install jekyll-import | |
ruby -e 'require "jekyll-import"; | |
JekyllImport::Importers::RSS.run({ | |
"source" => "hatena-rss.xml" | |
})' |
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
name: static check | |
on: push | |
jobs: | |
imports: | |
name: Imports | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: check |
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
name: Test | |
on: [push] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
go-version: [1.13.x] | |
platform: [macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: |
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
FROM ruby:2.6-alpine as base | |
ENV RAILS_ENV production | |
# Update rubygems | |
RUN gem update --system | |
RUN gem update bundler --pre | |
RUN bundle config set without development:test | |
# == builder |
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 div_hash_each(r) | |
h = {} | |
p = [10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1] | |
p.each_with_index{|d, index| | |
a, r = r.divmod(d) | |
h[d] = a | |
} | |
return h | |
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
def div_hash_inject(r) | |
[10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1].inject(Hash.new(0)){|h, d| | |
a, r = r.divmod(d) | |
h[d] = a | |
h | |
} | |
end | |
p div_hash_inject(123_456) # {10000=>12, 5000=>0, 2000=>1, 1000=>1, 500=>0, 100=>4, 50=>1, 10=>0, 5=>1, 1=>1} |
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 div_each(r) | |
b = [] | |
p = [10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1] | |
p.each_with_index{|d, index| | |
a, r = r.divmod(d) | |
b << a | |
b << r if p.size - 1 == index | |
} | |
return b | |
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
def div_inject(r) | |
[10_000, 5_000, 2_000, 1_000, 500, 100, 50, 10, 5, 1].inject(r){|(*a, r), d| | |
a + r.divmod(d) | |
} | |
end | |
p div_inject(123_456) # [12, 0, 1, 1, 0, 4, 1, 0, 1, 1, 0] |