This file contains hidden or 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
docker compose down --volumes && docker compose up --build |
This file contains hidden or 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
docker compose down |
This file contains hidden or 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
docker run -d p <host-port>:<container-port> -e <name>=<value> <image-name> |
This file contains hidden or 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
def uncompress(s): | |
res = [] | |
i = 0 | |
for j in range(len(s)): | |
if s[j].isdigit(): | |
continue; | |
times = int(s[i:j]) | |
res.append(s[j] * times) | |
i = j + 1 | |
return ''.join(res) |
This file contains hidden or 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
class Node: | |
def __init__(self, val): | |
self.val = val | |
self.left = None | |
self.right = None | |
from collections import deque | |
def bottom_right_value(root): | |
queue = deque([root]) |
This file contains hidden or 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
class Node: | |
def __init__(self, val): | |
self.val = val | |
self.next = None | |
a = Node('A') | |
b = Node('B') | |
c = Node('C') | |
d = Node('D') |
This file contains hidden or 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
for (const child of [node.left, node.right]) { | |
if (child) queue.push(child); | |
} |
This file contains hidden or 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 timeout(ms, promise) { | |
let timeOutId; | |
const timeOutPromise = new Promise((_, reject)) => { | |
timeOutId = setTimeout(() => { | |
reject(new Error(`The operation timed out at ${ms} s`)); | |
}, ms) | |
} | |
return Promise.race([promise, timeOutPromise]).finally(() => { | |
clearTimeOut(timeOutId) | |
}); |
This file contains hidden or 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
/** | |
* @param {string} s | |
* @return {number} | |
*/ | |
var romanToInt = function(s) { | |
let sum = 0; | |
let remainingS = s; | |
const symbols = { |
This file contains hidden or 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
'use strict' | |
const on = Symbol('on') | |
const off = Symbol('off') | |
type switchState = typeof on | typeof off | |
function changeSwitch(switchState: switchState) { | |
switch (switchState) { | |
case on: |
NewerOlder