Skip to content

Instantly share code, notes, and snippets.

@andriitishchenko
andriitishchenko / Communicator.h
Created August 11, 2021 08:02 — forked from eugenehp/Communicator.h
How to open a TCP socket in Objective-C
#import <Foundation/Foundation.h>
@interface Communicator : NSObject <NSStreamDelegate> {
@public
NSString *host;
int port;
}
- (void)setup;
/* example usage */
JFFollowRedirect* follower = [[JFFollowRedirect alloc] init];
[follower addObserver:self forKeyPath:@"redirectStr" options:NSKeyValueObservingOptionNew
context:follower];
// follow redirect
[follower getRedirectURLStr:urlToFollow];
/ * header */
#import <Foundation/Foundation.h>
@andriitishchenko
andriitishchenko / .proxy_helper
Last active December 12, 2022 21:37 — forked from refo/macOS proxy settings from terminal.md
macOS proxy settings from terminal
# Macos Proxy Helper (networksetup wraper)
# add this line to $HOME/.zshrc
#
# source "$HOME/.proxy_helper"
#
# usage :
# proxy < | up | down > [-all || -http|-https|-socks|-ftp|-stream ]
# proxy set <destination> <port> [-http|-https|-socks|-ftp|-stream || -all]'