Skip to content

Instantly share code, notes, and snippets.


Roy Ashbrook royashbrook

View GitHub Profile
royashbrook / Github New.js
Last active Mar 7, 2022
Toggl Integration for New Github Projects
View Github New.js
// add this to the bottom of the current github integration. have to enable dev mode and click 'edit'
// probably a better selector, but i'm guessing these names aren't 'finished' as this is in beta still
// this one works for now in the board view which is what i needed it to work for.
// New Project Page
togglbutton.render("div[class*='Box-'] div[class*='Box-'] div[class*='Box-'] > a[class*='Link-']:not(.toggl)", { observe: true }, function (
) {
const link = togglbutton.createTimerLink({
className: 'github',
View example.yml
name: main
- cron: '30 5 * * *' # trigger at 5:30am UTC
runs-on: windows-latest
royashbrook / Get-FileEncoding.ps1
Created Jan 10, 2022
Simple PS script to get encoding on a file using streamreader
View Get-FileEncoding.ps1
function Get-FileEncoding ($FilePath){
New-Object System.IO.StreamReader $FilePath -OutVariable Stream |
Select-Object -ExpandProperty CurrentEncoding |
Select-Object -ExpandProperty BodyName
View Generate Markdown for Devicons.js
// go to and copy/paste this into the browser console or run as a snippet
// note: there are a handful which do not have the name in the standard format so they'll
// need to be manually corrected. this is just meant to make it a little easier.
//selector we'll apply the event to and get icon names from
var sel = "body > div.container > div > ul > li > span > i[class*='devicon']"
// for cleanup so can tweak and just rerun all of this
try {Array.from(document.querySelectorAll(sel)).forEach(x=>x.removeEventListener('click', handleClick)) }catch{}
try {document.querySelector('#mydiv').remove() }catch{}
royashbrook / filling in an existing spreadsheet.ps1
Created Nov 22, 2021
Moving from epplus.dll to import-excel
View filling in an existing spreadsheet.ps1
# this sample is a situation where i have a template file provided by a customer. this file is copied and the copy is then filled up with data. these examples assume epplus is in the working dir so it can be loaded and i am not including the import-module line for importexcel
function old($tfile,$file,$data){
Copy-Item $tfile $file
if($data.count -eq 0){
royashbrook / app.js
Created Nov 17, 2021
transfer git repo to new owner with js
View app.js
const { Octokit } = require("@octokit/core")
// you need a personal access token that controls the repos, once you get one, put it down below
const octokit = new Octokit({ auth: `REPLACEME!!!` });
octokit.request('GET /user/repos', {
type: "private",
per_page: "100"
.then(x => x
View Microsoft.PowerShell_profile.ps1
function OhMyPoshStuff{
Import-Module oh-my-posh
Import-Module -Name Terminal-Icons
function Get-ThemeList{
$themeurl = ""
$ProgressPreference = 'SilentlyContinue'
$links = (iwr $themeurl).links
$ProgressPreference = 'Continue'
$themes=($links | where title -like *omp.json).title -Replace ".omp.json",""
royashbrook / migrategitfromazuredevopstogithub.ps1
Created May 5, 2021
Migrate git repos from Azure Devops to github
View migrategitfromazuredevopstogithub.ps1
# how i moved all of my git repos from azure devops to github
# prereqs
# azure cli -
# github cli -
# note: you can get away with neither of these if you want
# to manually make some lists and repos yourself
# we'll be creating local clones of everything to work with
royashbrook / jiggle.ps1
Created May 5, 2021
jiggles the mouse a little
View jiggle.ps1
#no idea why, but i thought this was kind of funny
#get our winform stuff
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
#move the mouse on x
function Nudge($p){
[System.Windows.Forms.Cursor]::Position = `
[System.Drawing.Point]::New( `