Skip to content

Instantly share code, notes, and snippets.

View daroczig's full-sized avatar

Gergely Daróczi daroczig

View GitHub Profile
@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.

@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)
library(RJSONIO)
library(httr)
library(ggplot2)
api_key <- scan("~/.meetup.apikey", character(), quiet = TRUE)
group_id <- 1414043 ## LA R meetup
req_url <- paste0("http://www.meetup.com/2/events?key=", api_key,
"&group_id=",group_id,"&status=past")
events_data <- fromJSON(rawToChar(GET(req_url)$content))$results
@dhrrgn
dhrrgn / gist:10125477
Last active February 26, 2021 18:42
Upgrade Ubuntu OpenSSL to patch Heartbleed
sudo apt-get update
sudo apt-get install -y libssl1.0.0 openssl
# Confirm Build Date is at least Aril 7th 2014
openssl version -a
# Restart all services listed by this command:
sudo lsof -n | grep ssl | grep DEL
@jeroen
jeroen / rcurl_stream.R
Last active January 27, 2016 13:11
line-by-line import of json records with RCurl
batchimport <- function(url, batchsize = 1e6) {
# Globals
stack <- batches <- list();
i <- j <- 1;
size <- 0;
# Function that parses intermediate json
clearstack <- function(all=FALSE){
bigstr <- do.call(paste0, stack);
lines <- strsplit(bigstr, "\n")[[1]];
@benmarwick
benmarwick / .emacs
Last active June 1, 2020 15:22
Notes on using Emacs
;;Record startup timestamp
(defvar Emacs/invokation-time
(current-time))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (tango-plus)))
@jeroen
jeroen / silent-install.sh
Last active May 15, 2017 08:45
Silent install of OpenCPU
# Prevent postfix from prompting for hostname
sudo debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
sudo apt-get install -y postfix
# Install OpenCPU
sudo add-apt-repository -y ppa:opencpu/opencpu-2.0
sudo apt-get update
sudo apt-get install -y opencpu-server
@jennybc
jennybc / reverse-categorical-axis-ggplot2.r
Created October 10, 2014 01:06
Reverse the order of a categorical axis in ggplot2
scale_x_discrete(limits = rev(levels(the_factor)))
@andrewheiss
andrewheiss / mtable_stargazer.R
Created November 4, 2014 15:04
mtable and stargazer
library(memisc)
library(stargazer)
library(pander)
lm0 <- lm(sr ~ pop15 + pop75, data = LifeCycleSavings)
lm1 <- lm(sr ~ dpi + ddpi, data = LifeCycleSavings)
lm2 <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
mtable123 <- mtable("Model 1"=lm0,"Model 2"=lm1,"Model 3"=lm2, summary.stats=c("sigma","R-squared","F","p","N"))
pander(mtable123)
@yihui
yihui / README.md
Last active March 15, 2017 18:35
A Shiny app based on annyang that responds to voice input