Skip to content

Instantly share code, notes, and snippets.

aodin

Block or report user

Report or block aodin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View matplotlib-whitespace-svg.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>SVG whitespace example</title>
</head>
<body>
<p style="max-width:100px;border:1px solid red">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
@aodin
aodin / quarter.py
Last active Sep 23, 2018
Python 3 datetime.date subclass
View quarter.py
import copy
import datetime
import pickle
# Each quarter corresponds to the following month and day combinations:
_q1 = (3, 31)
_q2 = (6, 30)
_q3 = (9, 30)
_q4 = (12, 31)
@aodin
aodin / onion.sql
Created Dec 16, 2016
Onion SQL Schema
View onion.sql
CREATE TABLE things_versioned (
id integer not null,
name varchar not null,
version timestamp with time zone default now(),
PRIMARY KEY (id, version)
)
CREATE VIEW things AS
SELECT
DISTINCT ON (id)
@aodin
aodin / sql_benchmark.go
Created Dec 16, 2016
SQL Benchmark Test for Go
View sql_benchmark.go
package main
import (
"database/sql"
"encoding/json"
"log"
"net/http"
"os"
"time"
@aodin
aodin / sql_results.go
Created Dec 16, 2016
Go's SQL Results Must Be Closed
View sql_results.go
package main
import "database/sql"
import "log"
import _ "github.com/lib/pq"
func main() {
conn, err := sql.Open("postgres", "user=aaronoellis dbname=bar sslmode=disable")
if err != nil {
log.Fatal(err)
@aodin
aodin / fabfile.py
Created Jul 14, 2016 — forked from arikfr/fabfile.py
re:dash fabfile
View fabfile.py
#!/usr/bin/env python
# vim: ts=4:sw=4:expandtab:autoindent:
import os
import sys
import requests
import filecmp
from fabric.context_managers import hide, settings, prefix
from fabric.api import sudo, task, run, cd, env
from fabric.contrib.console import confirm
from fabric.colors import green
@aodin
aodin / gamma.jl
Created Apr 26, 2016
Plotting the Gamma distribution sampling from it as a normalized histogram
View gamma.jl
# Plotting the Gamma distribution and sample as a normalize histogram
using Distributions
using Gadfly
pdf(d::Gamma, x) = (x ^ (d.α - 1) * e ^ (-x / d.α)) / (d.θ ^ d.α * gamma(d.α))
n = 500
g = Gamma(2., 2.)
View gn.coffee
# Description:
# Get the top news item from HN
#
# Commands:
# hubot hn - Return the top item on HN
module.exports = (robot) ->
robot.respond /hn( me)?$/i, (msg) ->
story = hnTopStory(msg)
console.log story
View gist:9824698
package main
import (
"log"
"sync"
"time"
)
// Global wait group
var jobs sync.WaitGroup
@aodin
aodin / gist:9493340
Created Mar 11, 2014
Insert to PostGres
View gist:9493340
package main
import (
"database/sql"
"log"
_ "github.com/lib/pq"
)
func connect(driver string, credentials string) *sql.DB {
You can’t perform that action at this time.