Skip to content

Instantly share code, notes, and snippets.

View paultopia's full-sized avatar

Paul Gowder paultopia

View GitHub Profile
@wrunk
wrunk / jinja2_file_less.py
Last active September 19, 2023 15:05
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@daveray
daveray / seesaw-repl-tutorial.clj
Created December 7, 2011 04:55
Seesaw REPL Tutorial
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
@joho
joho / gist:3735740
Created September 17, 2012 05:40 — forked from rafaelss/gist:3700977
PostgreSQL 9.2 upgrade steps
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
@dsparks
dsparks / periodic_regions.R
Created October 10, 2012 16:13
Adding regions to the background of a ggplot
# Adding regions to the background of a ggplot
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("foreign", "plyr", "ggplot2", "RColorBrewer")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# House DW-NOMINATE Data: http://voteview.org/dwnominate.asp
dwNominate <- read.dta("ftp://voteview.com/junkord/HL01111E21_PRES.DTA")
# Make a re-coded party variable
@pudquick
pudquick / pipista.py
Created November 20, 2012 07:23
pipista - pip module (for installing other modules) for Pythonista
import os, os.path, sys, urllib2, requests
class PyPiError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
def _chunk_report(bytes_so_far, chunk_size, total_size):
if (total_size != None):
@mihneadb
mihneadb / hamming.clj
Created December 17, 2012 13:24
Hamming distance in Clojure
user=> (def x "AAAABCDBC")
#'user/x
user=> (def y "AABBBCCBC")
#'user/y
user=> (count (filter true? (map (partial reduce not=) (map vector x y))))
3
@aaronwolen
aaronwolen / slides.md
Last active November 11, 2022 23:57
Pandoc template to generate reveal.js slideshows.

% Title % Name % Date

My first slide

List

@wcaleb
wcaleb / iMDtoPDF.py
Last active December 29, 2020 07:52
iMDtoPDF
#! /usr/bin/env python
# -*- coding: utf-8 -*-
## iMDtoPDF.py
## by W. Caleb McDaniel
## http://wcm1.web.rice.edu
## This is a wrapper script for sending documents to Docverter
## for conversion from markdown to PDF using Pandoc. Typically
## Docverter calls are made with cURL; this script uses httplib.
@nodesocket
nodesocket / bootstrap.flatten.css
Last active April 1, 2021 23:37
Below are simple styles to "flatten" bootstrap. I didn't go through every control and widget that bootstrap offers, only what was required for https://commando.io, so your milage may vary.
/* Flatten das boostrap */
.well, .navbar-inner, .popover, .btn, .tooltip, input, select, textarea, pre, .progress, .modal, .add-on, .alert, .table-bordered, .nav>.active>a, .dropdown-menu, .tooltip-inner, .badge, .label, .img-polaroid {
-moz-box-shadow: none !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
-webkit-border-radius: 0px !important;
-moz-border-radius: 0px !important;
border-radius: 0px !important;
border-collapse: collapse !important;
background-image: none !important;
(ns async-test.timeout.core
(:require [cljs.core.async :refer [chan close!]])
(:require-macros
[cljs.core.async.macros :as m :refer [go]]))
(defn timeout [ms]
(let [c (chan)]
(js/setTimeout (fn [] (close! c)) ms)
c))