Skip to content

Instantly share code, notes, and snippets.

View mishafrenkel's full-sized avatar
🎯
Focusing

Michael Frenkel mishafrenkel

🎯
Focusing
View GitHub Profile
@mishafrenkel
mishafrenkel / check_link.py
Created January 6, 2020 00:06
A simple script for testing and identifying broken links on an HTML page
@mishafrenkel
mishafrenkel / check_link.py
Created January 6, 2020 00:06
A simple script for testing and identifying broken links on an HTML page
// Initial List of Candidates
const candidates = [
['Tom Cruise', 136, 6],
['Sponge Bob', 110, 4],
['James Earl Jones', 175, 8],
['Bob Barker', 112, 2],
['Tonya Harding', 108, 7],
['Charles Barkley', 220, 12],
['Peter Piper', 116, 4],
['Harry Potter', 96, 16],
@mishafrenkel
mishafrenkel / findIndicesThatSumToTarget.js
Last active November 20, 2019 01:55
Write a function in JavaScript that accepts an array of integers and a number X as parameters, when invoked, returns an array of unique indices of two numbers whose sum is equal to X.
// Write a function in JavaScript that accepts an array of integers and a number X as parameters, when invoked, returns an array of unique indices of two numbers whose sum is equal to X.
// Example Input Arguments => [1, 3, 4, 5, 6, 8, 10, 11, 13], Sum: 14
// Example Output => [[0, 8], [1, 7], [2, 6], [4, 5]]
// Initial (naive) approach using Brute Force -> O(N^2) time-complexity
const findIndicesThatSumToTarget = (inputArray, targetValue) => {
const indicesThatSumToTarget = [];
@mishafrenkel
mishafrenkel / index.html
Created November 14, 2019 22:04
Simple React Card
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="https://use.fontawesome.com/f5ea91e308.js"></script>
<div id="app"></div>
<a class="designer-link" href="https://dribbble.com/shots/1978243-Latest-News">Design from <i class="fa fa-dribbble"></i></a>
# %% Change working directory from the workspace root to the ipynb file location. Turn this addition off with the DataScience.changeDirOnImportExport setting
# ms-python.python added
import os
try:
os.chdir(os.path.join(os.getcwd(), '08-Milestone Project - 2'))
print(os.getcwd())
except:
pass
# %% [markdown]
# # Milestone Project 2 - Solution Code
var grep = function (what, where, callback) {
var exec = require('child_process').exec;
exec("grep " + what + " " + where + " -nrH", function (err, stdin, stdout) {
var list = {}
var results = stdin.split('\n');
// remove last element (it’s an empty line)
results.pop();
@mishafrenkel
mishafrenkel / ticTacToeCL.js
Created May 15, 2019 21:35
commandLine Tic-Tac-Toe
const prompt = require('prompt');
const board = {
1: ' ',
2: ' ',
3: ' ',
4: ' ',
5: ' ',
6: ' ',
7: ' ',
✓ status was 200
✗ transaction time OK
↳ 99% — ✓ 82167 / ✗ 500
checks.....................: 99.69% ✓ 164834 ✗ 500
data_received..............: 28 MB 155 kB/s
data_sent..................: 8.3 MB 46 kB/s
http_req_blocked...........: avg=6.29µs min=1µs med=3µs max=5.08ms p(90)=4µs p(95)=4µs
http_req_connecting........: avg=2.87µs min=0s med=0s max=4.11ms p(90)=0s p(95)=0s
@mishafrenkel
mishafrenkel / K6.js
Created April 30, 2019 01:47
stressTest with K6
const http = require('k6/http');
const { check } = require('k6');
export const options = {
vus: 100,
duration: "3m"
};
export default function() {
const res = http.get("http://127.0.0.1:5000/api/stocks/AITHK");