Skip to content

Instantly share code, notes, and snippets.

View sohjsolwin's full-sized avatar

Josh Wilson sohjsolwin

View GitHub Profile
@sohjsolwin
sohjsolwin / RebuildNugetReferences.ps1
Last active March 15, 2021 18:10
Powershell: Helpful Nuget Commands
get-project -All | foreach-object { If ($PSItem.ProjectName.Contains("\")) { $PSItem.ProjectName.SubString($PSItem.ProjectName.LastIndexOf("\")+1)} else { $PSItem.ProjectName } } | foreach-object { Add-BindingRedirect $PSItem}
@sohjsolwin
sohjsolwin / chocolatey packages
Last active February 20, 2024 15:35
Frequently used collection of packages installed by Chocolatey
; Step 1) Install chocolatey with the following command in Powershell: Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
; Step 2) Select from the list of packages below and append them to `choco install -y`, like: choco install -y chocolateygui 7zip googlechrome etc
; Step 3) Paste into a new admin powershell window and run.
; General tools
7zip
notepadplusplus
sysinternals
windirstat
wireshark
@sohjsolwin
sohjsolwin / Examples.cs
Created June 13, 2019 13:00
Union type for bitwise comparisons
var leadSource = LeadSource.A;
var union = LeadSource.A | LeadSource.B | LeadSource.C;
Console.WriteLine(union & leadSource); //true
Console.WriteLine(union & LeadSource.B); //true
Console.WriteLine(union & LeadSource.C); //true
Console.WriteLine(union & LeadSource.D); //false
@sohjsolwin
sohjsolwin / jigsaw.ps1
Created May 9, 2019 18:52
Send Private Messages through Slack API
$buildVCS = "whateverTheSHAofCommitYouWant"
import-module posh-git
git show - pretty $buildVCS > $pwd\test.txt
$a = get-content test.txt
($a -split "`r`n") | ForEach-Object {
# the pattern is modified to check for a First Last name, or a single username, depending on how people have their git setup. 
$email = Select-String -InputObject $_ -Pattern "Author: ([A-Za-z]{2,20} [A-Za-z]{2,20}|[A-Za-z]{2,20}) <[A-Za-z]{2,20}@YOUR_DOMAIN\.com>" | % { $_.Matches } | % { $_.Value }
if($email){
@sohjsolwin
sohjsolwin / Mario Macro
Last active July 24, 2018 16:23
Promega GCode Workpad
M300 S660 P100
G4 P150
M300 S660 P100
G4 P300
M300 S660 P100
G4 P300
M300 S510 P100
G4 P100
M300 S660 P100
G4 P300
@sohjsolwin
sohjsolwin / AppendHexTimeToUrl.js
Created July 14, 2017 15:36
Javascript Snippets
javascript:(function() {var varchar = '?'; if (location.href.indexOf("?") > 0) {varchar='&'} location.href = location.href + varchar +'rand=' + new Date().getTime().toString(16);}())
@sohjsolwin
sohjsolwin / sliceExample.go
Created September 11, 2015 19:48
GoLang Tour Slice code solution
package main
import "golang.org/x/tour/pic"
func MakePic(val (func(int, int) uint8)) (func(int, int) [][]uint8) {
var pic = func(dx, dy int) ([][]uint8) {
var dyslice = make([][]uint8, dy)
for i := range dyslice {
@sohjsolwin
sohjsolwin / keybase.md
Created April 28, 2015 14:11
keybase.md

Keybase proof

I hereby claim:

  • I am sohjsolwin on github.
  • I am sohjsolwin (https://keybase.io/sohjsolwin) on keybase.
  • I have a public key whose fingerprint is D12F DD9D A87A F90E 2D08 BB23 A88C 13B8 01BF D356

To claim this, I am signing this object:

@sohjsolwin
sohjsolwin / gist:a3aac04b3f6bf441075b
Created March 16, 2015 14:00
Bookmarklet for pulling out non-browser JS global objects
javascript: (function() {var standardGlobals = ["top", "window", "location", "external", "chrome", "document", "inlineCSS", "target", "width", "height", "canvas", "data", "DOMURL", "img", "svg", "ctx", "url", "w", "a", "speechSynthesis", "webkitNotifications", "localStorage", "sessionStorage", "applicationCache", "webkitStorageInfo", "indexedDB", "webkitIndexedDB", "crypto", "CSS", "performance", "console", "devicePixelRatio", "styleMedia", "parent", "opener", "frames", "self", "defaultstatus", "defaultStatus", "status", "name", "length", "closed", "pageYOffset", "pageXOffset", "scrollY", "scrollX", "screenTop", "screenLeft", "screenY", "screenX", "innerWidth", "innerHeight", "outerWidth", "outerHeight", "offscreenBuffering", "frameElement", "clientInformation", "navigator", "toolbar", "statusbar", "scrollbars", "personalbar", "menubar", "locationbar", "history", "screen", "postMessage", "close", "blur", "focus", "ondeviceorientation", "ondevicemotion", "onunload", "onstorage", "onresize", "onpopstate", "onpa
@sohjsolwin
sohjsolwin / Xcrypt.cs
Created January 2, 2015 19:30
Easy Encryption/Decryption
private enum XcryptMode
{
Encrypt,
Decrypt
}
private string XcryptString(XcryptMode mode, string message)
{
byte[] results;
var returnValue = string.Empty;