Skip to content

Instantly share code, notes, and snippets.

View jsta's full-sized avatar
🐧
...

Jemma Stachelek jsta

🐧
...
View GitHub Profile
@DarwinAwardWinner
DarwinAwardWinner / .home-rsync-filter
Created April 29, 2011 08:12
Example rsync filter file for excluding temp files and stuff
## Rsync Filter for $HOME
# Universal excludes -- These apply to all subdirs
- [Cc]ache
- temp
- tmp
- octave-core
# Emacs temp files
- .#*
@yihui
yihui / grid-table.Rnw
Created May 25, 2012 22:26
draw a table by gridExtra in knitr
\documentclass{article}
\begin{document}
We can draw a table with the gridExtra package, and one problem is to
pre-determine the size of the table plot to remove the extra white
margin. Below is an example that shows you how to do it (courtesy of
baptiste auguie).
<<setup>>=
@coderofsalvation
coderofsalvation / sql2dot
Created July 24, 2012 11:31
sql2dot - converts sqldumps to graphiz, in order to render an image showing sql-table & relations
#!/bin/bash
# Copyright 2012, Leon van Kammen (Coder of Salvation), All rights reserved.
#
# this utility can generate database table images from sql-files.
# It converts sqldump into graphviz layout (dot) format.
# Once having a graphviz file, you can convert it to many image formats (svg/png) or view it
# interactively using canviz.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
@nikolavp
nikolavp / mail.py
Created February 25, 2013 15:55
A mail script that can move your mailman mbox files to a mysql table. You can call it with the following: ``` python3 mail.py sourc_file test mailman ``` note that this needs python3!
#!/usr/bin/env python
# vim: set sw=4 sts=4 et foldmethod=indent :
"""mbox_to_mysql: Import messages from mbox files to a mysql database """
# Mbox message handing is being done by mailbox module, which is a python core module.
# However, mbox FILE handling is done internally in this file, because the
# mailbox module does far more than we need, and takes up a lot of time to do it.
#
# Database handling is done through mysql.connector, which is not a core module;
@cboettig
cboettig / knitr_defaults.R
Last active November 30, 2022 09:16
My common knitr defaults
# My preferred defaults (may be changed in individual chunks)
opts_chunk$set(tidy=FALSE, warning=FALSE, message=FALSE, cache=TRUE,
comment=NA, verbose=TRUE, fig.width=6, fig.height=4)
# Name the cache path and fig.path based on filename...
opts_chunk$set(fig.path = paste("figure/",
gsub(".Rmd", "", knitr:::knit_concord$get('infile')),
"-", sep=""),
cache.path = paste(gsub(".Rmd", "", knitr:::knit_concord$get('infile') ),
"/", sep=""))
@ateucher
ateucher / ggplot_guides.R
Last active May 30, 2020 19:41
Manipulating ggplot2 legend with `override.aes` so points only for points, lines only for lines etc.
require(ggplot2)
set.seed(42)
df <- data.frame(x=1:50, y=rnorm(50, 10, 2), int=rbinom(50,1,0.3))
ggplot(df, aes(x=x, y=y)) +
geom_ribbon(aes(ymin=0, ymax=y, fill='#1E90FF'), alpha=0.3) +
geom_abline(intercept=10, slope=-0.1
, aes(colour='Linear')) +
  1. Plain Strings (207): foo
  2. Anchors (208): k$
  3. Ranges (202): ^[a-f]*$
  4. Backrefs (201): (...).*\1
  5. Abba (169): ^(.(?!(ll|ss|mm|rr|tt|ff|cc|bb)))*$|^n|ef
  6. A man, a plan (177): ^(.)[^p].*\1$
  7. Prime (286): ^(?!(..+)\1+$)
  8. Four (199): (.)(.\1){3}
  9. Order (198): ^[^o].....?$
  10. Triples (507): (^39|^44)|(^([0369]|([147][0369]*[258])|(([258]|[147][0369]*[147])([0369]*|[258][0369]*[147])([147]|[258][0369]*[258])))*$)
@mywarr
mywarr / AccessDump.py
Last active April 18, 2024 19:14
use mdbtools to convert .mdb to .sqlite and .csv
#!/usr/bin/env python
#
# AccessDump.py
# A simple script to dump the contents of a Microsoft Access Database.
# It depends upon the mdbtools suite:
# http://sourceforge.net/projects/mdbtools/
import sys, subprocess, os
DATABASE = sys.argv[1]
@benmarwick
benmarwick / PDF-2-text-or-CSV.r
Last active July 18, 2022 03:48
Convert PDFs to text files or CSV files (DfR format) with R
# Here are a few methods for getting text from PDF files. Do read through
# the instructions carefully! NOte that this code is written for Windows 7,
# slight adjustments may be needed for other OSs
# Tell R what folder contains your 1000s of PDFs
dest <- "G:/somehere/with/many/PDFs"
# make a vector of PDF file names
myfiles <- list.files(path = dest, pattern = "pdf", full.names = TRUE)
@Chaser324
Chaser324 / GitHub-Forking.md
Last active July 22, 2024 14:45
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j