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/env python3 | |
from urllib.parse import urljoin | |
from pandocfilters import toJSONFilter, Image | |
BASEURL = "https://example.com" | |
def basehref(key, value, format, meta): | |
if key == "Image": | |
[[id, classes, attrs], children, [src, title]] = value |
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
#!/bin/bash | |
for f in "$@" | |
do | |
BASENAME=`basename "$f"` | |
/usr/sbin/cupsfilter "$f" > "${f}.pdf" 2> "/tmp/${BASENAME}.stderr.txt" | |
done |
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
<script type="text/javascript"> | |
HTMLTableElement.prototype.fp_toTable = function(nullvalue = null) { | |
var columnCount = Array.from(this.rows).map(row => Array.from(row.cells).reduce((sum, cell) => sum + cell.colSpan, 0)).reduce((max, row) => Math.max(max, row), 0); | |
var itemCount = Array.from(this.rows).reduce((rsum, row) => rsum + Array.from(row.cells).reduce((csum, cell) => csum + (cell.colSpan * cell.rowSpan), 0), 0); | |
var rowCount = itemCount / columnCount; | |
var items = Array.apply(null, Array(itemCount)); | |
tds = Array.from(this.getElementsByTagName('td')); | |
for(var i=0, ii=0; i<tds.length; i++, ii=items.indexOf(undefined, i)) { | |
items[ii] = tds[i].innerText; | |
for(var j=0;j<tds[i].colSpan;j++) { |
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/python | |
import sys, zlib, re | |
def print_streams(bytes, start=0): | |
r = re.compile("BT.*?\((.*?)\)[\s]*?Tj.*?ET", re.DOTALL) | |
while True: | |
start = bytes.find("stream", bytes.find("FlateDecode", start)) + len("stream") | |
if start < len("stream"): return | |
end = bytes.find("endstream", start) |
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
#import <Foundation/Foundation.h> | |
@interface FPNetServiceTXTRecord : NSObject | |
@property NSNetService *netService; | |
- (NSString *)objectForKeyedSubscript:(NSString *)key; | |
@end | |
@interface NSNetService (FPNetServiceAddtions) | |
- (FPNetServiceTXTRecord *)fp_TXTRecord; | |
@end |
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
@interface FPDistributedNotificationCenter : NSObject | |
@end | |
@implementation FPDistributedNotificationCenter | |
- (id)init { | |
if(self = [super init]) { | |
[NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(receivedDistributedNotification:) name:nil object:nil]; | |
} | |
return self; | |
} |
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
struct servent *s = getservbyname("http", NULL); | |
if(!!s) { | |
NSLog(@"%s %i %s", s->s_name, CFSwapInt16BigToHost(s->s_port), s->s_proto); | |
for(size_t i=0; !!s->s_aliases[i]; i++) { | |
NSLog(@"%lu\t%s", i, s->s_aliases[i]); | |
} | |
} |
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
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section { | |
if([view isKindOfClass:UITableViewHeaderFooterView.class]) { | |
((UITableViewHeaderFooterView *)view).textLabel.text = [self tableView:tableView titleForHeaderInSection:section]; | |
} | |
} |
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
// Enable parameterless options (e.g., `-verbose`) to be passed in as command line arguments. | |
NSMutableDictionary *arguments = [[NSUserDefaults.standardUserDefaults volatileDomainForName:NSArgumentDomain] mutableCopy]; | |
for(NSString *arg in NSProcessInfo.processInfo.arguments) | |
if([arg hasPrefix:@"-"] && [arguments objectForKey:[arg substringFromIndex:1]] == nil) | |
[arguments setObject:@YES forKey:[arg substringFromIndex:1]]; | |
[NSUserDefaults.standardUserDefaults removeVolatileDomainForName:NSArgumentDomain]; // remove to prevent NSInvalidArgumentException (per documentation) | |
[NSUserDefaults.standardUserDefaults setVolatileDomain:arguments forName:NSArgumentDomain]; |
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
for(int i=0;i<256;i++) { | |
CBUUID *u = [CBUUID UUIDWithString:[NSString stringWithFormat:@"18%02X", i]]; | |
if(![u.UUIDString isEqualToString:u.description]) | |
NSLog(@"%@\t%@", u.UUIDString, u.description); | |
} | |
// 1800 Generic Access Profile | |
// 1801 Generic Attribute Profile | |
// 1805 Current Time | |
// 1808 Glucose |
NewerOlder