Skip to content

Instantly share code, notes, and snippets.

View svlapin's full-sized avatar
👨‍🎓
learning

Sergey Lapin svlapin

👨‍🎓
learning
View GitHub Profile
class Solution:
def copyRandomList(self, head: 'Optional[Node]') -> 'Optional[Node]':
old_to_new = {}
def clone_node(node):
if not node:
return None
if node in old_to_new:
return old_to_new[node]
new_node = Node(node.val)
#!/bin/sh
# Reads list of domain names from either stdin or from a filename provided,
# retrieving DNS records for each.
# Prints results to stdout.
while read line
do
dig $line ANY +noall +answer
done < "${1:-/dev/stdin}"

Keybase proof

I hereby claim:

  • I am svlapin on github.
  • I am svlapin (https://keybase.io/svlapin) on keybase.
  • I have a public key ASCPHBlBshLF2M1DdE7sBUtr3_nEDR7E-cbFESahP68ndAo

To claim this, I am signing this object:

package rndimage
import (
"image"
"image/color"
"math/rand"
"sync"
)
const numWorkers = 10
@svlapin
svlapin / git_stubbed.js
Created November 3, 2017 16:15
An example on how to stub git-js methods
const sinon = require('sinon');
const Git = require('simple-git/src/git');
const git = require('simple-git/promise');
sinon.stub(Git.prototype, '_run').callsFake(function (command, cb) {
console.log('called command', command)
// to indicate success
cb.call(this, null, 'any message');