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
# Argument Parser that prints its help message by default | |
import argparse | |
import sys | |
class HelpDefaultParser(argparse.ArgumentParser): | |
def error(self, message): | |
sys.stderr.write('error: %s\n' % message) | |
self.print_help() | |
sys.exit(2) |
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
# Place this in your bashrc | |
function hlog { | |
git log --date-order --all --graph --format="%C(green)%h %Creset%C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset %s" $@ | |
} | |
alias hl="hlog" |
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([ | |
{ |
- 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
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
from IPython.lib.display import Audio | |
import numpy as np | |
framerate = 4410 | |
play_time_seconds = 3 | |
t = np.linspace(0, play_time_seconds, framerate*play_time_seconds) | |
audio_data = np.sin(2*np.pi*300*t) + np.sin(2*np.pi*240*t) | |
Audio(audio_data, rate=framerate, autoplay=True) |
OlderNewer