Skip to content

Instantly share code, notes, and snippets.

View codegordi's full-sized avatar

C M Gutierrez codegordi

View GitHub Profile
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@dotike
dotike / try_or_die.sh
Last active July 18, 2023 20:23
3 finger claw technique for POSIX shell programming. Three one-line functions which greatly enhance shell programming, enabling reliable UNIX-style programming in an extremely concise fashion.
#!/bin/sh
##############################################################################
# This code known is distributed under the following terms:
#
# Copyright (c) 2013 Isaac (.ike) Levy <ike@blackskyresearch.net>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
import re
import pprint
import urlparse
import urllib2
#http://blog.ianbicking.org/2008/12/10/lxml-an-underappreciated-web-scraping-library/
from lxml.html import parse, tostring, fromstring #for better css selectors than Beautiful Soup
from lxml.html.diff import htmldiff
from lxml import cssselect, etree
from urlparse import urlparse
from pytz import timezone
@fredbenenson
fredbenenson / example_redshift_query.sql
Created November 20, 2013 16:56
Example Redshift Query
SELECT *
FROM
(SELECT
month,
amount,
pledge_count,
SUM(1) OVER(PARTITION BY month ORDER BY pledge_count DESC ROWS UNBOUNDED PRECEDING) as row
FROM
(SELECT
TO_CHAR(CONVERT_TIMEZONE('UTC', 'America/New_York', backings.pledged_at), 'YYYY-MM-01') as month,
@cartazio
cartazio / xcode5-haskell-directions.md
Last active May 28, 2019 00:35
xcode 5 + OS X 10.9 mavericks GHC work around nuttiness

PSA :

just use GHC for OSX https://ghcformacosx.github.io

the rest of these directions are preserved for historical purposes

TLDR version, if you have homebrew

xcode-select --install ; brew tap homebrew/versions ;   brew tap homebrew/dupes \
@cjbayesian
cjbayesian / AUC.R
Last active January 7, 2017 04:50
Calculate and plot AUC
###################################################
##
## Functions for calculating AUC and plotting ROC
## Corey Chivers, 2013
## corey.chivers@mail.mcgill.ca
##
###################################################
## Descrete integration for AUC calc
@gislars
gislars / filegdb2shp
Created July 26, 2013 13:45
Howto use gdal/ogr to access a FileGDB and convert it to shapefile
get the FileGDB API http://www.esri.com/apps/products/download/
extract it somewhere on your system and remember the path :)
mkdir build #directory where we are playing around
cd build
git clone https://github.com/OSGeo/gdal.git
cd gdal
./configure --with-fgdb=/path/to/your/FileGDB_API
make
(make install) optional, I'm just using it locally
@benmarwick
benmarwick / various_speed_tests.R
Last active January 10, 2020 19:23
Speed tests of different ways to read into R large numbers of CSV files, specifically read.csv.sql, read.csv (optimised) and fread, also of parallel processing and interactive disk storage options (filehash)
# Speed tests of different ways to read in large numbers of CSV files
# specifically read.csv.sql, read.csv (optimised) and fread
library(sqldf)
setwd("~/Downloads/wordcounts")
files <- sample(list.files(".", pattern="*.csv|CSV$"), 10000)
############# read.csv.sql ###################
system.time(
@wch
wch / server.r
Last active September 8, 2023 20:25
Shiny example: dynamic input fields
data_sets <- c("mtcars", "morley", "rock")
shinyServer(function(input, output) {
# Drop-down selection box for which data set
output$choose_dataset <- renderUI({
selectInput("dataset", "Data set", as.list(data_sets))
})
# Check boxes
@codegordi
codegordi / srapeshell.R
Created September 27, 2012 16:53 — forked from abelsonlive/srapeshell.R
# best practices for web scraping in R // ldply
# best practices for web scraping in R #
# function should be used with ldply
# eg:
ldply(urls, scrape)
# add a try to ignore broken links/ unresponsive pages
# eg: