Skip to content

Instantly share code, notes, and snippets.

@jimbrig
jimbrig / notes.md
Created December 1, 2020 05:41
[RStudio Shortcuts] RStudio shortcuts via the `shrtcts` R package. #dev #r #config #pinned #startup

PATH: ~/.config/.shrtcts.yml or ~/.config/.shrtcts.R.

Run shrtcts::add_rstudio_shortcuts() to install shortcuts into RStudio.

#' @title Guess date format
#' @description Guess the date format.
#' @param x a vector (not a factor)
#' @param returnDates logical, whether to return the dates
#' @param tzone time zone
#' @export
guessDateFormat <- function(x, returnDates = FALSE, tzone = "", messages=FALSE) {
tryCatch({
x1 <- x
# replace blanks with NA and remove
@jimbrig
jimbrig / get_github_stars.R
Created December 9, 2020 04:15
[Github Stars] Pull Github Starred Repositories using Github API and gh R Packages
# https://developer.github.com/v3/activity/starring/
mystars <- gh::gh("/users/:username/starred", username = "jimbrig", .limit = Inf)
repo_names <- purrr::map_depth(mystars, 1, purrr::pluck, "full_name") %>% purrr::flatten_chr()
repo_urls <- purrr::map_depth(mystars, 1, purrr::pluck, "url") %>% purrr::flatten_chr()
creation_dates <- purrr::map_depth(mystars, 1, purrr::pluck, "created_at") %>% purrr::flatten_chr() %>% stringr::str_sub(1, 10) %>% lubridate::ymd()
last_updated_dates <- purrr::map_depth(mystars, 1, purrr::pluck, "updated_at") %>% purrr::flatten() %>% stringr::str_sub(1, 10) %>% lubridate::ymd()
stargazers_count <- purrr::map_depth(mystars, 1, purrr::pluck, "stargazers_count") %>% purrr::flatten_int()
languages <- purrr::map_depth(mystars, 1, purrr::pluck, "language") %>% purrr::map(function(x) if (is.null(x)) return("Missing") else x) %>% purrr::flatten_chr() %>% tolower()
@jimbrig
jimbrig / reset_onedrive.cmd
Created December 10, 2020 22:01
[Reset OneDrive]
C:\Program Files (x86)\Microsoft OneDrive\onedrive.exe /reset
@jimbrig
jimbrig / get-installed-programs.bat
Created December 16, 2020 00:53
[Get Installed Programs] #windows #dev
@echo off
REM Reference: http://www.techrepublic.com/forum/questions/101-215911/dos-command-to-list-all-installed-programs
echo ================= >>software_list.txt
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp1.txt
find "DisplayName" temp1.txt| find /V "ParentDisplayName" > temp2.txt
for /f "tokens=2,3 delims==" %%a in (temp2.txt) do (echo %%a >> software_list.txt)
del temp1.txt
del temp2.txt
REM type software_list.txt | more
echo.
@jimbrig
jimbrig / readme.md
Created December 17, 2020 23:34 — forked from zsoumya/readme.md
Windows Setup and Customization Guide for New Installs

Windows Setup and Customization Guide for New Installs

  • Go to Bluetooth settings and add mouse (Logitech Master 2S is my current mouse)
  • Logitech Options will ask to be auto-installed. Allow.
  • Log into Logitech Options with the Logi account.
  • Go to mouse profile and configure the middle button.

  • Go to Windows Activation settings.
  • Click Troubleshoot.
  • Windows will auto-detect edition upgrade (Windows 10 Pro For Workstations) and reboot.
@jimbrig
jimbrig / readme.md
Created December 17, 2020 23:38 — forked from zsoumya/readme.md
Docker Cheat Sheet

Docker Cheat Sheet

Stop all containers

docker container stop $(docker container ls -aq)

Remove all containers

docker container rm $(docker container ls -aq)

@jimbrig
jimbrig / Readme.md
Created December 18, 2020 22:26 — forked from deathau/Readme.md
Obsidian scss

Obsidian SASS theme switching tools

I was building up a small library of css snippets, and mixing and matching via copy-paste was getting tiresome.
So, I knocked myself up a little solution using https://sass-lang.com/
To use this solution, you need to follow the instructions on the website to install the SASS command line utility.

Instructions

For my purposes, I created a subfolder in my Obsidian vault called ./.themes where my obsidian.scss file lives. I also created a subfolder for mixins (./.themes/mixins) containing small snippets like "Andy Matuschak" mode and collapsing sidebars (and my preferred custom colours for my Base2Tone theme)

@jimbrig
jimbrig / config.yml
Last active December 22, 2020 17:14
[GH Dotfiles] #github #dotfiles #config
# What protocol to use when performing git operations. Supported values: ssh, https
git_protocol: https
# What editor gh should run when creating issues, pull requests, etc. If blank, will refer to environment.
editor:
# When to interactively prompt. This is a global config that cannot be overridden by hostname. Supported values: enabled, disabled
prompt: enabled
# A pager program to send command output to, e.g. "less". Set the value to "cat" to disable the pager.
pager:
# Aliases allow you to create nicknames for gh commands
aliases:
@jimbrig
jimbrig / enable_openssh.ps1
Created December 22, 2020 18:10
[Add Optional Features for Windows] #dev #windows10 #config #setup
$OpenSSHClient = Get-WindowsCapability -Online | ? Name -like ‘OpenSSH.Client*’
Add-WindowsCapability -Online -Name $OpenSSHClient.Name