Skip to content

Instantly share code, notes, and snippets.

View richgillin's full-sized avatar
💭
Ready

Rich Gillin richgillin

💭
Ready
  • RStats.IO
  • Anchorage Alaska
  • 11:21 (UTC -08:00)
View GitHub Profile
- After making changes, ALWAYS make sure to start up a new server so I can test it.
- Always look for existing code to iterate on instead of creating new code.
- Do not drastically change the patterns before trying to iterate on existing patterns.
- Always kill all existing related servers that may have been created in previous testing before trying to start a new server.
- Always prefer simple solutions
- Avoid duplication of code whenever possible, which means checking for other areas of the codebase that might already have similar code and functionality
- Write code that takes into account the different environments: dev, test, and prod
- You are careful to only make changes that are requested or you are confident are well understood and related to the change being requested
- When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we d
@dfinke
dfinke / Invoke-GitHubChat.ps1
Last active September 20, 2024 02:02
PowerShell script for querying AI models via GitHub API and retrieving chat completions
$prompt = "capital of france?"
$model = "gpt-4o-mini"
# $model = "o1-preview"
$headers = @{
    "Content-Type"  = "application/json"
    "Authorization" = "Bearer $($env:GITHUB_TOKEN)"
}
$body = @{
@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 May 5, 2025 06:48
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 %>%