This file contains hidden or 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
// | |
// LineParser.swift | |
// | |
// Created by Adam Knight on 1/26/18. | |
// | |
import Foundation | |
public class LineParser: Sequence, IteratorProtocol { |
This file contains hidden or 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
#!/bin/sh | |
CMD=() | |
for i in "$@"; do | |
if [[ $i =~ "[[:space:]]" ]]; then | |
CMD+=(\\\"$i\\\") | |
else | |
CMD+=($i) | |
fi | |
done |
This file contains hidden or 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
#!/bin/bash -x | |
# Generally based on ideas found at: | |
# http://www.garth.org/archives/2011,08,27,169,fix-time-machine-sparsebundle-nas-based-backup-errors.html | |
# | |
# Reduced the ideas there down to their essentials. | |
# 1. Unlock the image. | |
# 2. Reset the saved failure in the backup metadata. | |
# 3. Verify/fix the filesystem. |
This file contains hidden or 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
@interface UIFont (Sanity) | |
+(UIFont*)preferredFontForTextStyle:(NSString *)style withFontFamily:(NSString*)family; | |
@end | |
@implementation UIFont (Sanity) | |
+(UIFont*)preferredFontForTextStyle:(NSString*)style withFontFamily:(NSString*)family | |
{ | |
UIFont *font = nil; | |
UIFontDescriptor *descriptor = nil; |
This file contains hidden or 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/env python3 | |
ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" | |
def encode(n): | |
result = "" | |
while (n > 0): | |
n,m = divmod(n,len(ALPHABET)) | |
result = ALPHABET[m] + result | |
return result |
This file contains hidden or 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
#define UICOLOR_FROM_HEX(x) [UIColor colorWithRed:(((NSUInteger)(x & 0xff0000) >> 16)/255.) \ | |
green:(((NSUInteger)(x & 0x00ff00) >> 8)/255.) \ | |
blue:(((NSUInteger)(x & 0x0000ff))/255.) \ | |
alpha:1.0] | |
UIColor *color = UICOLOR_FROM_HEX(0xff00ff); |
This file contains hidden or 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/env python3 | |
import argparse | |
import datetime | |
import os | |
import json | |
import requests | |
from bs4 import BeautifulSoup |
This file contains hidden or 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
#!/bin/bash | |
FILE="$1" | |
VCODEC=$( mediainfo --Inform="Video;%Format%" "$FILE" ) | |
ACODEC=$( mediainfo --Inform="Audio;%Format%" "$FILE" ) | |
echo $FILE: $VCODEC/$ACODEC | |
[ "$VCODEC" = "AVC" ] && VC="copy" || VC="libx264" |
This file contains hidden or 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
#!/bin/bash | |
if [ -z $1 ]; then | |
echo "usage: `basename $0` /full/path/to/MYPROJ-Info.plist font1.(ttf|otf) [font2 font3 ...] #names of font files" | |
exit 1 | |
fi | |
PLIST=$1 | |
shift | |
FONTS=$@ |
This file contains hidden or 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
#!/bin/bash | |
MANFILE=$( man -w $1 $2 ) | |
NAME=$( basename $MANFILE ) | |
if [ -r $MANFILE ]; then | |
groff -mandoc $MANFILE -t | pstopdf -i -o "$NAME.pdf" | |
echo "wrote $NAME.pdf" | |
else | |
echo $MANFILE #Error message, probably. |
NewerOlder