Skip to content

Instantly share code, notes, and snippets.

View curtisalexander's full-sized avatar

Curtis Alexander curtisalexander

  • Fort Worth, TX
  • 13:15 (UTC -05:00)
View GitHub Profile
@vdel26
vdel26 / Makefile
Last active May 19, 2016 16:44
Makefile for working with a remote Nginx
#### SETTINGS
NGINXDIR = /usr/local/openresty/nginx/
NGXCONF = nginx_dummycustomer.conf
USER = ubuntu
REMOTE = ec2-54-224-138-186.compute-1.amazonaws.com
REMOTEDIR = /home/$(USER)/dummycustomer/
PRIVATEKEY = /Users/victordg/.ssh/aws/vdg-3scale.pem
####
library(rgdal)
library(sp)
library(albersusa) # devtools::install_github("hrbrmstr/albersusa")
library(spdplyr) # devtools::install_github("mdsumner/spdplyr")
library(ggplot2) # devtools::install_github("hadley/ggplot2")
library(ggthemes)
library(rgeos)
library(purrr)
library(broom)
library(magick)
# rm -r /tmp/hmda
install.packages("MonetDBLite")
library(DBI)
dbdir <- "/tmp/hmda"
con <- dbConnect(MonetDBLite::MonetDBLite(), dbdir)
# download at http://homepages.cwi.nl/~hannes/hmda.rds
dd <- readRDS("/tmp/hmda.rds")
## Install packages if you don't already have them
install.packages(c("stringr", "igraph"), dependencies = TRUE)
## Load the packages
library(stringr)
library(igraph)
## Read in the data
queries <- read.csv("~/Downloads/queries.csv")
tables <- read.csv("~/Downloads/tables.csv")
@ttscoff
ttscoff / copy.bash
Last active September 11, 2019 14:07
Intelligently copy command results, text file, or raw input/arguments to OS X clipboard
copy() {
if [[ $1 =~ ^-?[hH] ]]; then
echo "Intelligently copies command results, text file, or raw text to"
echo "OS X clipboard"
echo
echo "Usage: copy [command or text]"
echo " or pipe a command: [command] | copy"
return
fi
@mndrake
mndrake / sas_export.py
Last active August 13, 2020 03:04
SAS dataset to sqlite wrapper of the sas7bdat python package
#!/usr/bin/python
# Filename: sas_export.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 06 18:40:09 2015
@author: David Carlson
modified version for sas7bdat 2.0.1 of Charlie Huang version at:
http://www.sasanalysis.com/2014/08/python-extension-functions-to-translate.html
"""
@dannguyen
dannguyen / EXAMPLE_WATSON_API_README.md
Last active November 23, 2020 13:32
Transcribing ProPublica podcast with Python and Watson Speech to Text API

Using IBM Watson Speech to Text API to translate a ProPublica podcast

An example of using the Watson Speech to Text API to translate a podcast from ProPublica: How a Reporter Pierced the Hype Behind Theranos

This is just a simpler demo of the same technique I demonstrate to make automated video supercuts in this repo: https://github.com/dannguyen/watson-word-watcher

The transcription takes just a few minutes (less if you parallelize the requests to IBM) and is free...but it isn't perfect by any means. It doesn't fare super well on proper nouns:

  • Charles Ornstein's last name is transcribed as Orenstein
  • John Carreyrou's last name becomes John Kerry Roo
@HQJaTu
HQJaTu / trigger-Azure-CDN-certificate-update.ps1
Created June 18, 2019 18:57
Azure CDN certificate update trigger
#Requires -Version 6.0
<#
The MIT License (MIT)
Copyright (c) 2019 Jari Turkia (jatu@hqcodeshop.fi)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@wch
wch / lmgadget.R
Created January 20, 2016 18:17
Shiny Gadget example: lmGadget
library(shiny)
# Example usage:
# lmGadget(mtcars, "wt", "mpg")
#
# Returns a list with two items:
# $data: Data with excluded rows removed.
# $model: lm (model) object.
lmGadget <- function(data, xvar, yvar) {
library(miniUI)
@cdhunt
cdhunt / map_fold.ps1
Created October 27, 2016 13:55
Map and Fold implementations in Powershell
function map([scriptblock]$map, [Collections.IEnumerable]$x, $y) { $x.ForEach({& $map $_ $y}) }
# Two parameters
map { param($x, $y) $x + $y } @(1,2,3) 10
# Anonymous function as a value
$squareIt = { param($x) $x + $x }
map $squareIt @(1,2,3)
# One parameter