Skip to content

Instantly share code, notes, and snippets.

View tdhopper's full-sized avatar
©️
𝔀𝓸𝓻𝓴𝓲𝓷𝓰 𝓱𝓪𝓻𝓭

Tim Hopper tdhopper

©️
𝔀𝓸𝓻𝓴𝓲𝓷𝓰 𝓱𝓪𝓻𝓭
View GitHub Profile
@tdhopper
tdhopper / 0_reuse_code.js
Created April 2, 2014 22:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@tdhopper
tdhopper / gist:9945559
Created April 2, 2014 23:41
Simple to YNAB
import pandas as pd
trans = pd.read_csv("2014-04-02-exported_transactions.csv", parse_dates=[0])
trans = trans[trans.Pending == False]
trans = trans[["Date","Amount","Description","Memo"]]
trans = trans.copy(deep=True)
trans["Inflow"] = trans.Amount.map(lambda x: x if x > 0 else 0)
trans["Outflow"] = trans.Amount.map(lambda x: -x if x <= 0 else 0)
del trans["Amount"]
trans["Payee"] = trans["Description"]
del trans["Description"]
@tdhopper
tdhopper / Simple to YNAB.py
Last active August 29, 2015 14:01
Script to convert exported CSV from Simple (simple.com) into a format compatible with YNAB (ynab.com).
import pandas as pd
trans = pd.read_csv("2014-05-06-exported_transactions.csv", parse_dates=[0])
trans = trans[trans.Pending == False]
trans = trans[["Date","Amount","Description","Memo"]]
trans = trans.copy(deep=True)
trans["Inflow"] = trans.Amount.map(lambda x: x if x > 0 else 0)
trans["Outflow"] = trans.Amount.map(lambda x: -x if x <= 0 else 0)
del trans["Amount"]
trans["Payee"] = trans["Description"]
del trans["Description"]
@tdhopper
tdhopper / screenshot.md
Last active August 29, 2015 14:02
Using Keyboard Maestro to paste text from your clipboard to Drafts on iOS via Pushover. The Keyboard Maestro action will send a link to Pushover that will open the text in Drafts. The amount of text you can send is limited by the Pushover API.

from warnings import warn
from collections import Counter
from streamparse.bolt import Bolt
class WordCounter(Bolt):
def initialize(self, conf, ctx):
self.counts = Counter()

Cornelius Lanczosm, H. Eves Mathematical Circles Squared

Most of the arts, as painting, sculpture, and music, have emotional appeal to the general public. This is because these arts can be experienced by some one or more of our senses. Such is not true of the art of mathematics; this art can be appreciated only by mathematicians, and to become a mathematician requires a long period of intensive training. The community of mathematicians is similar to an imaginary community of musical composers whose only satisfaction is obtained by the interchange among themselves of the musical scores they compose.

tdhopper@~/repos/parsely/ptrack/streamparse (streamparse-dev) [feature/visitor-metrics] $ streamparse stats -e 0.9 -n index
# Topology summary
+-------+----------------------+--------+------------+--------------+----------------+------------+
| name | id | status | uptime | workersTotal | executorsTotal | tasksTotal |
+-------+----------------------+--------+------------+--------------+----------------+------------+
| index | index-367-1407431678 | ACTIVE | 2h 30m 12s | 8 | 85 | 85 |
+-------+----------------------+--------+------------+--------------+----------------+------------+
# Spouts (All time)
+-----------------------+---------+-------------+-----------------+--------+--------+
| spoutId | emitted | transferred | completeLatency | acked | failed |
[
{
"_score": 1.0,
"_type": "url",
"_id": "epicurious.com-http://www.epicurious.com/recipes/food/views/Balsamic-Strawberries-with-Whipped-Mascarpone-Cheese-105321-1hour-2014.08.06.18",
"_source": {
"metrics": {
"other/returning/entrance_view": 1,
"other/$all/page_view": 2,
"$any/returning/entrance_view": 1,
path.conf: "/Users/tdhopper/es-config"
path.logs: "/Users/tdhopper/es-logs"
index.indexing.slowlog.threshold.index.warn: 10s
index.indexing.slowlog.threshold.index.info: 0s
index.indexing.slowlog.threshold.index.debug: 0s
index.indexing.slowlog.threshold.index.trace: 0s
@tdhopper
tdhopper / smooth_weight.R
Created August 30, 2014 13:56
Smooth Weight from Text File Created by IFTTT
INPUT_PATH <- "~/Dropbox/Text Notes/Weight.txt"
OUTPUT_PATH <- "~/Dropbox/Text Notes/Weight Stats.txt"
library(lubridate)
library(ggplot2)
library(zoo)
# READ FILE
con <- file(INPUT_PATH, "rt")
lines <- readLines(con)