Skip to content

Instantly share code, notes, and snippets.

View cywang117's full-sized avatar

Christina Wang cywang117

View GitHub Profile
/api/reviews/:gameid
{
steamPurchasedCount: 2500,
otherPurchasedCount: 500,
data: [
{
"id": 1,
"id_user": 628,
"user": {
@cywang117
cywang117 / word-ladder-whiteboarding-exercise
Created July 22, 2020 04:04
Word Ladder - Whiteboarding exercise - HR RPT21
// Whiteboard exercise: Word Ladder: https://leetcode.com/problems/word-ladder/description/
// NOTE: Interviewer did not progress into asking me for actual code, even though I actually
finished pseudocode halfway through my sesion. Therefore I'm selecting the 'finished core concepts'
option in Google forms.
// Input:
// beginWord = "hit",
// endWord = "cog",
// - 2D grid map of 1's & 0's - 1 = land, 0 = water (strings)
// - count number of islands
// All 4 edges of the grid are considered water
/*
Input: grid = [
["1","1","1","1","0"],
["1","1","0","1","0"],
["1","1","0","0","0"],
["0","0","0","0","0"]
@cywang117
cywang117 / gist:4a321f88e1687cdb6577b535f15a95fc
Created September 4, 2020 02:18
Implement Prefix Trie - HR Whiteboarding exercise
// prefixTrie
// Insert, search, startsWith methods
/**
let trie = new Trie();
trie.insert("apple");
trie.search("apple"); // returns true
trie.search("app"); // returns false
trie.startsWith("app"); // returns true
@cywang117
cywang117 / MariaDB+RavenDB.md
Last active September 5, 2020 19:30
Sample core DB query - MariaDB+RavenDB

MariaDB

Yes, I know it's not optimized - haven't added any indexes yet. (~11 seconds) I'm currently seeding & writing queries/tests for my other db choice, RavenDB, so the screenshot for that query might be up later.

MariaDB

RavenDB

The query is a bit simplistic while I learn RQL (Raven Query Language). Time is also not good (~5.4 seconds) - haven't added MapReduce indexes yet (and need to learn how first)

@cywang117
cywang117 / gist:eb29b9c674b6657daa26304f3d68bb24
Last active September 23, 2020 02:24
HR RPT21 V&V - Trapping Rain Water
/**
* OICE
* Input: Array of whole, positive numbers - height of structures 1 wide, array[i] tall to trap water in
* Output: whole, positive number - units of water trapped
* Edge case: [] -> 0, no structures trap water -> 0
* Constraints:
*/
/**
@cywang117
cywang117 / logs.sh
Last active April 5, 2021 08:16
Supervisor logs when purging with network alias mismatch
# Supervisor v12.5.2
# Host OS v2.68.1+rev1
# Running app: multicontainer-getting-started with extra volume defined in docker-compose.yml for frontend service
# NOTE that console.log's are added in doPurge and applicationManager.getRequired steps to track
# generated steps, and current state before applyIntermediate.
[success] Device state apply success
[event] Event: Purge data {"appId":1806459}
---NETWORK ALIASES FOR EACH SERVICE---
@cywang117
cywang117 / sv_logs
Created May 7, 2021 10:38
Supervisor logs for large image download
May 07 10:31:43 a3fdfdc systemd[1]: resin-supervisor.service: Failed to read oom_kill field of memory.events cgroup attribute: No such file or directory
May 07 10:31:43 a3fdfdc systemd[1]: resin-supervisor.service: Child 4265 belongs to resin-supervisor.service.
May 07 10:31:43 a3fdfdc systemd[1]: resin-supervisor.service: Control process exited, code=exited, status=0/SUCCESS
May 07 10:31:43 a3fdfdc systemd[1]: resin-supervisor.service: Running next control command for state start-pre.
May 07 10:31:43 a3fdfdc systemd[1]: resin-supervisor.service: About to execute: /bin/systemctl is-active balena.service
May 07 10:31:43 a3fdfdc systemd[1]: resin-supervisor.service: Forked /bin/systemctl as 4298
May 07 10:31:43 a3fdfdc systemd[4298]: resin-supervisor.service: Executing: /bin/systemctl is-active balena.service
May 07 10:31:43 a3fdfdc systemd[1]: resin-supervisor.service: Control group is empty.
May 07 10:31:43 a3fdfdc resin-supervisor[4298]: Bus n/a: changing state UNSET → OPENING
May 07 10:31:43 a3fdfdc resin-s
{
"Containers": [
{
"Id": "fdb927954562123b7bd05d6c2cf76ba6a3df36358cc65dff7f18d2886cfbe0bc",
"Name": "/cool_nobel",
"Created": "2021-06-14T14:15:57.93740194Z",
"Image": "sha256:434eb44550cbbda8b1ba784330fb61d17e06b87591672b6e9da43d179d8dc090"
},
{
"Id": "c6cf59797772cc709572f7bd461826f6112afef50be80e905324afeb5c0c1690",
{
"Containers": [
{
"Id": "90f5b7e2190d3466b755c2f8fcf673b531bdadc970476a0a2878c823dc6c3d11",
"Name": "/wizardly_payne",
"Created": "2021-06-16T02:44:09.35838872Z",
"Image": "sha256:6f6cf706a4c3478eecedd5c924e0ba85ccd4690544e987dc74fb6ba30d4c1fe2"
},
{
"Id": "da763fcf1d115900018df7d44118e432173f93705912c38e0b36e1be70e647c5",