Skip to content

Instantly share code, notes, and snippets.

@mskutta
mskutta / EdgeRouter_IPv6_Commands_for_Comcast.txt
Last active December 6, 2023 02:11
EdgeRouter IPv6 Commands for Comcast
configure
# Configure Firewall
set firewall ipv6-name IPV6WAN_IN description 'IPV6WAN to internal'
set firewall ipv6-name IPV6WAN_IN default-action drop
set firewall ipv6-name IPV6WAN_IN rule 10 action accept
set firewall ipv6-name IPV6WAN_IN rule 10 state established enable
set firewall ipv6-name IPV6WAN_IN rule 10 state related enable
set firewall ipv6-name IPV6WAN_IN rule 10 log disable
// Copyright (c) 2012-2013 Peter Steinberger (http://petersteinberger.com)
//
// 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 conditions:
//
// The above copyright notice and this permission notice shall be included in
@Overbryd
Overbryd / path-in-mac-osx-10.7.mdown
Created January 24, 2012 09:58
Correcting $PATH in MacOSX 10.7 for homebrew

$PATH in MacOSX 10.7

MacOSX has a truly global path setting that precedes any other setting like ~/.bash_profile. The file /private/etc/paths is a list of pathnames. The order from top to bottom defines the resulting order in the $PATH variable. After loading /private/etc/paths there is a directory /private/etc/paths.d/ with files in the same style. Those are appended to the $PATH variable.

The default content of /private/etc/paths looks like this:

/usr/bin

/bin

@krzysztofzablocki
krzysztofzablocki / gist:4396302
Last active November 24, 2021 19:17
Set symbol breakpoint on objc_msgSend then setup this debug command to log all methods called in iOS Simulator. If you want to do device debugging change esp+4 register to r0, esp+8 to r1 Found long ago somewhere on stackoverflow.
expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) )
@davedelong
davedelong / gist:7371853
Last active May 16, 2020 02:51
Delegate proxying (`protocol_methodForEach()` is a custom function that does just what its name implies)
@interface DDDelegateProxy : NSProxy
+ (id)proxyForDelegate:(id)delegate conformingToProtocol:(Protocol *)protocol;
@property (weak, readonly) id delegate;
@property (strong, readonly) Protocol *protocol;
/*!
* Set a default return value for a method on the delegate's protocol.
* \param value This must be a block that returns the default value. Bad Things will happen if it's not.
@alanzeino
alanzeino / Strong UINavigationBar colour
Last active April 26, 2020 23:34
Combining a strong colour with a blurred and translucent UINavigationBar in iOS 7.
// cheers to @stroughtonsmith for helping out with this one
UIColor *barColour = [UIColor colorWithRed:0.13f green:0.14f blue:0.15f alpha:1.00f];
UIView *colourView = [[UIView alloc] initWithFrame:CGRectMake(0.f, -20.f, 320.f, 64.f)];
colourView.opaque = NO;
colourView.alpha = .7f;
colourView.backgroundColor = barColour;
self.navigationBar.barTintColor = barColour;
@cppforlife
cppforlife / gist:1269501
Created October 7, 2011 05:09
objective-c debugging env variables
[schwa@ungoliant] ~$ export OBJC_HELP=1
[schwa@ungoliant] ~$ /Applications/Safari.app/Contents/MacOS/Safari
objc[10559]: Objective-C runtime debugging. Set variable=YES to enable.
objc[10559]: OBJC_HELP: describe available environment variables
objc[10559]: OBJC_PRINT_OPTIONS: list which options are set
objc[10559]: OBJC_PRINT_IMAGES: log image and library names as they are loaded
objc[10559]: OBJC_PRINT_LOAD_METHODS: log calls to class and category +load methods
objc[10559]: OBJC_PRINT_INITIALIZE_METHODS: log calls to class +initialize methods
objc[10559]: OBJC_PRINT_RESOLVED_METHODS: log methods created by +resolveClassMethod: and +resolveInstanceMethod:
objc[10559]: OBJC_PRINT_CLASS_SETUP: log progress of class and category setup
In order for this to work you need ffmpeg. I tried with version 1.2.1.
1) Play the video you want to download in the browser
2) Inspect the video element on the page
3) Copy the video url from the page source (something like http://devstreaming.apple.com/videos/wwdc/2013/.../101/ref.mov)
4) In this url replace "ref.mov" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?)
5) Execute `ffmpeg -y -i http://devstreaming.apple.com/videos/wwdc/2013/.../101/iphone_c.m3u8 output.mp4`
6) There is your video :)
@krzysztofzablocki
krzysztofzablocki / gist:4091783
Created November 16, 2012 23:13
Free memory on iOS
-(float) get_free_memory {
mach_port_t host_port;
mach_msg_type_number_t host_size;
vm_size_t pagesize;
host_port = mach_host_self();
host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
host_page_size(host_port, &pagesize);
vm_statistics_data_t vm_stat;
if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) {
@n-b
n-b / selfcompile.m
Last active April 29, 2019 03:43
A simple self-compiling objective-c file
/*/../bin/ls > /dev/null
COMPILED=${0%.*}
clang $0 -o $COMPILED -framework Foundation;
$COMPILED; rm $COMPILED; exit;
*/
#import <Foundation/Foundation.h>
int main(int argc, char *argv[])