Skip to content

Instantly share code, notes, and snippets.

View alextsui05's full-sized avatar

Alex Tsui alextsui05

View GitHub Profile
@alextsui05
alextsui05 / modules_vs_concerns.rb
Created December 7, 2019 08:57
Behavior difference between modules and concerns
require 'active_support/concern'
module A
module Foo
extend ActiveSupport::Concern
included do
def foo
puts "Foo::foo"
end
@alextsui05
alextsui05 / README.md
Created February 11, 2019 02:48
Troubleshooting gh-ost on MySQL 8 on Amazon RDS

Apparently, there's a problem with using gh-ost to perform migrations on MySQL 8 running on Amazon RDS. An open issue exists on the gh-ost repository. This gist is an attempt to troubleshoot/debug the problem and gather some logs to help get to the bottom of the issue.

Test procedure

  1. Set up 5.7 and 8.0 instances of MySQL on Amazon RDS, configured with row-based binlog format and 24-hour binlog retention
  2. Use gh-ost to migrate a table directly on master. Delay cutover and inspect gh-ost's replication behavior.

The version of gh-ost used is the 1.0.47 release.

@alextsui05
alextsui05 / jquery-release-notes.md
Last active February 25, 2018 23:36 — forked from teppeis/jquery-release-notes.md
jQuery Release Notes
@alextsui05
alextsui05 / 2017-07-11_without-headphones.log
Created July 11, 2017 22:48
With cubeb:5, this time with headphones unplugged
2017-07-11 22:45:20.909000 UTC - [Main Thread]: D/MediaManager mozilla::MediaManager::MediaManager: default prefs: 0x0 @30fps (min 10), 1000Hz test tones, aec: on,agc: off, noise: on, aec level: 1, agc level: 1, noise level: 1,playout delay: 40, full_duplex, extended aec on, delay_agnostic on
2017-07-11 22:45:20.911000 UTC - [Main Thread]: D/MediaManager New Media thread for gum
2017-07-11 22:45:21.172000 UTC - [Unnamed thread 1A1C8A70]: E/cubeb c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/media/libcubeb/src/cubeb_wasapi.cpp:150: COM was already initialized in MTA
2017-07-11 22:45:21.172000 UTC - [Unnamed thread 1A1C8A70]: E/cubeb c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/media/libcubeb/src/cubeb.c:482: DeviceID: "{0.0.1.00000000}.{1ab0f371-8202-4250-a349-ad111ce14a0e}"
Name: "Stereo Mix (Realtek High Definition Audio)"
Group: "HDAUDIO\FUNC_01&VEN_10EC&DEV_089
2017-07-11 22:45:21.172000 UTC - [Unnamed thread 1A1C8A70]: E/cubeb c:/builds/moz2_slave/m-rel-w32-0000000000000
2017-07-11 22:39:18.395000 UTC - [Main Thread]: D/MediaManager mozilla::MediaManager::MediaManager: default prefs: 0x0 @30fps (min 10), 1000Hz test tones, aec: on,agc: off, noise: on, aec level: 1, agc level: 1, noise level: 1,playout delay: 40, full_duplex, extended aec on, delay_agnostic on
2017-07-11 22:39:18.396000 UTC - [Main Thread]: D/MediaManager New Media thread for gum
2017-07-11 22:39:18.925000 UTC - [Unnamed thread 0CF3CDA0]: E/cubeb c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/media/libcubeb/src/cubeb_wasapi.cpp:150: COM was already initialized in MTA
2017-07-11 22:39:18.925000 UTC - [Unnamed thread 0CF3CDA0]: E/cubeb c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/media/libcubeb/src/cubeb.c:482: DeviceID: "{0.0.1.00000000}.{1ab0f371-8202-4250-a349-ad111ce14a0e}"
Name: "Stereo Mix (Realtek High Definition Audio)"
Group: "HDAUDIO\FUNC_01&VEN_10EC&DEV_089
2017-07-11 22:39:18.925000 UTC - [Unnamed thread 0CF3CDA0]: E/cubeb c:/builds/moz2_slave/m-rel-w32-0000000000000
@alextsui05
alextsui05 / laptop-mic.log
Created June 22, 2017 00:22
verbose logs - Firefox getUserMedia test
2017-06-21 23:51:57.775000 UTC - [Main Thread]: D/MediaManager mozilla::MediaManager::MediaManager: default prefs: 0x0 @30fps (min 10), 1000Hz test tones, aec: on,agc: off, noise: on, aec level: 1, agc level: 1, noise level: 1,playout delay: 40, full_duplex, extended aec on, delay_agnostic on
2017-06-21 23:51:57.775000 UTC - [Main Thread]: D/MediaManager New Media thread for gum
2017-06-21 23:51:58.362000 UTC - [Unnamed thread 0E9F1250]: D/GetUserMedia Cubeb device 0: type 0x1, state 0x2, name Stereo Mix (Realtek High Definition Audio), id 134DD740
2017-06-21 23:51:58.362000 UTC - [Unnamed thread 0E9F1250]: D/GetUserMedia Cubeb device 1: type 0x1, state 0x0, name (null), id 134DD7C0
2017-06-21 23:51:58.362000 UTC - [Unnamed thread 0E9F1250]: D/GetUserMedia Cubeb device 2: type 0x1, state 0x2, name Microphone (HD Webcam C310), id 134DD840
2017-06-21 23:51:58.362000 UTC - [Unnamed thread 0E9F1250]: D/GetUserMedia Cubeb device 3: type 0x1, state 0x0, name MIDI (Intel WiDi Audio Device), id 134DD8C0
2017-06-21 23
@alextsui05
alextsui05 / first_three_digits.rb
Created February 13, 2017 03:36
Truncate to three significant digits
def first_three_digits(num)
size = num.to_s.size
digits = num.to_s[0, 3].to_i
digits * 10 ** (size - digits.to_s.size)
end
[1, 12, 123, 1234, 12345, 123456, 1234567, 12345678, 123456789].each do |i|
puts first_three_digits(i)
end
@alextsui05
alextsui05 / frequencysort.coffee
Created December 21, 2016 05:58
frequencysort
frequencySort = (s) ->
d = {}
for ch in s
if ch of d
d[ch]++
else
d[ch] = 1
console.log d
l = [[k, v] for k, v of d]
@alextsui05
alextsui05 / cmd.log
Last active February 11, 2016 23:06
can't make tuple of atomic with g++
g++-5 -std=c++14 test.cpp
@alextsui05
alextsui05 / diagonal.edges
Created September 26, 2015 00:19
Sprocket triangle mesh with diagonal edge metadata
0 13
1 14
2 15
3 4027
10 16
13 17
14 18
15 4026
11 19
19 17