Skip to content

Instantly share code, notes, and snippets.

#!ruby -rzlib
print Zlib.inflate(DATA.read).unpack("B*")[0].tr("01"," #").scan(/.{49}/).join"\n"
__END__
x�U�1
1E�(�.�`�`��^%G퍲��Ŷ�W�%���"
�6)�|'����1�|�?qa�R��h2�~��|;`�P�J I�F���T��#��h�O.�a�A��8�
{�瑋(�\�J�����Z�i�u/��e�p���s{����7�؏��
#!/bin/bash
set -e -o pipefail
container_ids=$(docker ps --format "{{.ID}}")
for container_id in $container_ids; do
volumes=$(docker inspect $container_id | jq -c '.[0].Mounts[] | select(.Type=="bind") | {Source: .Source, Destination: .Destination}')
for volume in $volumes; do
echo "Watch $container_id $volume"
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({ headless: false });
const context = browser.defaultBrowserContext();
await context.overridePermissions('https://stretch3.github.io', ['camera', 'microphone']);
const page = (await browser.pages())[0];
await page.goto('https://stretch3.github.io/');
redis-store: 1.9.0, redis: 4.5.1
redis-store: 1.9.0, redis: 4.6.0
Pipelining commands on a Redis instance is deprecated and will be removed in Redis 5.0.0.
redis.multi do
redis.get("key")
end
should be replaced by
gem install rubocop-minitest
cat > _tmp-rubocop.yml <<YML
require: rubocop-minitest
AllCops:
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
Exclude:
require "ipaddr"
text = ARGF.read
cidrs = []
while (match = text.match(%r[(\d+\.\d+\.\d+\.\d+/\d+)]))
cur = IPAddr.new(match[1])
cur_addrs = cur.to_range.to_a
cidrs.each do |cidr|
puts "overlap: #{cur} x #{cidr}" if cur_addrs.any?{|cur_addr| cidr.to_range.cover?(cur_addr) }
end
@hogelog
hogelog / console
Last active July 1, 2022 05:48
AC::Parameters test
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using rake 13.0.6
Using concurrent-ruby 1.1.10
Using minitest 5.16.1
Using builder 3.2.4
Using erubi 1.10.0
Using racc 1.6.0
Using rack 2.2.4
Using nio4r 2.5.8
@hogelog
hogelog / app_test.rb
Last active July 1, 2022 05:49
Rails test
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
class ReplaceWords
attr_reader :app
def initialize(app)
@app = app
end
def call(env)
binding.irb
http_status_code, headers, body = @app.call(env)
copy(document.querySelector("#billSelectDate").innerText + "\t" + document.querySelector("#billFxAmount").innerText);
m=window.location.href.match(/bills\?year=(\d+)&month=(\d+)/);year=m[1];month=m[2];
if (month == "1") {
year -= 1;
month = 12;
} else {
month -= 1;
}
window.location.href = "https://console.aws.amazon.com/billing/home?region=ap-northeast-1#/bills?year=" + year + "&month=" + month;