Skip to content

Instantly share code, notes, and snippets.

View jfhbrook's full-sized avatar
💭
KNEE DEEP IN THE HOOPLA

Josh Holbrook jfhbrook

💭
KNEE DEEP IN THE HOOPLA
View GitHub Profile

Word Search

Prompt

This one came from Naomi K, who I was chatting with on IRC in the neighborhood of 2013:

Given a list of words, find all the orthogonal words in set string of characters. Lazy cracker asses need not apply.

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

@jfhbrook
jfhbrook / lmaowhat.org
Created March 8, 2020 19:01
This FUCKING WILD quote from Happier - Tal Ben-Shahar

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.

Dear GitLab users and customers,

On October 23, we sent an email entitled “Important Updates to our Terms of Service and Telemetry Services” announcing upcoming changes. Based on considerable feedback from our customers, users, and the broader community, we reversed course the next day and removed those changes before they went into effect. Further, GitLab will commit to not implementing telemetry in our products that sends usage data to a third-party product analytics service. This clearly struck a nerve with our community and I apologize for this mistake.

So, what happened? In an effort to improve our user experience, we decided to implement user behavior tracking with both first and third-party technology. Clearly, our evaluation and communication processes for rolling out a change like this were lacking and we need to improve those processes. But that’s not the main thing we did wrong.

Our main mistake was that we did not live up to our own core value of collaboration by including our users, contributo

@jfhbrook
jfhbrook / email.md
Created October 23, 2019 18:56
gitlab rolling out them product analytics

Dear GitLab User,

We have launched important updates to our Terms of Service surrounding our use of telemetry services. Starting with GitLab 12.4, existing customers who use our proprietary products (that is, GitLab.com and the Enterprise Edition of our self-managed offerings) may notice additional Javascript snippets that will interact with GitLab and/or third-party SaaS telemetry service (such as Pendo).

For GitLab.com users: as we roll out this update you will be prompted to accept our new Terms of Service. Until the new Terms are accepted access to the web interface and API will be blocked. So, for users who have integrations with our API this will cause a brief pause in service via our API until the terms have been accepted by signing in to the web interface.

For Self-managed users: GitLab Core will continue to be free software with no changes. If you want to install your own instance of GitLab without the proprietary software being introduced as a result of this change, GitLab Community Edition (CE)

@jfhbrook
jfhbrook / PasswordPrompt.ps1
Created October 6, 2019 22:08
password prompt in powershell on windows 10
# Simple and nasty password prompt
# Adapted from https://docs.microsoft.com/en-us/powershell/scripting/samples/creating-a-custom-input-box?view=powershell-6
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$form = New-Object System.Windows.Forms.Form
$form.Text = 'Credentials Time!'
$form.Size = New-Object System.Drawing.Size(240,130)
$form.StartPosition = 'CenterScreen'

I tried changing my username and home directory on my Windows 10 machine recently, and I got 95% of the cases out of the way, but npm is one of the last ones. The error you're seeing means that npm thinks that my home directory is at c:\Users\Joshua Holbrook instead of c:\Users\Josh. 🙃 So the question is, how do I trace this back to the code that decides where my home directory is?

$ op signin mysubdomain # don't want to have to use an eval, a wrapper bash function should take care of this for me
$ op get [tab][tab] # this should tab-complete the resource
$ op get item S[tab][tab] # this should tab-complete the item name
$ op get item "Some Login" --clipboard # this should grab my password and put it directly in my clipboard - no json blob
@jfhbrook
jfhbrook / app-factory.py
Created April 26, 2019 16:16
Our kinja-service Flask app factory
def create_app(service_name):
app = KinjaApp(__name__)
app.config['KINJA_SERVICE_NAME'] = service_name
app.register_error_handler(Exception, general_error_handler)
app.register_error_handler(HTTPException, http_error_handler)
app.register_error_handler(Invalid, validation_error_handler)
init_ops(app)
@jfhbrook
jfhbrook / kinja-service-http-error-handler.py
Created April 19, 2019 21:07
A snippet from the data team's API framework used to handle exceptions
def http_error_handler(exc):
"""
error handler intended for werkzeug HTTPException instances
"""
uid = log_and_generate_uid(exc)
code = kinja_error_code_from_exc(exc)
return error(exc, exc_code=code, uid=uid)