Skip to content

Instantly share code, notes, and snippets.

Avatar

Kensuke Nagae kyanny

View GitHub Profile
View aws-logout.sh
aws-logout() {
for env in $(awk 'BEGIN{for(v in ENVIRON) print v}' | grep ^AWS)
do
echo "unset $env"
unset $env
done
}
View example.tf
provider "aws" {
profile = "default"
region = "ap-northeast-1"
}
# 1
resource "aws_instance" "instance1" {
ami = "ami-0a1c2ec61571737db"
instance_type = "t2.micro"
View main.go
package main
import (
"fmt"
"math"
)
func pp(a []uint64, oldcap int) {
if cap(a) != oldcap {
var ntimes float64
View pocket-delete-tags.rb
require 'net/http'
require 'uri'
require 'json'
def usage
puts <<USAGE
Usage:
$ ruby #{$0} <consumer_key> <access_token>
USAGE
end
View get-pocket-access-token.rb
# https://getpocket.com/developer/docs/authentication
require 'net/http'
require 'uri'
def usage
puts <<USAGE
Usage:
$ ruby #{$0} <consumer_key>
USAGE
View main.workflow
workflow "Post labeled issue to Slack" {
resolves = ["GitHub Action for Slack"]
on = "issues"
}
action "Filters for GitHub Actions-1" {
uses = "actions/bin/filter@0dbb077f64d0ec1068a644d25c71b1db66148a24"
args = "action labeled"
}
View delete_all_statuses.rb
#!/usr/bin/env ruby
require 'net/http'
require 'openssl'
require 'uri'
require 'json'
begin
http = Net::HTTP.new(ENV.fetch('MASTODON_HOST'), 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
View table.rb
#!/usr/bin/env ruby
# Usage
# $ ruby tools/table.rb
require 'terminal-table'
def make_table rank
headings = [ rank.upcase ]
qs = eval(File.read("tools/#{rank}.txt")).to_a
rows = qs.map { |q|
[q]
View paiza.js
copy(
$$('.problem-group .problem-box__header__title').map(function(el){ return el.textContent.split(/:/)[0] })
)
View bfs.rb
require 'thread'
V = Struct.new(:x, :y, :visited, :goal)
m = []
$w = 10
$h = 10
$h.times do |h|
l = []
You can’t perform that action at this time.