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
# USAGE: Hash.from_xml:(YOUR_XML_STRING) | |
require 'nokogiri' | |
# modified from http://stackoverflow.com/questions/1230741/convert-a-nokogiri-document-to-a-ruby-hash/1231297#1231297 | |
class Hash | |
class << self | |
def from_xml(xml_io) | |
begin | |
result = Nokogiri::XML(xml_io) | |
return { result.root.name.to_sym => xml_node_to_hash(result.root)} |
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
#!/usr/bin/env ruby | |
# tumblr-backup.rb | |
# downloads posts and related info from your a tumblr blog | |
# and saves them to the filesystem | |
# in yaml format | |
# Requires Mark Wunsch's awesome tumblr gem : http://github.com/mwunsch/tumblr | |
require "rubygems" | |
require "tumblr" | |
require "yaml" |
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
--- | |
layout: nil | |
--- | |
<?xml version="1.0" encoding="utf-8"?> | |
<feed xmlns="http://www.w3.org/2005/Atom"> | |
<title type="text" xml:lang="en">{{ site.root_desc }}</title> | |
<link type="application/atom+xml" href="http://paulstamatiou.com/feed/" rel="self"/> | |
<link type="text" href="http://paulstamatiou.com" rel="alternate"/> | |
<updated>{{ site.time | date_to_xmlschema }}</updated> |
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
require 'cgi' | |
require 'digest/md5' | |
require 'net/https' | |
require 'uri' | |
module Jekyll | |
class GistTag < Liquid::Tag | |
def initialize(tag_name, text, token) | |
super | |
@text = text |
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
tufte.boxplot <- function(x, g) { | |
k <- nlevels(g) | |
crit.val <- tapply(x, g, median) | |
plot(1:k, crit.val, ylim=c(min(x)*1.1, max(x)*1.1), pch=19, | |
xlab=deparse(substitute(g)), ylab=deparse(substitute(x))) | |
for (i in 1:k) { | |
tmp <- boxplot.stats(x[as.numeric(g)==i]) | |
segments(i, tmp$stats[1], i, tmp$stats[2]) | |
segments(i, tmp$stats[4], i, tmp$stats[5]) | |
points(rep(i, length(tmp$out)), tmp$out, cex=.8) |
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
diff --git a/Makefile b/Makefile | |
index d481e68..0f8b4de 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -22,12 +22,12 @@ include Makefile.cfg | |
export CC = gcc -pthread | |
export CFLAGS += -I. -Wall -Os -ggdb -D_GNU_SOURCE -fPIC | |
-export LDLIBS += -lncursesw | |
+export LDLIBS += $(LDFLAGS) -lncurses -liconv |
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
#!/usr/bin/env bash | |
# fetch_nike_puls_all_activities.bash | |
# A simple bash script to fetch all activities and metrics from NikePlus. | |
# See `nike_plus_api.md` for the API details. | |
readonly bearer_token="$1" | |
if [[ -z "$bearer_token" ]]; then | |
echo "Usage: $0 bearer_token" | |
exit |
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
#!/usr/bin/env bash | |
# fetch_nike_puls_all_activities.bash | |
# A simple bash script to fetch all activities and metrics from NikePlus. | |
# See `nike_plus_api.md` for the API details. | |
readonly bearer_token="$1" | |
if [[ -z "$bearer_token" ]]; then | |
echo "Usage: $0 bearer_token" | |
exit |