Skip to content

Instantly share code, notes, and snippets.

@nk9
nk9 / largestFiles.py
Last active November 14, 2023 09:47
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
@tpoisot
tpoisot / credentials.json
Last active August 29, 2015 14:05
Use with ./get_tweets.py 10 3 test.json openscience opendata
{
"c_key": "ConsumerKey",
"c_sec": "ConsumerSecret",
"t_key": "TokenKey",
"t_sec": "TokenSecret"
}
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@karawoo
karawoo / data.csv
Last active June 29, 2016 20:19
Reading in CSVs with headers on multiple rows
B0S2 B0S3 B0S4
abundance percent cover height abundance percent cover height abundance percent cover height
5 50 71 8 30 9 45
5 3 47 1 1
library(ggplot2)
library(grid)
my_axis <- function(low="low", high="high", axis=c("x", "y"), ...){
axis <- match.arg(axis)
if(axis == "x"){
g1 <- textGrob(low, x=unit(0,"npc"), hjust=0)
g3 <- textGrob(high, x=unit(1,"npc"), hjust=1)
@valentinitnelav
valentinitnelav / Plot inwards ticks - ggplot.R
Last active October 7, 2021 13:14
Plot with inwards ticks - ggplot
# ==========================================================================
# Example of plot for publication with inwards ticks in ggplot
# ==========================================================================
library(ggplot2)
# ==================================
# create some data
# ==================================
set.seed(1)
@magnetikonline
magnetikonline / README.md
Last active June 22, 2024 06:03
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script which will:

  • Iterate all commits made within a Git repository.
@noamross
noamross / find_local_tweeps.R
Created August 14, 2017 23:43
A visit to Durham
library(rtweet) #rtweet API creds should already be set up
library(stringi)
library(dplyr)
friends = get_friends(user="noamross")
followers = get_followers("noamross")
tweeps_id = distinct(bind_rows(friends, followers))
tweeps_info = lookup_users(tweeps_id$user_id)
# A regex for a visit to Durham
@baptiste
baptiste / balloon.R
Last active November 29, 2017 19:53
library(grImport2)
library(grConvert)
library(egg)
convertPicture("noun_3663.svg", "balloon.svg")
balloon <- readPicture("balloon.svg")
d <- data.frame(x=1:9, y=rnorm(9),
data = I(Map(function(c, s) list(c=c,s=s),c=blues9,s=1:9)),
@DavisVaughan
DavisVaughan / lm-hell.r
Created May 31, 2019 19:38
Exploring the object size of `lm()` objects with enclosing environments
library(purrr)
library(lobstr)
library(glue)
library(rlang, warn.conflicts = FALSE)
make_an_lm <- function() {
x <- rep(1L, times = 10000000)
cat(glue("x is {object.size(x)}B"))
lm(1 ~ 1)
}