This file contains 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
(() => { | |
// Async function helper | |
var createAsyncPromise = (context, args, asyncFn) => new Promise((resolve, reject) => { | |
var handleNext = result => { | |
try { | |
handleResult(asyncFn.next(result)) | |
} catch (error) { | |
reject(error) | |
} | |
}; |
This file contains 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 'redis' # gem install redis (4.8.x in my case) | |
15.times.each do |db| | |
redis = Redis.new(url: "redis://localhost/#{db}") # or whatever | |
total = 0 | |
redis.scan_each.each do |key| | |
size = redis.send(:send_command, [:memory, :usage, key]) | |
total += size | |
# puts " DB#{db} #{key} => #{size}b" |
This file contains 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
{ | |
"AF": "##-###-####", | |
"AX": "(###)###-##-##", | |
"AL": "(###)###-###", | |
"DZ": "##-###-####", | |
"AS": "(684)###-####", | |
"AD": "###-###", | |
"AO": "(###)###-###", | |
"AI": "(264)###-####", | |
"AQ": "1##-###", |
This file contains 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 'rails_helper' | |
RSpec.describe SomeController, type: :controller do | |
context 'turbo' do | |
include_context 'turbo_requests' | |
it 'should be successful' do | |
post :action | |
expect(response).to be_successful |
This file contains 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
# Auto delete pods with status.phase=Failed via CronJob | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: sa-auto-delete-failed-pods | |
namespace: kube-system | |
--- | |
kind: ClusterRole |
This file contains 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 | |
# Setup your projets and zones | |
SRC_PRJ="company-staging" | |
SRC_ZONE="northamerica-northeast1-b" | |
DST_PRJ="company-production" | |
DST_ZONE="us-central1-b" | |
DISKS="$@" | |
This file contains 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
function aws-s3-du() { | |
local buckets=$@ | |
if [ -z "$buckets" ]; then | |
buckets=$(aws s3 ls | awk '{print $3}') | |
fi | |
for bucket in $buckets; do | |
echo -ne "${bucket}\t\t" | |
aws s3 ls s3://${bucket} --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024/1024" GB"}' | |
done | |
} |
This file contains 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
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see https://i3wm.org/docs/userguide.html for a complete reference! |
This file contains 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 | |
TOKEN="xxxxxxxxxxxxxxxxxxx" | |
ZONE_ID=2222222222222222222222222 | |
# [email protected] | |
# KEY=11111111111111111111111111 | |
# Replace with | |
# -H "X-Auth-Email: ${EMAIL}" \ | |
# -H "X-Auth-Key: ${KEY}" \ |
This file contains 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
Ruby | |
принципиальное различие скриптовых и “обычных” языков | |
3 принципа ООП | |
реализация множественного наследования в ruby | |
duck typing | |
многопоточность в ruby | |
Rails | |
что такое MVC и зачем это нужно | |
локига в контроллере, должна ли быть и почему | |
синхронные и асинхронные операции — предложить варианты решения |
NewerOlder