Skip to content

Instantly share code, notes, and snippets.

View daroczig's full-sized avatar

Gergely Daróczi daroczig

View GitHub Profile
@Integralist
Integralist / GitHub curl.sh
Last active February 6, 2025 20:47 — forked from madrobby/gist:9476733
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"
@lmullen
lmullen / shapefile.r
Last active January 26, 2022 22:07
How I use shapefiles in R with ggplot2 and RGDAL
library(rgdal) # R wrapper around GDAL/OGR
library(ggplot2) # for general plotting
library(ggmaps) # for fortifying shapefiles
# First read in the shapefile, using the path to the shapefile and the shapefile name minus the
# extension as arguments
shapefile <- readOGR("path/to/shapefile/", "name_of_shapefile")
# Next the shapefile has to be converted to a dataframe for use in ggplot2
shapefile_df <- fortify(shapefile)
@martijnvermaat
martijnvermaat / ssh-agent-forwarding-screen.md
Created December 21, 2013 15:06
SSH agent forwarding and screen

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

@amoeba
amoeba / anscombe-ggplot.r
Last active October 6, 2019 08:57
Anscombe's Quartet with ggplot2
library(ggplot2)
theme_set(theme_bw(base_size=18))
anscombe_m <- data.frame()
for(i in 1:4)
anscombe_m <- rbind(anscombe_m, data.frame(set=i, x=anscombe[,i], y=anscombe[,i+4]))
ggplot(anscombe_m, aes(x, y)) + geom_point(size=5, color="red", fill="orange", shape=21) + geom_smooth(method="lm", fill=NA, fullrange=TRUE) + facet_wrap(~set, ncol=2)
@ramnathv
ramnathv / code.R
Created October 9, 2013 02:53
Funnel Chart with rCharts and Highcharts
# install from html_assets branch
# install_github("rCharts", "ramnathv", ref = "html_assets")
# utility function to convert data frame to format required for funnel
make_dataset = function(x, y, data){
require(rCharts)
toJSONArray2(data[c(x, y)], json = F, names = F)
}
options(stringsAsFactors = F)
@hadley
hadley / .gitignore
Last active February 25, 2024 02:10
Benchmark different ways of reading a file
.Rproj.user
.Rhistory
.RData
*.Rproj
*.html
@wch
wch / app.r
Last active February 2, 2025 16:41
Shiny example app with dynamic number of plots
max_plots <- 5
ui <- fluidPage(
headerPanel("Dynamic number of plots"),
sidebarPanel(
sliderInput("n", "Number of plots", value=1, min=1, max=5)
),
@cdesante
cdesante / happythanksgiving.r
Created November 21, 2012 01:22
Thanksgiving
toInstall <- c("ggplot2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
library(ggplot2)
Turkey <- read.csv("http://www.oberlin.edu/faculty/cdesante/assets/downloads/turkey.csv")
ggplot(data = Turkey) + geom_tile(aes(x = Happy, y = Thanksgiving, fill=Turkey.Colors,
width=1))+ scale_fill_identity() + theme_bw()
@alphazo
alphazo / .gitignore
Last active October 12, 2015 21:39
ArchLinux Installation Guide - Encrypted SSD (GPT/GRUB2/LUKS/LVM/Systemd)
*.*~
@dsparks
dsparks / voronoi_raster.R
Created October 30, 2012 15:41
Image Manipulation, Part 3
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ReadImages", "reshape", "ggplot2")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Image URL:
allImageURLs <- c("http://media.charlesleifer.com/blog/photos/thumbnails/akira_940x700.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/ec/Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg/402px-Mona_Lisa%2C_by_Leonardo_da_Vinci%2C_from_C2RMF_retouched.jpg",
"http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Official_portrait_of_Barack_Obama.jpg/441px-Official_portrait_of_Barack_Obama.jpg",
"http://cache.boston.com/universal/site_graphics/blogs/bigpicture/obama_11_05/obama22_16604051.jpg",