###Transform RDD to DataFrame in Spark
from pyspark.sql import Row
import os
rdd = sc.textFile('C:/Users/chao.huang.ctr/spark-playground//class.txt')
def transform(x):
args = x.split()
funcs = [str, str, int, float, float]
###Transform RDD to DataFrame in Spark
from pyspark.sql import Row
import os
rdd = sc.textFile('C:/Users/chao.huang.ctr/spark-playground//class.txt')
def transform(x):
args = x.split()
funcs = [str, str, int, float, float]
#!/usr/bin/env python | |
from random import randint | |
from fileinput import input | |
from argparse import ArgumentParser | |
from sys import stdout | |
# "data set of leet unicode chars" stolen from | |
# Tchouky's Zalgo Generator on eeemo.net | |
###Hotlinking madness :^) | |
$HTTP["host"] =~ "charltontrezevant\.com" { | |
$HTTP["referer"] !~ "charltontrezevant|ctis\.me|google|bing|facebook|twitter|reddit|ycombinator|Skype|Slack" { | |
$HTTP["useragent"] !~ "Google|msnbot|FlipBoard|Bing|Yahoo|Facebook|Yandex|twitter|Slack|Skype" { | |
$HTTP["url"] =~ "\.jpeg|\.jpg|\.png|\.gif|\.bmp" { | |
$HTTP["url"] !~ "hotlinking\.png" { | |
url.redirect = ("" => "https://www.charltontrezevant.com/resources/images/hotlinking.png") | |
} | |
} | |
} |
This is an example of creating a PNG from an SVG. (You should notice that you're able to right click on the last image and save it as a PNG image.) It has been Tested in Firefox and Chrome but doesn't work in Safari as of 2014-07-20.
Normally, you'll create your SVG in D3 but to make the example a bit more readable, the SVG is already placed in the document. There are a few important points. Namely:
<defs>
tags. (These styles should be escaped using the <![[CDATA[ ... ]]
tag.)Note: Portions of this demo where taken from The New York Times' excellent Crowbar SVG extractor.
#!/usr/bin/env python2 | |
'''Serving dynamic images with Pandas and matplotlib (using flask).''' | |
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
from cStringIO import StringIO |
#!/usr/bin/python | |
# # # # # # # # # # # # # # # # # # # # | |
# # | |
# Script was made by Dennis # | |
# http://stefansundin.com/blog/452 # | |
# http://pastebin.com/8cw9LHFg # | |
# # | |
# # # # # # # # # # # # # # # # # # # # | |
Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.
Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis path, | |
.axis line { |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Output Elevation, Lat, Long, and Timestamp series from GPX to CSV | |
Requires gpxpy | |
This script expects your input GPX to be located in a subdir named 'data' | |
""" | |
import os |
#!/bin/bash | |
# usage: nbgrep 'pattern' | |
SEARCHPATH=~/work/ | |
# 'jq' technique lifted with gratitude | |
# from https://gist.github.com/mlgill/5c55253a3bc84a96addf | |
# Break on newlines instead of any whitespace |