Skip to content

Instantly share code, notes, and snippets.

View dreki's full-sized avatar

Sean Gilbertson dreki

  • Understood
  • MN and NY
View GitHub Profile
@dreki
dreki / git-delete-merged-branches
Created February 14, 2023 19:05
Delete git branches that have been merge to `master` via PR.
#!/usr/bin/env bash
# For all local git branches in the current directory, check if they have a merged PR. If so, offer to delete the branch and the remote. If not, print the PR number and URL.
# Usage: git-delete-merged-branches
# Requires: git, gh, jq
set -e
bold=$(tput bold)
normal=$(tput sgr0)
# Get all local branches
branches=$(git branch --format='%(refname:short)')
# Loop through each branch
@marcelinollano
marcelinollano / yahoo-answers-mbmbam
Created April 8, 2021 17:44 — forked from gamesbyangelina/yahoo-answers-mbmbam
MBMBAM Yahoo Answers (Ep 1 - 472, filtered)
I went on a first date with this guy; I didn’t know what to say to him?
What is the first song that comes to mind when I say the word “party”?
Can birds get allergies?
Why did my gf who said she loved me cheat on me rite in fornt of me and not care?
How long does it take to get THC out of your system if you only smoke on the weekends?
My girlfriend threw my dog off my balcony when I broke up with her Im not sure what to do?
Can toenails be swallowed?
Is it okay to bring jelly beans on a plane?
is masturbation create problem?
I’m in LOVE with Krista from Fern Gully. Are there any websites devoted to her?
@dreki
dreki / amazon-wish-list.js
Last active November 19, 2020 16:42
Log Amazon Wish List contents (as of Nov 2020)
let output = '';
for (const el of wishList.querySelectorAll('[id^="itemName"]')) {
const itemName = el.innerText;
let amazonLink = el.getAttribute('href');
if (amazonLink) { amazonLink = ` (🔗 https://amazon.com${amazonLink})`; }
if (!amazonLink) { amazonLink = ''; }
output = output + `- ${itemName}${amazonLink}\n`;
const comment = el.closest('.a-column').nextSibling.querySelector('[id^="itemComment"]');
if (comment && comment.innerText.trim() !== "") {
output = output + ` 💬 ${comment.innerText}\n`;

Questions of the Week

  • Best close encounter with a celebrity?
  • Do you consider cereal a soup?
@Susensio
Susensio / property_inheritance.md
Last active April 19, 2024 00:42
Inherit property setter in python 3.7

Python @property inheritance the right way

Given a Parent class with value property, Child can inherit and overload the property while accessing Parent property getter and setter.

Although we could just reimplement the Child.value property logic completely without using Parent.value whatsover, this would violate the DRY principle and, more important, it wouldn't allow for proper multiple inheritance (as show in the example property_inheritance.py bellow).

Two options:

  • Child redefines value property completely, both getter and setter.
@dreki
dreki / mbmbam.md
Last active October 20, 2023 21:45
MBMBaM Memorable Bits

MBMBaM Episodes

  • 424, “That family always had Gushers, and I made them mine because of my actions,”
  • 418, “Gotta get a vasectomy,”
  • 401, sex on the ISS
  • 395, “So sweet, so crisp, so bitter, so many.”
  • 392, “That’s another hour of Monster Hunter I can play before my body has to go to sleep,” “Let’s put the tiger on the table and yell at it,”
  • 390, Justin kicks a bag at Taekwondo 50 times and then throws up
  • 380, "Jesus please us," "That's a wild way of doing that," "We're getting British up in here!," “Got a penis that can cum and everything,”
  • 379, crossing guard, “it is pretty ‘punk rock’,” crane lifts up a car into the sky
  • 378, someone’s brother rips out the pockets of their jeans while they’re talking to them,
@Integralist
Integralist / Tornado AsyncHTTPClient POST JSON example.py
Last active February 3, 2021 08:38
[Tornado AsyncHTTPClient POST form params example] #python #tornado #post #httpclient #asynchttpclient
# synchronous api
# response = sg.client.mail.send.post(request_body=data)
# except urllib.error.HTTPError as exc:
# async implementation
api_endpoint = 'https://api.sendgrid.com/v3/mail/send'
headers = {'Authorization': f'Bearer {sendgrid_api_key}',
'Content-Type': 'application/json'}
@nicolasdao
nicolasdao / js_regex_cheatsheet.md
Last active March 19, 2024 11:31
My most common JS RegEx. Just sick of restarting from scratch each time I need a freaking RegEx. Keywords: regex regexp regular expression rege reg
@butla
butla / wait_for_tcp_port.py
Last active December 8, 2022 19:52
Waiting for a TCP port to start accepting connections (Python >=3.6)
"""
MIT License
Copyright (c) 2017 Michał Bultrowicz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@glombard
glombard / new_obj.py
Created December 9, 2014 19:57
Python anonymous object
# Sometimes it's handy to create small anonymous objects instead of explicitly defining a class for it, especially while prototyping.
def new(name, data):
return type(name, (object,), data)
person = new('Person', { 'name': 'Joe', 'age': 30 })
print(person.name)