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
# wget list of urls simultaneously with xargs, 32 at a time | |
cat list.txt | xargs -n 1 -P 32 wget -q |
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
/** | |
* There is no food in your fridge and you are hungry. You want to go to a local store and buy some food. You have to hurry as some of the shops will close soon. | |
* | |
* There are N squares in your neighborhood and M direct roads connecting them. The squares are numbered from 0 to N − 1. You are living in square 0 and can reach it in 0 seconds. The stores are located in the squares, one in each of them. You are given a map of the neighborhood in the form of four zero-indexed arrays A, B, C and D. Each of the arrays A, B, C contains M integers, while D contains N integers. | |
* | |
* For each I (0 ≤ I < M), the walking distance between squares A[I] and B[I] is C[I] seconds (in either direction). | |
* There can be multiple roads connecting the same pair of squares, or a road with both ends entering the same square. | |
* It is possible that some roads go through tunnels or over bridges (that is, the graph of squares and roads doesn't have to be planar). | |
* It is not guaranteed that you are able to reach all the squar |
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
const solution = A => { | |
let longest = 0 | |
let next = 0 | |
let count = 1 | |
while (count < A.length) { | |
let len = 0 | |
while (A[next] !== -1) { | |
len++ | |
const prev = next | |
next = A[next] |
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
/** | |
* A DNA sequence can be represented as a string consisting of the letters A, C, G and T, | |
* which correspond to the types of successive nucleotides in the sequence. Each nucleotide | |
* has an impact factor, which is an integer. Nucleotides of types A, C, G and T have impact | |
* factors of 1, 2, 3 and 4, respectively. You are going to answer several queries of the form: | |
* What is the minimal impact factor of nucleotides contained in a particular part of the given DNA sequence? | |
* | |
* The DNA sequence is given as a non-empty string S = S[0]S[1]...S[N-1] consisting of N characters. | |
* There are M queries, which are given in non-empty arrays P and Q, each consisting of M integers. | |
* The K-th query (0 ≤ K < M) requires you to find the minimal impact factor of nucleotides contained |
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
/** | |
* Given: | |
* | |
* A non-empty array A consisting of N integers is given. A pair of integers (P, Q), | |
* such that 0 ≤ P < Q < N, is called a slice of array A (notice that the slice contains | |
* at least two elements). The average of a slice (P, Q) is the sum of | |
* A[P] + A[P + 1] + ... + A[Q] divided by the length of the slice. To be precise, | |
* the average equals (A[P] + A[P + 1] + ... + A[Q]) / (Q − P + 1). | |
* | |
* Implied assumption: |
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
0x2aA23385dE61d1f754BE822a422445FDc0B3c12b |
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
const http = require('https') | |
const url = require('url') | |
const repo = process.argv[2] | |
const imagesToKeep = 5 | |
const baseUrl = `https://USERNAME:[email protected]/v2/${repo}/` | |
console.info('removing old images for repo: ', repo) | |
http.get(`${baseUrl}tags/list`, res => { | |
let body = '' | |
res.on('data', (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
resource "aws_security_group" "controller-acc" { | |
name = "kube-controller-acc" | |
vpc_id = "${aws_vpc.vpc-acc.id}" | |
tags { | |
"KubernetesCluster" = "kube-acc" | |
} | |
} | |
resource "aws_security_group" "worker-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
var stubsRegistry = {}; | |
/** | |
* Loads a module using the given stubs instead of their normally resolved required modules. | |
* @param request The requirable module path to load. | |
* @param stubs The stubs to use. e.g., { "path": { extname: function () { ... } } } | |
* @return {*} A newly resolved module with the given stubs. | |
*/ | |
Proxyquire.prototype.load = function (request, stubs) { | |
validateArguments(request, stubs); |