These are just things related to git and github that I want to remember
assuming file is file.txt and hash is 123abc
git checkout 123abc -- file.txt
Ref: https://stackoverflow.com/questions/6624036/restore-file-from-old-commit-in-git
| $Username = "rashbrook" # Replace with the target user's username | |
| $LogName = "Security" | |
| $LogonEventID = 4624 | |
| $LogoffEventID = 4634 | |
| # Load the Active Directory module | |
| Import-Module ActiveDirectory | |
| # Get the list of domain controllers | |
| $DomainControllers = Get-ADDomainController -Filter * |
| // 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 ( | |
| elem | |
| ) { | |
| const link = togglbutton.createTimerLink({ | |
| className: 'github', |
| name: main | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '30 5 * * *' # trigger at 5:30am UTC | |
| jobs: | |
| job1: | |
| runs-on: windows-latest |
These are just things related to git and github that I want to remember
assuming file is file.txt and hash is 123abc
git checkout 123abc -- file.txt
Ref: https://stackoverflow.com/questions/6624036/restore-file-from-old-commit-in-git
| function Get-FileEncoding ($FilePath){ | |
| New-Object System.IO.StreamReader $FilePath -OutVariable Stream | | |
| Select-Object -ExpandProperty CurrentEncoding | | |
| Select-Object -ExpandProperty BodyName | |
| $Stream.Dispose() | |
| } |
| // go to devicon.dev 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{} |
| # 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){ | |
| return | |
| } |
| 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 | |
| .data |
| function OhMyPoshStuff{ | |
| Import-Module oh-my-posh | |
| Import-Module -Name Terminal-Icons | |
| function Get-ThemeList{ | |
| $themeurl = "https://github.com/JanDeDobbeleer/oh-my-posh/tree/main/themes" | |
| $ProgressPreference = 'SilentlyContinue' | |
| $links = (iwr $themeurl).links | |
| $ProgressPreference = 'Continue' | |
| $themes=($links | where title -like *omp.json).title -Replace ".omp.json","" |
| # how i moved all of my git repos from azure devops to github | |
| # prereqs | |
| # azure cli - https://docs.microsoft.com/en-us/cli/azure | |
| # github cli - https://cli.github.com/ | |
| # 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 |