Skip to content

Instantly share code, notes, and snippets.

View zengxs's full-sized avatar

Xiangsong Zeng zengxs

  • Singapore/London
  • 17:42 (UTC +08:00)
View GitHub Profile
@zengxs
zengxs / install-phabricator.sh
Last active March 4, 2021 05:48
Install phabricator in a few minutes for CentOS 8
#!/bin/sh
#
# Interactive script for phabricator installation, setup phabricator in a few minutes
# * Support CentOS 8 only
# * Require a valid SSL certificate
# * Require run as root
# * Will execute some dangerous operations
# * May damage your system
# * Without warranty of any kind
#
@zengxs
zengxs / phabricator-configuration.md
Last active July 9, 2020 10:07
Phabricator configuration
apache ALL=(phd) SETENV: NOPASSWD: /usr/bin/git, /usr/bin/git-upload-pack, /usr/bin/git-receive-pack
git ALL=(phd) SETENV: NOPASSWD: /usr/bin/git, /usr/bin/git-upload-pack, /usr/bin/git-receive-pack

phd.service

# Systemd unit file for phd
[Unit]
Description=Phabricator Daemon
<?php
final class DiffusionReadmeView extends DiffusionView {
private $path;
private $content;
public function setPath($path) {
$this->path = $path;
return $this;
#!/usr/bin/env python3
###
# START pandocfilters.py
###
# Author: John MacFarlane <[email protected]>
# Copyright: (C) 2013 John MacFarlane
# License: BSD3
@zengxs
zengxs / info.php
Created April 12, 2020 06:13
`php_info` page with HTTP Basic Auth
<?php
$credentials = array(
'admin' => 'your_password',
);
$valid_users = array_keys($credentials);
$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
@zengxs
zengxs / PhabricatorSimplifiedChineseTranslation.php
Created March 9, 2020 16:10
Phabricator 简易中文翻译
<?php
// Phabricator 中文翻译
//
// 安装位置: {phabricator_root}/src/extension/PhabricatorSimplifiedChineseTranslation.php
//
// Ref: https://github.com/arielyang/phabricator_zh_Hans
final class PhabricatorSimplifiedChineseTranslation extends PhutilTranslation {
public function getLocaleCode() {
return 'zh_Hans';
@zengxs
zengxs / proxy_socks2http.py
Created November 5, 2019 13:53
Convert socks proxy to http proxy (use python with asyncio)
import asyncio
import logging
import re
from asyncio import StreamReader, StreamWriter, StreamReaderProtocol
from collections import namedtuple
from typing import Optional
import socks # use pysocks
logging.basicConfig(level=logging.INFO)
@zengxs
zengxs / test_socks5_to_tcp.py
Created November 5, 2019 12:51
Use python asyncio module to unwrap socks5 proxy socket
import asyncio
import logging
from asyncio import StreamReader, StreamWriter, StreamReaderProtocol
from typing import Optional
import socks
logging.basicConfig(level=logging.INFO)
@zengxs
zengxs / mandarin.txt
Created September 1, 2019 04:28
通用规范汉字表汉字
一丁七万丈三上下不与丏丐丑专且丕
世丘丙业丛东丝丞丢两严丧个丫中丰
串临丸丹为主丽举乂乃久么义之乌乍
乎乏乐乒乓乔乖乘乙乜九乞也习乡书
乩买乱乳乸乾了予争事二亍于亏云互
亓五井亘亚些亟亡亢交亥亦产亨亩享
京亭亮亲亳亵亶亸亹人亿什仁仂仃仄
仅仆仇仉今介仍从仑仓仔仕他仗付仙
仝仞仟仡代令以仨仪仫们仰仲仳仵件
价任份仿企伈伉伊伋伍伎伏伐休众优
#!/bin/sh
sudo dd if=/dev/zero of=/swapfile bs=1M count=1024 # 1G
sudo chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo /swapfile none swap sw 0 0 | sudo tee -a /etc/fstab