Skip to content

Instantly share code, notes, and snippets.

@hstdt
hstdt / ANSI.md
Created April 11, 2023 04:11 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@hstdt
hstdt / upgrade.sh
Created January 30, 2019 02:41
[Phabricator+Mamp Upgrade]
#!/bin/sh
set -e
set -x
# This is an example script for updating Phabricator, similar to the one used to
# update <https://secure.phabricator.com/>. It might not work perfectly on your
# system, but hopefully it should be easy to adapt. This script is not intended
# to work without modifications.
@hstdt
hstdt / build_pcntl.sh
Created September 30, 2018 05:32 — forked from jbanety/build_pcntl.sh
Build PCNTL ext for MAMP PHP 7.1.1
# Command lines tools
xcode-select --install
# Install dependencies
brew install wget autoconf openssl libjpeg libpng lzlib curl imap-uw readline postgresql libxml2 mcrypt gettext libxslt homebrew/dupes/libiconv icu4c expat bison webp freetype
# Dirs
mkdir -p /Applications/MAMP/bin/php/php7.1.1/include
cd /Applications/MAMP/bin/php/php7.1.1/include
@hstdt
hstdt / ColorDescriptor.swift
Created November 8, 2016 02:53 — forked from loganwright/ColorDescriptor.swift
Color Descriptor
enum ColorDescriptor {
case PatternImage(imageName: String)
case RGB(r: Int, g: Int, b: Int, a: Int)
}
extension ColorDescriptor : StringLiteralConvertible, RawRepresentable, Equatable {
typealias RawValue = StringLiteralType
typealias ExtendedGraphemeClusterLiteralType = StringLiteralType
typealias UnicodeScalarLiteralType = StringLiteralType
@hstdt
hstdt / libReveal.plist
Created July 25, 2016 12:58 — forked from ParsifalC/libReveal.plist
Reveal 越狱机子
{
Filter = {
Bundles = (
"com.sina.weibo",
"com.tencent.xin",
"com.tencent.mqq",
"com.apple.AppStore",
);
};
}
@hstdt
hstdt / StringExtensionHTML.swift
Created May 11, 2016 05:05 — forked from mwaterfall/StringExtensionHTML.swift
Decoding HTML Entities in Swift
// Very slightly adapted from http://stackoverflow.com/a/30141700/106244
// 99.99% Credit to Martin R!
// Mapping from XML/HTML character entity reference to character
// From http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
private let characterEntities : [String: Character] = [
// XML predefined entities:
"&quot;" : "\"",
"&amp;" : "&",
@hstdt
hstdt / gist:f0f4530bc0648bcbf0eb3ff12b14605b
Created April 14, 2016 06:33 — forked from ethanbing/gist:9887461
获得appDelegat单例对象
+ (AppDelegate *)sharedAppDelegate {
return (AppDelegate *)[[UIApplication sharedApplication] delegate];
}
@hstdt
hstdt / gist:e7a71c036f49cc39a67741137f5e70f2
Created April 14, 2016 06:32 — forked from ethanbing/gist:10970615
iOS 常用数学函数
1、 三角函数 
  double sin (double);正弦 
  double cos (double);余弦 
  double tan (double);正切 
  2 、反三角函数 
  double asin (double); 结果介于[-PI/2, PI/2] 
  double acos (double); 结果介于[0, PI] 
  double atan (double); 反正切(主值), 结果介于[-PI/2, PI/2] 
  double atan2 (double, double); 反正切(整圆值), 结果介于[-PI, PI] 
  3 、双曲三角函数 
# Surge for Mac 配置文件
# 显示 Finder 隐藏文件,将 .surge.conf 文件复制到 ~/ 也就是「个人」目录下。
[General]
# warning, notify, info, verbose
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify
# 默认 IP 和端口,不修改的话系统网络 HTTP 和 HTTPS 代理设置中就是 127.0.0.1:6152
@hstdt
hstdt / 0_reuse_code.js
Created February 19, 2016 02:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console