Skip to content

Instantly share code, notes, and snippets.

View tranch's full-sized avatar
🎯
Focusing

Tranch tranch

🎯
Focusing
View GitHub Profile
@tranch
tranch / re-sign iOS IPA
Created September 27, 2022 14:31 — forked from lodalo/re-sign iOS IPA
Steps to re-sign an IPA file with a new provisioning profile
#Unzip the IPA
unzip Application.ipa
#Remove old CodeSignature
rm -R "Payload/Application.app/_CodeSignature"
#Replace embedded mobile provisioning profile
cp "path-to-provisioning-profile/MyEnterprise.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
#If you are resigning to submit to the AppStore you need to extract the entitlements to use later
@tranch
tranch / ideolog-monolog.md
Last active July 30, 2019 05:53 — forked from mysiar/ideolog-monolog.md
Monolog template for Ideolog
  • Message pattern: ^\[(.*)\] (.+?)\.([A-Z]+): (.*)
  • Message start pattern: ^\[
  • Time format: yyyy-MM-dd HH:mm:ss
  • Time capture group: 1
  • Severity capture group: 3
  • Category capture group: 2
@tranch
tranch / docstring.vim
Last active February 28, 2018 03:24 — forked from vpetro/gist:1204166
add docstring for python function in vim
function! WriteParams()
python << endpython
import re
import vim
# get the function definition line
line = vim.eval("getline(line('.'))")
# get the number of spaces to add to the start of the line
num_spaces = 4 + len(line) - len(line.lstrip())
# get the line number wher to do the insertion

ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
@tranch
tranch / ufw_centos.md
Last active March 1, 2018 07:14 — forked from ianchen06/ufw_centos.md
Setting up ufw on Centos

iptablesを直接いじりたくないのでufwを導入します。

sudo yum install wget make
mkdir -p ~/src
cd ~/src
wget https://launchpad.net/ufw/0.33/0.33/+download/ufw-0.33.tar.gz
tar xzf ufw-0.33.tar.gz
cd ufw-0.33
sudo python ./setup.py install
import requests
from db import db
"""
The Douban Group API which not display on http://developers.douban.com/wiki/?title=api_v2
Base url: https://api.douban.com/v2
Group info: /group/:id
@tranch
tranch / phpkafka.php
Last active February 29, 2016 09:06 — forked from edenhill/phpkafka.php
PHP Kafka new API
<?php
# Kafka configuration (https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md)
$config = [ "metadata.broker.list" => "broker1.example.com", "socket.timeout.ms" => 30000, ... ];
# Create Kafka Producer object.
# Brokers are specified through $config, but we could make it easier for people by having the first
# argument be brokers as well, and rdkafka will use all brokers specified?
$producer = new Kafka::Producer([$brokers,]? $config);
<?php
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;