Skip to content

Instantly share code, notes, and snippets.

View shiawuen's full-sized avatar

Tan Shiaw Uen shiawuen

View GitHub Profile
require 'open3'
command = "tail"
target = "x" * 65535
out = ""
Open3.popen3(command) do |stdin, stdout, _|
stdin.puts target
stdin.close
out = stdout.read
@shiawuen
shiawuen / Samsung Browser
Created July 20, 2017 05:06 — forked from NielsLeenheer/Samsung Browser
Samsung Browser
Note: Some older devices such as the Galaxy S III did not get the Chromium based browser with
the update to Android 4.2 or later. When Samsung later introduced the Galaxy S3 Neo it did get
the new browser.
Note: With the Android 4.3 release and version 1.5 of the Chromium browser, Samsung did not
enable WebAudio API for the Note 3. All other devices did get the WebAudio API.
Note: Samsung did not update the browser version with the upgrade from Android 4.3 to 4.4,
but did add getUserMedia and WebRTC functionality.
@shiawuen
shiawuen / index.ts
Last active June 12, 2020 14:59
Example to extract type from argument with generic types
// Given type definition below
interface IQueryType { params: any, result: any }
class Query<T extends IQueryType> {
run: (params: T['params']) => T['result']
}
// If we need to have our DB acquire connection
// and then release the after query, it can
// then be done in this way
const createDbQuery = (dbPool: Pool) => <P, R> (