Skip to content

Instantly share code, notes, and snippets.

View ClintWeathers's full-sized avatar

Clint Weathers ClintWeathers

  • Target
  • Minneapolis, MN
View GitHub Profile
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active April 2, 2024 15:19
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@laurakwiley
laurakwiley / filter_datetimes.R
Created January 18, 2016 18:50
Filter Dates and Time ranges in R
ENTRY_DATE %within% new_interval(min_time, max_time)
@expersso
expersso / ldply_example
Last active August 29, 2015 14:22
Example use of ldply for web scraping
# Using ldply returns a clean data frame, so avoids
# the lapply + do.call(rbind, ...) idiom
# Also, the .progress argument is very useful
df <- ldply(c(2002:2014, 52, 26, 13, 4, 1), function(x) {
sprintf("http://distrowatch.com/index.php?dataspan=%d", x) %>%
html() %>%
html_nodes(xpath =
"//table[@class = 'News' and @style = 'direction: ltr'][2]") %>%
.[[1]] %>%
@paulochf
paulochf / ipython_notebook_large_width.py
Last active September 22, 2022 22:22
IPython/Jupyter Notebook enlarge/change cell width
from IPython.display import display, HTML
display(HTML(data="""
<style>
div#notebook-container { width: 95%; }
div#menubar-container { width: 65%; }
div#maintoolbar-container { width: 99%; }
</style>
"""))
@jennybc
jennybc / r-fcsn-in-wild-search.md
Last active January 6, 2020 08:09
Search for "natural" usage of a function across all CRAN packages

What if a function in a package has no examples? Or is poorly exampled? Wouldn't it be nice to find functioning instances of it "in the wild"?

Via Twitter, Noam Ross taught me a clever way to do such searches on GitHub. Put this into the GitHub search box to see people using the llply() function from plyr:

"llply" user:cran language:R

Or just click here.

@abresler
abresler / gist:1012f0fc103c6ef17607
Created February 5, 2015 02:14
nba_2015_random_forest_vars
library("ggthemes")
c("randomForest","dplyr","magrittr","ggplot2","ggthemes") -> packages
lapply(packages,library, character.only = TRUE)
getBREFTeamStatTable <- function(season_end = 2015, table_name = 'team', date = T){
c('rvest','dplyr','pipeR','RCurl', 'XML','reshape2') -> packages
lapply(packages, library, character.only = T)
'http://www.basketball-reference.com/leagues/' -> base
(season_end-1) %>>% paste0("-",season_end) -> season
'NBA' -> league
table_name %>>% tolower -> table_name
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# edit all commit messages
git rebase -i --root
# clone all your repos with gh cli tool
gh repo list --json name -q '.[].name' | xargs -n1 gh repo clone

Moved

Now located at https://github.com/JeffPaine/beautiful_idiomatic_python.

Why it was moved

Github gists don't support Pull Requests or any notifications, which made it impossible for me to maintain this (surprisingly popular) gist with fixes, respond to comments and so on. In the interest of maintaining the quality of this resource for others, I've moved it to a proper repo. Cheers!

@floer32
floer32 / centos_cx_Oracle
Last active January 6, 2020 23:29
CentOS 6: Set up Oracle Instant Client and Python package cx_Oracle
#!/bin/bash
# INSTALL ORACLE INSTANT CLIENT #
#################################
# NOTE: Oracle requires at least 1176 MB of swap (or something around there).
# If you are using CentOS in a VMWare VM, there's a good chance that you don't have enough by default.
# If this describes you and you need to add more swap, see the
# "Adding a Swap File to a CentOS System" section, here:
# http://www.techotopia.com/index.php/Adding_and_Managing_CentOS_Swap_Space
God, give me privileges to change with serenity
the things that cannot be changed,
Permission to change the things
which should be changed,
and the Wisdom to distinguish
the lusers from the users.
Configuring several servers at a time,
Fixing multiple issues at a time,
Accepting hardware as a pathway to Perl,
Getting, as Stallman did,