Skip to content

Instantly share code, notes, and snippets.

View jfro's full-sized avatar
🎉
Being rusty

Jeremy Knope jfro

🎉
Being rusty
View GitHub Profile
@beardicus
beardicus / edgerouter-qos
Last active September 14, 2024 06:31
EdgeRouter Lite QOS Settings
#
# 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
#!/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
@simonwhitaker
simonwhitaker / git-is-ancestor
Last active April 5, 2022 08:01
A script to determine whether one git commit is the ancestor of another
#!/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]
@pgor
pgor / NSMutableURLRequest+CacheControl.m
Last active November 7, 2020 01:41
NSURL mechanism doesn't automatically set last-modified or etag headers, so this category does if the cache contains cached responses.
//
// 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
@ccgus
ccgus / gist:3238464
Created August 2, 2012 16:37
FMDB custom functions
[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));
<?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");
@PsychoH13
PsychoH13 / PSYBlockTimer.h
Created December 7, 2009 06:19
Fire an NSTimer using a block as execution code.
/*
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