from pyspark.sql.types import TimestampType
data = data.withColumn('status_updated', data['status_updated'].cast(TimestampType()))
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
ITERATING=0 | |
MASTER_ONLY=0 | |
if [ $ITERATING -ne 1 ] | |
then | |
git diff-index --quiet HEAD | |
if [ $? -ne 0 ] | |
then | |
echo "!!! There are untracked changes. You must commit before running this script." | |
echo "Will not allow running until you resolve the following files:" | |
echo |
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/sh | |
for arg; do | |
realarg="$(realpath "$arg")" | |
case "$realarg" in | |
/|/usr|/var|/etc|/home|/bin|/lib|/lib64|/boot|/opt|/media|/root) | |
echo "refusing to remove $realarg" 1>&2 | |
exit 100 | |
;; |
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
const request = require('request'); | |
const SLACK_TOKEN = "INSERT-TOKEN"; | |
const TARGET_CHANNEL = "INSERT-CHANNEL"; // Ex @user, general | |
const data = { | |
"token": SLACK_TOKEN, | |
"channel": TARGET_CHANNEL, | |
"attachments": JSON.stringify([ | |
{ |
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 print | |
# Adopted from | |
# https://web.archive.org/web/20111010015624/http://blogmag.net/blog/read/38/Print_human_readable_file_size | |
# https://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size | |
def sizeof_fmt(num, suffix='B'): | |
for unit in ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z']: | |
if abs(num) < 1024.0: | |
return "%3.1f%s%s" % (num, unit, suffix) |
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 | |
import io | |
import os | |
import csv | |
from glob import glob | |
DEFAULT_OUTPUT_NAME = 'word-counts.csv' | |
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 get_calling_file_name(): | |
# If this function is embedded in another function, offset the stack appropriately | |
import inspect | |
stack_offset = 1 | |
stack = inspect.stack() | |
calling_file = stack[stack_offset][1] | |
return calling_file |
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
# Instructions for setting up a virtualenv venv | |
######### | |
# SETUP # | |
######### | |
## Make sure you have python3 | |
python3 --version |
- Avoid eating at convenience stores as much as possible. The food is good, but you can get similarly priced food that is much better at any restaurant you might walk into.
- Bring cash. Credit cards only became a thing about 6 years ago.
- Police officers have very little to do, so if you're lost, use them for directions.
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
Host target-repo-name.github.com | |
HostName github.com | |
User git | |
IdentityFile /home/ec2-user/.ssh/target-repo-name | |
IdentitiesOnly yes |
OlderNewer