Skip to content

Instantly share code, notes, and snippets.

View zengxs's full-sized avatar

Xiangsong Zeng zengxs

  • Singapore/London
  • 08:15 (UTC +08:00)
View GitHub Profile
@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'];
#!/usr/bin/env python3
###
# START pandocfilters.py
###
# Author: John MacFarlane <jgm@berkeley.edu>
# Copyright: (C) 2013 John MacFarlane
# License: BSD3
<?php
final class DiffusionReadmeView extends DiffusionView {
private $path;
private $content;
public function setPath($path) {
$this->path = $path;
return $this;
@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
@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 / README.md
Last active October 23, 2020 03:33
GitLab 安装配置流程

GitLab 安装配置流程

基于 CentOS 8.2 安装。其中,redis 和 postgresql 组件将由我们自己配置,而不使用 gitlab 的 docker 镜像中打包的版本。

gitlab 套件中的 nginx 将绑定到 127.0.0.1:8081 端口;gitlab 的 ssh 将绑定到 0.0.0.0:2222 端口。

注意需要关闭 CentOS 的 SELinux,SELinux 过于严苛的安全策略会给安装过程带来很多不必要的麻烦; 在系统安全方面,这里将启用 firewalld 防火墙,这种安全策略,对于仅安装了 gitlab 的服务器来说已经足够。

安装 Redis

#!/usr/local/bin/ruby
#
# revealer.rb -- Deobfuscate GHE .rb files.
#
# This is simple:
# Every obfuscated file in the GHE VM contains the following code:
#
# > require "ruby_concealer.so"
# > __ruby_concealer__ "..."
@zengxs
zengxs / renew-ssl.sh
Created February 1, 2021 03:53
SSL certificates renew script for ZeroSSL using lego.
#!/bin/sh
export CLOUDFLARE_EMAIL='[REDACT: your cloudflare email]'
export CLOUDFLARE_API_KEY='[REDACT: your cloudflare api key]'
lego \
--server https://acme.zerossl.com/v2/DV90 \
--accept-tos \
--path /srv/lego \
--eab \
%YAML 1.2
---
# https://www.sublimetext.com/docs/3/syntax.html
name: Nim
file_extensions: [nim, nims]
scope: source.nim
contexts:
main:
- include: comments
@zengxs
zengxs / App.vue
Created May 13, 2021 03:20
rust server side render (ssr) bench
<template>
<div id="app">
<h1>Hello</h1>
</div>
</template>
<script>
export default {
name: "App",
};