Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
KNEE DEEP IN THE HOOPLA

Josh Holbrook jfhbrook

💭
KNEE DEEP IN THE HOOPLA
View GitHub Profile
View PasswordLearningTool.ps1
Add-Type -AssemblyName PresentationFramework
$ExpectedPassword = (New-Object `
PSCredential `
"josh",(Read-Host "What's the password you're trying to learn?" -AsSecureString) `
).GetNetworkCredential().Password
$Interval = 3600 # 1 hour
for (;;) {
View README.md

Verbtionary

A problem I run into a lot while working with PowerShell is trying to find the right verb to use for a function. PowerShell functions are by convention named with the form {Verb}-{Noun}, and while the Noun can vary wildly (and is in fact often more "the rest of the sentence" than a noun per se), the Verb is supposed to conform to a list of approved PowerShell verbs. Sometimes finding the right verb is easy, especially if the verb you're looking for is already in the list, but sometimes it can be a challenge!

I hacked up an Azure function that hits the Merriam-Webster thesaurus API to look up synonyms for a given search and then sees which of them are included in the output of [Get-Verb](https://docs.microsoft.com/en-us/powershell/modul

View twice_reversed.sql
select * from (select * from some_table order by a desc, b desc, c desc) order by a asc, b asc, c asc;
View parse.py
if 'details' not in item:
raise ValidationError('No details in item', item=item)
details = item['details']
if 'fields' not in details:
raise ValidationError('No fields in details for item', item=item)
if 'sections' not in details:
raise ValidationError('No sections in details for item', item=item)
@jfhbrook
jfhbrook / leettrace.js
Last active Apr 5, 2020
Some pastable classes for tracing execution in leetcode and such
View leettrace.js
function pad(item, depth, justify) {
let padded = String(item);
if (justify) {
padded = ' '.repeat(depth) + padded;
return padded.slice(padded.length - depth, padded.length);
}
padded += ' '.repeat(depth)
return padded.slice(depth);
}
View euler_1.bat
@echo off
set /A i=1
set /A sum=0
:loop
set /A irem3=%i% %% 3
set /A irem5=%i% %% 5
if %irem3% EQU 0 (set /A sum+=%i%) else (if %irem5% EQU 0 set /A sum+=%i%)
@jfhbrook
jfhbrook / lmaowhat.org
Created Mar 8, 2020
This FUCKING WILD quote from Happier - Tal Ben-Shahar
View lmaowhat.org

When I was growing up, my favorite cartoon was Richie Rich: The Poor Little Rich Boy, about the struggles of a child, who, seemingly, had it all. The oxymoron in the title, of being poor and rich simultaneously, makes perfect sense if we invoke the ultimate currency: in our relatively to-do society, we see an increasing number of wealthy children - and adults - who are unhappy. Some refer to this phenomena as a form of “affluenza”; I have come to think of it as the underprivilege of privilege.

View doom.org

~/.doom.d Literate Config

Init

This is the macro that defines the base config for doom and which modules it loads.

You can press K when on top of one of these in source editing mode to get help, and gd to browse the directory.

@jfhbrook
jfhbrook / client.html
Last active Feb 13, 2020
POC for peer to peer video streaming using an OBS browser source
View client.html
<html>
<body>
<h1>rtc peer test client</h1>
<form id="connect-form">
<label for="server-id">SERVER ID:</label>
<input type="text" name="server-id" id="server-id" required />
<input type="submit" value="CONNECT" />
</form>
<div id="log"></div>
</body>
@jfhbrook
jfhbrook / macbook_setup.org
Last active Jul 13, 2020
You ready? I'm fuckin' ready.
View macbook_setup.org

Macbook Air Setup

Change A Big Pile of OSX Defaults

  • Screensaver: NO LOAFING
  • Dock: left, automatically hide/show, smol, no recent apps
  • Mission Control: plz2b no rearrangin my spaces kthx
  • Security: ask for password immediately >:O
  • Trackpad: non-natural scroll, remove force click bullshit, no 3-finger tap, no smart zoom, no rotate, turn off all “more gestures” gestures EXCEPT Mission Control and swipe between fullscreen apps
You can’t perform that action at this time.