Skip to content

Instantly share code, notes, and snippets.

Bradley Snyder bradley219

Block or report user

Report or block bradley219

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ghost rules.txt
DRAW A GHOST!
I will donate $4 to Michael J. Fox foundation (first 25 submissions only).
Rules/V1:
1. one entry per person
2. you must put your name on your entry
3. entry must be on 3"x3" post-it®
4. entry must be hand-drawn by the entrant and must be the original work, no mechanical reproductions
5. Negative space itself is not considered a drawing
6. Rules are subject to my (Tanner's) interpretation.
7. non-compliant entries will be put in quarantine zone for 24 hours, then if no convincing appeal is made, the entry will be shredded
@bradley219
bradley219 / video_to_gif.sh
Created Dec 13, 2018
Convert a video file to high quality gif
View video_to_gif.sh
#!/bin/bash
FPS=14
WIDTH=640
PALETTE=/tmp/palette.png
INPUT="$1"
OUTPUT="$2"
KEEP_PALETTE="$3"
View sendimessage.applescript
# Usage:
# osascript sendimessage.applescript <recipient> <message>
on run {targetBuddyPhone, targetMessage}
tell application "Messages"
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy targetBuddyPhone of targetService
send targetMessage to targetBuddy
end tell
end run
View num.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <getopt.h>
#define VERSION "1.1"
typedef enum {
@bradley219
bradley219 / readserial.c
Last active May 24, 2018
Simple utility for logging from serial port
View readserial.c
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <stdio.h>
#include <sys/select.h>
#include <signal.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
@bradley219
bradley219 / focus.py
Created Nov 27, 2017
Python script for generating a focus routine gcode file. To use, set parameters in the script and execute on the command line. Pipe the output into a gcode file. Example: `./focus.py > focus.gcode`.
View focus.py
#!/usr/bin/env python
def g1_from_point(point):
return "G1 X{} Y{} Z{}\n".format(round(point[0], 5), round(point[1], 5), round(point[2], 5))
def g1_from_speed(speed):
return "G1 F{}\n".format(speed)
if __name__ == '__main__':
View tohex.py
#!/usr/bin/env python
import sys
c = sys.stdin.read(1)
while len(c) > 0:
sys.stdout.write("{0:02x}".format(ord(c)))
c = sys.stdin.read(1)
View bitcount.c
#include <stdint.h>
#include <stdio.h>
int ones_count(uint32_t i) {
    i = i - ((i >> 1) & 0x55555555);
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
    return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
int main (int argc, char *argv[]) {
@bradley219
bradley219 / fix_xcode_plugins
Last active Mar 14, 2018
Fix Xcode Plugin UUIDs
View fix_xcode_plugins
#!/bin/bash
UUID=`defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID`
echo "UUID=$UUID"
find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add "$UUID"
View PSPDFUIKitMainThreadGuard.m
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
#import <objc/runtime.h>
#import <objc/message.h>
// Compile-time selector checks.
You can’t perform that action at this time.