Skip to content

Instantly share code, notes, and snippets.

@streeter
streeter / intensify.sh
Created February 25, 2022 18:51 — forked from leosunmo/intensify.sh
intensifies Slack emoji creator
#!/bin/bash
# Generate a `:something-intensifies:` Slack emoji, given a reasonable image
# input. I recommend grabbing an emoji from https://emojipedia.org/
set -euo pipefail
if ! command -v identify &> /dev/null
then
if [ "$(uname)" == "Darwin" ]; then
@streeter
streeter / get_channels.js
Created March 25, 2022 00:59 — forked from felixrieseberg/get_channels.js
Slack: Get a list of your channels (excluding DMs, group chats, and archived/private channels)
// Open up the Slack Developer Tools by entering "/slackdevtools"
// in the message input.
// First, run this. The client will reload.
slackDebug.enable()
// Then, get channels. See "filterChannels" to remove channels
// beginning with a certain prefix.
(function getMyChannels() {
const allChannels = slackDebug.storeInstance.getStateByTeamId(slackDebug.activeTeamId).channels.__proto__
@streeter
streeter / brew-update-notifier.sh
Last active March 2, 2022 17:57
Homebrew Package Update Notifications on Mountain Lion
#!/bin/bash
#
# Notify of Homebrew updates via Notification Center on Mac OS X
#
# Author: Chris Streeter http://www.chrisstreeter.com
# Requires: terminal-notifier. Install with:
# gem install terminal-notifier
TERM_APP='/Applications/Terminal.app'
BREW_EXEC='/usr/local/bin/brew'
@streeter
streeter / pre-commit.py
Created November 18, 2011 16:02
Python .git/hooks/pre-commit hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@streeter
streeter / swizzle.m
Created July 27, 2013 00:58
Swizzle methods in Objective-C
#import <objc/runtime.h>
static void SwizzleClassMethod(Class klass, SEL original, SEL new)
{
Method origMethod = class_getClassMethod(klass, original);
Method newMethod = class_getClassMethod(klass, new);
if (class_addMethod(klass, original, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) {
class_replaceMethod(klass, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
@streeter
streeter / EmojiPointersDemo.swift
Created September 19, 2018 17:13 — forked from cellularmitosis/EmojiPointersDemo.swift
Representing pointer values as emoji can be useful for "visually" debugging certain issues, like cell reuse, etc.
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
@streeter
streeter / FCPrivateBatteryStatus.m
Created March 14, 2016 22:31
How to get raw battery info (mAh remaining, etc.) from iOS using private APIs. For internal testing only, NOT APP STORE DISTRIBUTION!
#import <Foundation/Foundation.h>
#include <dlfcn.h>
NSDictionary *FCPrivateBatteryStatus()
{
static mach_port_t *s_kIOMasterPortDefault;
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options);
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name);
@streeter
streeter / prime.md
Last active April 30, 2018 18:35
Extend Amazon Prime

Here's what you need to do to keep paying $99 for Prime:

  1. If you are already subscribe to Prime, head to your Prime cancelation page and cancel your current Prime subscription by clicking on "End My Benefits." Don't worry, you'll still have Prime benefits until your membership expires.
  2. Purchasing a one-year voucher for $99. If after purchasing you decide you don’t want to do this, you can redeem it for an Amazon giftcard for free, so you don't lose any money (and you can buy multiple Prime gifts if you want to stock up, they don’t expire).
  3. Make sure to set a calendar reminder for your last day of Prime benefits, so you can apply the Prime membership giftcard.

Worth noting - if you have a grandfathered Amazon Prime account with full family features (prior to August 2015), this may remove those benefits. If you're still using thos

@streeter
streeter / DropboxIgnore.md
Created March 5, 2018 18:55 — forked from idleberg/DropboxIgnore.md
Ignore node_modules/bower_components folders in your Dropbox

This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLI

I'm a beginner at bash, so all improvements are welcome!

#!/bin/bash

set -e

# SETTINGS
@streeter
streeter / pelican_deployer.py
Created March 10, 2016 17:37 — forked from marksteve/pelican_deployer.py
Push-to-deploy static sites with Pelican, Flask and Github
"""
Simple web server that listens for Github webhooks to implement push-to-deploy
with Pelican static sites
Settings are loaded from a json file except for SECRET which should be an
environment variable
Example `deployer.json`
{