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
/* | |
Copyright (c) 2009 Remy Demarest | |
Permission is hereby granted, free of charge, to any person | |
obtaining a copy of this software and associated documentation | |
files (the "Software"), to deal in the Software without | |
restriction, including without limitation the rights to use, | |
copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the | |
Software is furnished to do so, subject to the following |
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
<?php | |
function ping($host, $port=25565, $timeout=30) { | |
//Set up our socket | |
$fp = fsockopen($host, $port, $errno, $errstr, $timeout); | |
if (!$fp) return false; | |
//Send 0xFE: Server list ping | |
fwrite($fp, "\xFE"); | |
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
[db makeFunctionNamed:@"UTTypeConformsTo" maximumArguments:2 withBlock:^(sqlite3_context *context, int argc, sqlite3_value **argv) { | |
if (sqlite3_value_type(argv[0]) == SQLITE_TEXT) { | |
const unsigned char *a = sqlite3_value_text(argv[0]); | |
const unsigned char *b = sqlite3_value_text(argv[1]); | |
CFStringRef as = CFStringCreateWithCString(0x00, (const char*)a, kCFStringEncodingUTF8); | |
CFStringRef bs = CFStringCreateWithCString(0x00, (const char*)b, kCFStringEncodingUTF8); | |
sqlite3_result_int(context, UTTypeConformsTo(as, bs)); |
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
// | |
// NSMutableURLRequest+CacheControl.m | |
// | |
// Created by Paul Goracke on 2/26/13. | |
// | |
@implementation NSMutableURLRequest (CacheControl) | |
+ (instancetype) newCachePolicyRequestWithURL:(NSURL *)url timeoutInterval:(NSTimeInterval)timeoutInterval { | |
// If we have cached info, tell request to ignore cache because we only want to process data when we get new from server |
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 | |
# | |
# git-is-ancestor, by Simon Whitaker | |
# | |
# Suggested usage | |
# | |
# Store this file somewhere, make it executable, then alias | |
# it to git is-ancestor by putting this in your $HOME/.gitconfig: | |
# | |
# [alias] |
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/sh | |
if [[ $# != 2 ]] ; then | |
echo "Usage: $0 <Size in GB> <Name>" | |
exit 1 | |
fi | |
key=$(openssl rand -base64 100 | sed -e 'N;s/\n//') | |
echo SAVE THIS KEY: $key |
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
# | |
# fair-queue based settings for EdgeRouter Lite traffic shaping | |
# | |
# download is typically 30 and change. everything can burst to 100% | |
# of bandwidth, priority rules keep the garbage in check | |
set traffic-policy shaper download | |
set traffic-policy shaper download bandwidth 30Mbit |