This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Users/nickm/.pyenv/versions/3.9.11/bin/python | |
import requests | |
# GitHub username and access token | |
username = ... # TODO: Fill this in | |
access_token = ... # TODO: Fill this in | |
headers = { | |
"Authorization": f"Bearer {access_token}", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# <xbar.title>Gmail Checker</xbar.title> | |
# <xbar.version>v0.0.1</xbar.version> | |
# <xbar.author>Nick Merrill</xbar.author> | |
# <xbar.author.github>nick.merrill</xbar.author.github> | |
# <xbar.desc>Checks gmail and displays inbox count</xbar.desc> | |
import xml.etree.ElementTree as ET | |
from dataclasses import dataclass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias big="toilet -f bigmono12 -F gay" | |
color_screen () { | |
# Expects code like 1;30;42m | |
cols=$(tput cols) | |
lines=$(tput lines) | |
str="\033[$1" | |
i=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://djangosnippets.org/snippets/2283/ | |
from django.db import transaction | |
from django.db.models import get_models, Model | |
from django.contrib.contenttypes.generic import GenericForeignKey | |
@transaction.atomic | |
def merge_model_objects(primary_object, alias_objects=None, keep_old=False): | |
""" | |
Use this function to merge model objects (i.e. Users, Organizations, Polls, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Author</key> | |
<string>Nick Merrill</string> | |
<key>CapeName</key> | |
<string>App Demo Disc</string> | |
<key>CapeVersion</key> | |
<real>1</real> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExceptionUserInfoMiddleware(object): | |
def process_exception(self, request, exception): | |
try: | |
user = request.user | |
if user.is_authenticated(): | |
request.META['USER_ID'] = str(user.id) | |
request.META['USER_NAME'] = str("%s %s" % (user.first_name, user.last_name)) | |
request.META['USER_EMAIL'] = str(user.email) | |
except: | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# download-site https://django-tastypie.readthedocs.org/en/latest/ | |
alias download-site="wget --recursive --page-requisites --html-extension --convert-links --no-parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Example use: | |
// Return all labels of the cell | |
NSMutableArray *labels = [Utility ApplyToSubviews:cell limitedToClass:[UILabel class] usingBlock:^(id obj) { | |
UILabel *label = (UILabel *)obj; | |
label.text = @"Changed text"; | |
} recursively:YES]; | |
*/ |