Skip to content

Instantly share code, notes, and snippets.

View richgillin's full-sized avatar
💭
Ready

Rich Gillin richgillin

💭
Ready
  • RStats.IO
  • Anchorage Alaska
  • 19:18 (UTC -08:00)
View GitHub Profile
@davebraze
davebraze / emacs-data-work.md
Last active March 26, 2024 21:49
On using Emacs for data work with R

I use GNU Emacs on MS Windows 11, specifically, the pre-packaged pre-compiled distributions for Windows provided by Vince Goulet (https://vigou3.gitlab.io/emacs-modified-windows/). He also provides a bundle for MacOS (https://vigou3.gitlab.io/emacs-modified-macos/). I have used, and occassionally still use, Emacs on a variety of different unixen. I believe most of what follows will apply to any GNU Emacs distribution or derivative on any platform, but of course, YMMV.

By way of background, I've been using Emacs since the late 80s as an IDE for various programming languages (e.g., pascal, C, lisp, matlab, python), and as a general text editor. I've also got a lot of mileage out of it's features for calendaring, scheduling, note-taking, and agenda making. So, when I started using R around 2001, it was natural to do my R scripting and programming in Emacs (using its ESS package, which I'd already been using with SAS since the early 90s). When RStudio came out in about 2011, I did give it a look, but it was

# Stats & R G+ Community Member Stats
# The page is at https://gist.github.com/richgillin/90e2a3341d96196265ae00c044840995
## New data may take up to 48 hours to appear. So, 2 day lag for latest data
# member30 <- c(15292, 171)
# engage30 <- c(51,43,471)
# member30 / engage30
# Last 30 days - longest view available
# As of Jul 28, 2018: # 2018-07-19 data
@maelle
maelle / unconf18_list_following.R
Last active April 26, 2018 03:02
How to follow all members of the unconf18 Twitter list
# First step is to authenticate yourself see http://rtweet.info/articles/auth.html
# your username
who <- "ma_salmon"
# Users I already follow
following <- rtweet::get_friends(users = who)
# Users from the list
unconf18 <- rtweet::lists_members(slug = "ropensci-runconf18",
owner_user = "ropensci")
@mackwage
mackwage / windows_hardening.cmd
Last active July 22, 2024 03:37
Script to perform some hardening of Windows OS
:: Windows 10 Hardening Script
:: This is based mostly on my own personal research and testing. My objective is to secure/harden Windows 10 as much as possible while not impacting usability at all. (Think being able to run on this computer's of family members so secure them but not increase the chances of them having to call you to troubleshoot something related to it later on). References for virtually all settings can be found at the bottom. Just before the references section, you will always find several security settings commented out as they could lead to compatibility issues in common consumer setups but they're worth considering.
:: Obligatory 'views are my own'. :)
:: Thank you @jaredhaight for the Win Firewall config recommendations!
:: Thank you @ricardojba for the DLL Safe Order Search reg key!
:: Thank you @jessicaknotts for the help on testing Exploit Guard configs and checking privacy settings!
:: Best script I've found for Debloating Windows 10: https://github.com/Sycnex/Windows10Debloater
:
@MattSandy
MattSandy / run.R
Last active December 3, 2016 20:27
Update and Append Multiple Files in R
setwd("~/R/Merge Stuff")
install.packages("openxlsx")
library("openxlsx")
file <- list()
#base file is the original you are working from
#update file is the file with new information which updates base cells
#error file contains information in new columns which are appended
file$base <- read.xlsx("base.xlsx")
file$update <- read.xlsx("update.xlsx")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tjmahr
tjmahr / date.R
Last active May 26, 2017 01:06
xml example
library("magrittr")
library("stringr")
library("lubridate")
library("xml2")
get_date <- function(xml_blob) {
# Convert XML clock info into an R list
xml_list <- xml_blob %>%
str_replace_all("\\\\n", "") %>%
read_xml %>%
@jmcastagnetto
jmcastagnetto / nist-beacon-response.R
Last active August 29, 2015 14:12
A simple and naive example of using the NIST Randomness Beacon in R (https://beacon.nist.gov/home)
require(RCurl)
require(XML)
# Let's make a special class
NISTBeaconResponse <- function (ts) {
if(!is.integer(ts) &
!inherits(ts, "POSIXct") &
!inherits(ts, "POSIXlt")) {
stop("We expected a unix timestamp as an integer or a POSIXct or POSIXlt value")
}
@jennybc
jennybc / 2014-10-12_stop-working-directory-insanity.md
Last active September 23, 2022 04:43
Stop the working directory insanity

There are packages for this now!

2017-08-03: Since I wrote this in 2014, the universe, specifically Kirill Müller (https://github.com/krlmlr), has provided better solutions to this problem. I now recommend that you use one of these two packages:

  • rprojroot: This is the main package with functions to help you express paths in a way that will "just work" when developing interactively in an RStudio Project and when you render your file.
  • here: A lightweight wrapper around rprojroot that anticipates the most likely scenario: you want to write paths relative to the top-level directory, defined as an RStudio project or Git repo. TRY THIS FIRST.

I love these packages so much I wrote an ode to here.

I use these packages now instead of what I describe below. I'll leave this gist up for historical interest. 😆