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
.root___1Rh2d { | |
padding: .5rem 1rem .5625rem; | |
border: none; | |
color: #fff; | |
font-size: larger; | |
cursor: pointer; | |
border-radius: 1.25rem; | |
border: 2px solid #900 | |
} |
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
async function queryGoogle(target) { | |
const page = await browser.newPage(); | |
await page.goto('https://google.com'); | |
await page.keyboard.type(target + " MSA") | |
await page.keyboard.press("Enter") | |
await page.waitForNavigation(); | |
await page.content() | |
const title = await page.evaluate(() => { | |
let elements = document.querySelectorAll('h3'); | |
return elements[0].textContent; |
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
dfs (remainCoins, target): | |
if target === 0: | |
# calculate what coins you used here | |
usedCoin = ... | |
results.append(usedCoin) | |
return | |
if target < 0: | |
return | |
for coin in remainCoins: |
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
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |
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
import sys | |
import numpy as np | |
from scipy.cluster.hierarchy import dendrogram, linkage | |
import matplotlib.pyplot as plt | |
def minidistance(S1, S2) : | |
N = len(S1) | |
M = len(S2) | |
matrix = np.zeros((N + 1, M + 1), dtype=int) #Build an alignment matrix | |
matrix[0][0] = 0 |
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
from scipy import fftpack | |
import imageio | |
import numpy | |
# load in an image, convert to grayscale if needed | |
image = imageio.imread('ft/input.png', as_gray=True) | |
# take the fourier transform of the image | |
fft2 = fftpack.fftshift(fftpack.fft2(image)) |
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 get_next_status_set(status): | |
ret = [] | |
status_len = len(status) | |
for i in range(status_len - 1): | |
if status[i] == '1' and status[i + 1] == '0': | |
new = status[:] | |
new[i] = '0' | |
new[i + 1] = '1' | |
ret.append(''.join(new)) | |
# handl the last case |
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 TreeNode: | |
def __init__(self, x): | |
self.val = x | |
self.left = None | |
self.right = None | |
class Solution: | |
def isUnivalTree(self, root): | |
""" | |
:type root: TreeNode |
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 fact1(n): | |
acc = 1 | |
for i in range(n): | |
# print(acc, i + 1) | |
acc *= (i + 1) | |
return acc |
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
seq = ['A', 'B', 'C'] | |
current = [] | |
next = [] | |
for char in seq: | |
for c in current: | |
next.append(c + char) | |
next.append(char + c) | |
next.append(char) | |
current = current + next |
NewerOlder