Skip to content

Instantly share code, notes, and snippets.

View HamGuy's full-sized avatar
🎯
Focusing

HamGuy HamGuy

🎯
Focusing
View GitHub Profile
@HamGuy
HamGuy / with.swift
Created November 2, 2016 02:33 — forked from erica/with.swift
// @discardableResult to be added
// @noescape needs to move to type annotation
// needs to add _ for item
public func with<T>(item: T, @noescape update: (inout T) throws -> Void) rethrows -> T {
var this = item; try update(&this); return this
}
@HamGuy
HamGuy / changeIP.bat
Created July 28, 2016 07:16
批处理脚本-快速改变 IP 地址
@echo off
echo **************************************************************************
echo * 修改IP地址、DNS *
echo * *
echo **************************************************************************
echo 正在修改IP地址和DNS服务器地址,请耐心等待…………
echo 正在更改本机IP地址...
netsh interface ipv4 set address name="本地连接" source=static addr=192.168.1.100 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=0 >nul
echo 正在添加本机首选DNS服务器...
netsh interface ipv4 set dns name="本地连接" source=static addr=202.96.134.133 register=PRIMARY
@HamGuy
HamGuy / SerialPort.cs
Last active July 28, 2016 02:02
C# SerialPort 操作封装 来源:http://www.codefans.net/articles/453.shtml
using System;
using System.Collections.Generic;
using System.Text;
using System.IO.Ports;
using System.Globalization;
namespace SerialClass
{
public class SerialClass
{
SerialPort _serialPort = null;
@HamGuy
HamGuy / ss.conf
Last active May 30, 2016 13:31
ss.conf
[General]
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
loglevel = notify
[Proxy]
Proxy = custom,IP,aes-256-cfb,port,http://nat.pw/ss.module
[Rule]
# 规则配置仅供参考,适用于Surge iOS 1.2.3 (563) 及其后续版本;
# 包含 Proxy Group、URL Rewrite 特性;
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计;
# 屏蔽 Hao123、百度联盟广告以及部分运营商网页漂浮广告;
# Surge 新手使用指南 http://bit.ly/1q5eTlF
[General]
# warning, notify, info, verbose
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0/96
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify
@HamGuy
HamGuy / surge.conf
Created May 12, 2016 02:03 — forked from blackgear/surge.conf
Surge config for new user
[General]
loglevel = warning
bypass-system = true
skip-proxy = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,*.lan
bypass-tun = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12
dns-server = 114.114.114.114,114.114.115.115
[Proxy]
PROXY = custom,服务器地址,服务器端口,加密方式,密码,模块地址,tcp-fast-open=true
@HamGuy
HamGuy / AppDelegate.swift
Created December 24, 2015 02:32 — forked from robrasmussen/AppDelegate.swift
Example for how to set up a UIAppearance proxy specific to one controller in Swift
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
UIButton.appearanceProxyIn(ViewController).backgroundColor = UIColor.redColor()
UIButton.appearanceProxyIn(ViewController).tintColor = UIColor.yellowColor()
@HamGuy
HamGuy / RBResizer.swift
Created November 20, 2015 02:10 — forked from HamptonMakes/RBResizer.swift
Swift Image Resizer
//
// RBResizer.swift
// Locker
//
// Created by Hampton Catlin on 6/20/14.
// Copyright (c) 2014 rarebit. All rights reserved.
//
import UIKit
@HamGuy
HamGuy / mail.py
Created May 27, 2015 01:24
Send Mail With Python
#account info mation
sender = "xxx@xxx.xx"
pwd = "xxxxxxxx"
receiver = "xxx@xxx.xx"
subject = "Subject"
#get UpdateTips
fp = open(updateTipFileName,'rb')
mailContent = fp.read()
fp.close()
@HamGuy
HamGuy / ShellScript.h
Last active August 29, 2015 14:19 — forked from asus4/ShellScript.h
//
// ShellScript.h
//
// Created by Koki Ibukuro on 6/18/14.
// Copyright (c) 2014 Koki Ibukuro. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void (^ShellScriptMessageCallback)(NSString* msg);