Skip to content

Instantly share code, notes, and snippets.

View hkdsun's full-sized avatar
❤️
Spreading love

Hormoz Kheradmand hkdsun

❤️
Spreading love
View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTqNJb+yIG1Os1BZhTkW3NMhAtXJYYZ1B9STmO+sXnUt+5BaS/ZuPODi+2cg2ARGK2te28QRJRveSJsP4/HYyibt+4Y90Kj49UyyRYgZvX8QZCCecnpGSi7dKA3REl0KdcIhqdIs5MwohDivYVssQTTo8Efys2hIwnNpctZjo5StlW9XfdiLZ2SKzg9uDD2o+KTV5UKnkPcEXSs4E9N75hmYHtZ0Kq6+ndJcwG4msagaDmaYbJR+cyjSexvgWwv382v812IZHvpXV+pWhrrk7iHwJ7uvASftboKGlR0myGLPlNj3JoC92sDRMniphiODDtgT7RPXFiOXYRKH9EovvN hkheradm@gmail.com
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7T3qu4uKOtsg6wK2Dn27W460hPWcMm2+sgwI7hUZ4Fq/qxJVJm2N/1dkmzf2vHNkj9ABZ+dzD6R5S54lcrRzOEab7kjkInb21TU9+W4+91+EvdsfyEOvxX7WyRGuiYdnSmUB17pcKA7gCnBHYXi0UlwIsXNoLoS+2HaGOaatgOw== hormoz@h8pc
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDOXDIKWCD4J6kfyhj2R6mTe2RFoGQb0HtlX+8mIbOZ1gAXM25t+/I/7GD9qO6MERywuYuO0HjYunozaiGA06Xf051ny1k0mgOjDIe9cIiXWJE8BDattqk5D2DVMzKPHLlQCozyBRbo1T7scndipjodE9nrm+rKyQ4Vqu+zYiZRuaefWCl5RVJHH+gmciYsguKum/jkSgOGRh/5V8mRbmNFXj/LQOjCUgiEz1WJjGdNbQjqXFjnI/SsLQlmNBfbUj1l9vW3I6yjWUyb1ldgW1NmN0rpa9z5udpPgqvaMNvwgp4Kp5l3+CG/wVeaIIfrM4mgJIRAjsjCJ7+dLFNTH6FB hormoz@h8pc.local
@hkdsun
hkdsun / switch_displays.ahk
Last active July 18, 2023 05:09
switch_displays.ahk
#Include Monitor.ahk
DllCall("Kernel32.dll\LoadLibrary", "Str", "Dxva2.dll", "Ptr")
getMonitorHandles()
{
hMon := DllCall("MonitorFromPoint"
, "int64", 0x00000001
, "uint", 1) ; flag to return primary monitor on failure
ACL    ; /debug/acl                      ; https://github.com/vitessio/vitess/blob/v14.0.0/go/vt/vttablet/tabletserver/query_engine.go#L545
ACL    ; /debug/consolidations           ; https://github.com/vitessio/vitess/blob/v14.0.0/go/vt/vttablet/tabletserver/query_engine.go#L567
ACL    ; /debug/env                      ; https://github.com/vitessio/vitess/blob/v14.0.0/go/vt/vttablet/tabletserver/debugenv.go#L57
ACL    ; /debug/health                   ; https://github.com/vitessio/vitess/blob/v14.0.0/go/vt/vttablet/tabletserver/tabletserver.go#L1598
ACL    ; /debug/hotrows                  ; https://github.com/vitessio/vitess/blob/v14.0.0/go/vt/vttablet/tabletserver/txserializer/tx_serializer.go#L327
ACL    ; /debug/query_rules              ; https://github.com/vitessio/vitess/blob/v14.0.0/go/vt/vttablet/tabletserver/query_engine.go#L529
ACL    ; /debug/query_stats              ; https://github.com/vitessio/vitess/blob/v14.0.0/go/vt/vttablet/tabletserver/query_engine.go#L503
ACL    ; /debug/schema        
# This file is executed immediately after mysql_install_db,
# to initialize a fresh data directory.
###############################################################################
# Equivalent of mysql_secure_installation
###############################################################################
# Changes during the init db should not make it to the binlog.
# They could potentially create errant transactions on replicas.
SET sql_log_bin = 0;
# Remove anonymous users.
DELETE FROM mysql.user WHERE User = '';
# The following example is minimalist. The security policies
# and resource specifications are not meant to be used in production.
apiVersion: planetscale.com/v2
kind: VitessCluster
metadata:
name: solidus
spec:
images:
vtctld: vitess/lite:v8.0.0
vtgate: vitess/lite:v8.0.0
@hkdsun
hkdsun / vitess_rails.rb
Created February 19, 2021 16:35
Vitess Rails patches
require 'active_record/connection_adapters/mysql2_adapter'
module VitessRails
module Patches
module PrependMasterKeyspace
def table_name
raise "A keyspace needs to be provided for internal rails metadata" unless @keyspace
"#{@keyspace}.#{super}"
end
diff --git c/Gemfile w/Gemfile
index c96f2d6..9fae90d 100644
--- c/Gemfile
+++ w/Gemfile
@@ -6,7 +6,7 @@ ruby '2.7.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.1'
# Use sqlite3 as the database for Active Record
-gem 'sqlite3', '~> 1.4'
+gem 'mysql2'
@hkdsun
hkdsun / ok.rb
Last active October 30, 2020 17:47
require 'json'
suffixes = %w(ahwi8l eefei2 theu4d ueng9m hoot3k quach7 weesh5 phey8v ahsh6s xoh3ee abegh8
la0tei ii2ohm ahz4bi oiban5 jeiz3i ui2cho aidee3 maghu3 om1tah foo5ui enu7ih
cho6pu mau2vi pai9ka ughan6 phe9th eej4ja wie6ei xeeb5r tha7ei meip5z shie4e
oosi4g dee9ub eizoh5 hosai5 bue0ii oov0ec oe7zei yei7ph quut0i baij2g kaep6l
aid6iv aim0ra heeth8 xah3fe soh1ae ohzai1 ahgoo8 moh9uo zei5ae ko8lij sach3w
lohv1h meek2e gen3ee ho1uho cie5sh dah7mi aech7a chi6ah duboh4 phef7m eihis7
rolee4 johc4o nee8ae di6ief eiph5a ulut7h mat8ae eikoo4 oe1iez aed1ux iek1gi
ejee6x ga2sho eib4lo dei1ie thi0qu vo5vo3 ing1li chu6ae eev2yu athoh0 iv7xoh
require 'json'
fixture = "test/fixtures/pipeline_multi_stage_by_region_with_custom_options.json"
pipelines = JSON.load(File.read(fixture))
pipelines.each do |p|
puts p['block'] if p['block']
puts p['name'] if p['name']
puts "WAIT STEP" if p['wait']
@hkdsun
hkdsun / ok.rb
Last active October 30, 2020 10:48
require 'json'
suffixes = %w(ahwi8l eefei2 theu4d ueng9m hoot3k quach7 weesh5 phey8v ahsh6s xoh3ee abegh8
la0tei ii2ohm ahz4bi oiban5 jeiz3i ui2cho aidee3 maghu3 om1tah foo5ui enu7ih
cho6pu mau2vi pai9ka ughan6 phe9th eej4ja wie6ei xeeb5r tha7ei meip5z shie4e
oosi4g dee9ub eizoh5 hosai5 bue0ii oov0ec oe7zei yei7ph quut0i baij2g kaep6l
aid6iv aim0ra heeth8 xah3fe soh1ae ohzai1 ahgoo8 moh9uo zei5ae ko8lij sach3w
lohv1h meek2e gen3ee ho1uho cie5sh dah7mi aech7a chi6ah duboh4 phef7m eihis7
rolee4 johc4o nee8ae di6ief eiph5a ulut7h mat8ae eikoo4 oe1iez aed1ux iek1gi
ejee6x ga2sho eib4lo dei1ie thi0qu vo5vo3 ing1li chu6ae eev2yu athoh0 iv7xoh