Skip to content

Instantly share code, notes, and snippets.

View sohjsolwin's full-sized avatar

Josh Wilson sohjsolwin

View GitHub Profile
@sohjsolwin
sohjsolwin / startcinnamon
Created July 5, 2013 12:56
startcinnamon script for launching cinnamon for a ChromeOS Chroot
APPLICATION="${0##*/}"
USAGE="$APPLICATION [options]
Wraps enter-chroot to start a Mint session.
By default, it will log into the primary user on the first chroot found.
Options are directly passed to enter-chroot; run enter-chroot to list them."
exec sh -e "`dirname "$0"`/enter-chroot" "$@" startx /bin/bash gnome-session-cinnamon
@sohjsolwin
sohjsolwin / InstallCinnamonCrouton
Created July 6, 2013 13:49
Steps to install and setup a cinnamon flavored crouton on a Chromebook Pixel
# The next command will install a [raring] based ubuntu
# chroot, named [cinnamon] into the default directory
# with the targets [core], [cli-extra], [touch], and [keyboard]
sudo crouton -n cinnamon -r raring -t core,cli-extra,touch,keyboard
# Supply your new username and password like normal, and
# once that finishes, enter the chroot with:
sudo enter-chroot -n cinnamon
@sohjsolwin
sohjsolwin / script.js
Created August 29, 2014 17:28
Dynamically add items to a webpage header
var tempChild = {};
var head = document.head;
if (!head) head = document.getElementsByTagName('head')[0];
var dynamicloads = head.getElementsByClassName('dynamicload');
for (var i = 0; i < dynamicloads.length; i++) {
dynamicloads[0].parentNode.removeChild(dynamicloads[0]);
}
@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;
@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 / 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 / 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 / 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 / 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 / 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){