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 sys | |
from datetime import datetime, timedelta | |
import praw | |
user_agent = "hot test 1.0 by /u/dangayle" | |
r = praw.Reddit(user_agent=user_agent) | |
class SubredditLatest(object): | |
"""Get all available submissions within a subreddit newer than x.""" |
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
from __future__ import division | |
import urlparse | |
import os | |
import numpy | |
import boto3 | |
import tensorflow | |
from tensorflow.python.keras._impl import keras | |
from tensorflow.python.estimator.export.export_output import PredictOutput |
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
def getAnalytics(bucketName: String, brand: String, bucketYear: String, bucketMonth: String, bucketDay: String, candidate_field: String=candidateField, groups: String=Groups): DataFrame = { | |
var rankingOrderedIds = Window.partitionBy("c12").orderBy("id") | |
val s3PathAnalytics = getS3Path(bucketName, brand, bucketFolder, year=bucketYear, month=bucketMonth, day=bucketDay) | |
readJSON(s3PathAnalytics) | |
.distinct | |
.withColumn("x", explode($"payload")) | |
// a few more calls to withColumn to create columns | |
.withColumn("c10", explode(when(size(col("x1")) > 0, col("x1")).otherwise(array(lit(null).cast("string"))))) | |
// a few more calls to withColumn to create columns | |
.withColumn("id", monotonically_increasing_id) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="databricks-html-version" content="1"> | |
<title>working_with_random_samples - Databricks</title> | |
<meta charset="utf-8"> | |
<meta name="google" content="notranslate"> | |
<meta name="robots" content="nofollow"> | |
<meta http-equiv="Content-Language" content="en"> |
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
# source: https://stackoverflow.com/questions/37166947/copying-all-keys-in-redis-database-using-migrate | |
# make sure the redis in SOURCE_HOST and DESTINATION_HOST are identical! | |
SOURCE_HOST=127.0.0.1 | |
SOURCE_PORT=6381 | |
DESTINATION_HOST=foo.bar | |
DESTINATION_PORT=6379 |
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
docker run -it \ | |
-v $(pwd):/spark \ | |
-v /c/path/to/.m2:/root/.m2 \ | |
-v /c/path/to/.sbt:/root/.sbt \ | |
-v /c/path/to/.ivy2:/root/.ivy2 \ | |
-w /spark \ | |
--network host \ | |
openjdk:8 bash |
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
# Thanks to: https://forums.docker.com/t/accessing-host-machine-from-within-docker-container/14248/10 | |
docker run --network host \ | |
--rm \ | |
openjdk:8 bash -c "apt update; apt install net-tools; route | awk '/^default/ { print \$2 }' | grep -v 0.0.0.0" |
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
#!/bin/bash | |
# from https://unix.stackexchange.com/questions/69314/automated-ssh-keygen-without-passphrase-how | |
cat /dev/zero | | |
ssh-keygen -q -N "" |
OlderNewer