Skip to content

Instantly share code, notes, and snippets.

本脚本适用环境
系统支持:CentOS 6+,Debian 7+,Ubuntu 12+
内存要求:≥128M
日期  :2017 年 10 月 22 日
##### 关于本脚本
1、一键安装 Shadowsocks-Python, ShadowsocksR, Shadowsocks-Go, Shadowsocks-libev 版(四选一)服务端;
2、各版本的启动脚本及配置文件名不再重合;
3、每次运行可安装一种版本;
4、支持以多次运行来安装多个版本,且各个版本可以共存(注意端口号需设成不同);
var CryptoJS = require('crypto-js')
var request = require('request-promise')
/*
* npm install crypto-js request-promise request
* node wx_t1t_hack.js
*/
// export function testEncription(msg, fullKey) {
// var fullKey = fullKey.slice(0, 16)
#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)
@fdiaz
fdiaz / StyleType.swift
Created December 16, 2015 00:39
Style UINavigationBar using protocol extensions
internal protocol StyleType {
var tintColor: UIColor { get }
}
internal struct SomeStyle: StyleType {
let tintColor = UIColor.redColor()
}
internal struct SomeOtherStyle: StyleType {
let tintColor = UIColor.whiteColor()
@pai911
pai911 / UINavigationBarTaller.swift
Last active August 27, 2016 19:16
Custom Navigation Bar with increased height (tested on iOS 8.0)
//
// UINavigationBarTaller.swift
//
import UIKit
class UINavigationBarTaller: UINavigationBar {
///The height you want your navigation bar to be of
static let navigationBarHeight: CGFloat = 64
[_textField addTarget:self
action:@selector(textFieldEditingChangedAction:)
forControlEvents:UIControlEventEditingChanged];
//实时查看内容 限定字符
- (void)textFieldEditingChangedAction:(UITextField *)textField {
NSString *toBeString = textField.text;
if ([textField.textInputMode.primaryLanguage isEqualToString:@"zh-Hans"]) { // 简体中文输入,包括简体拼音,健体五笔,简体手写
UITextRange *selectedRange = [textField markedTextRange];
//获取高亮部分
@rnystrom
rnystrom / iOS @3x assets script
Created November 26, 2014 01:52
Save this shell script to generate @2x and 1x PNG assets for your apps. Requires Imagemagick (http://www.imagemagick.org/). These will probably look shitty and blurred.
#!/bin/sh
# Example usage
# cd into directory that has @3x images
# ./whatever-you-name-this.sh
# Remember to chmod +x the script
resize () {
ls *@3x.png | awk '{print("convert "$1" -filter box -resize '$1' "$1)}' | sed 's/@3x/'$2'/2' | /bin/sh
}
@panzi
panzi / portable_endian.h
Last active August 9, 2024 13:12
This provides the endian conversion functions form endian.h on Windows, Linux, *BSD, Mac OS X, and QNX. You still need to use -std=gnu99 instead of -std=c99 for gcc. The functions might actually be macros. Functions: htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh, htobe64, htole64, be64toh, le64toh. License: I hereby put …
// "License": Public Domain
// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
// an example on how to get the endian conversion functions on different platforms.
#ifndef PORTABLE_ENDIAN_H__
#define PORTABLE_ENDIAN_H__
#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
@neekey
neekey / gist-blog-cleanup_install_ruby_manually.md
Last active August 11, 2024 13:53
Mac下手动清理/安装Ruby

本文介绍如何在Mac OSX下手动清理和安装Ruby。献给所有不怎么懂Ruby,但是又时常为Ruby纠结的人。

清理

所谓清理的话,其实只要看看Ruby在安装的时候做了什么就好了。好在Ruby自己源码安装的时候很体贴地会把自己干的事情总结出来:

installing binary commands:   /usr/local/bin
installing base libraries:    /usr/local/lib
installing arch files:        /usr/local/lib/ruby/1.9.1/x86_64-darwin12.2.0