This file contains 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
=begin | |
3,5,2,7,1 | |
3 | |
2 5 | |
1 7 | |
=end |
This file contains 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
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"sync" | |
"time" | |
"strings" | |
"runtime" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 re | |
def expand_hadoop_path(path): | |
brace_patterns = re.findall('{{[^}]+}}', path) | |
brace_patterns_values = [(brace_pattern, brace_pattern.replace('{{','').replace('}}','').split(',')) for brace_pattern in brace_patterns] | |
replacements = [] | |
for (brace_pattern, values) in brace_patterns_values: | |
if replacements: |
This file contains 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 os | |
import boto3 | |
import subprocess | |
import configargparse | |
SSH_USER = 'hadoop' | |
SSH_TEMPLATE = 'ssh -o StrictHostKeyChecking=no -i {ssh_key} {ssh_user}@{host} "{cmd}"' | |
SSH_KEY_PATH = os.path.expanduser('~/.ssh') | |
def find_ssh_key(emr, config): |
This file contains 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 requests._ | |
import org.json4s._ | |
import org.json4s.jackson.{JsonMethods => Json} | |
import org.json4s.JsonDSL.WithBigDecimal._ | |
import scala.concurrent._ | |
import scala.concurrent.duration._ | |
// import ExecutionContext.Implicits.global | |
import java.lang.Runtime |
This file contains 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
// Permutations are using all elements in the sequence | |
import scala.collection.mutable.ArrayBuffer | |
// Mutable version | |
def permutationsM[T](s: Seq[T]): Seq[Seq[T]] = { | |
if (s.length < 2) { | |
Seq(s) | |
} | |
else if (s.length == 2) { |