Skip to content

Instantly share code, notes, and snippets.

@fangj99
fangj99 / phpzmqinstall.sh
Created March 21, 2016 01:35 — forked from Kamisama666/phpzmqinstall.sh
Installation of ZeroMQ and php-zmq extension on Ubuntu 14.04. Must be run as root
#!/bin/bash
cd /tmp
apt-get update
apt install -y libtool pkg-config build-essential autoconf automake uuid-dev git wget
git clone git://github.com/jedisct1/libsodium.git
cd libsodium/
./autogen.sh
./configure && make check
make install
ldconfig
@fangj99
fangj99 / functions.php
Created April 7, 2016 18:29 — forked from thedannywahl/functions.php
local WP only w/ JetPack
// REMOVE WP.COM CALL FOR JETPACK
// STUPID WORDPRESS JETPACK USAGE STATS...
add_action('wp_enqueue_scripts', create_function(null, "wp_dequeue_script('devicepx');"), 20);
add_action('admin_enqueue_scripts', create_function(null, "wp_dequeue_script('devicepx');"), 20);
// REMOVE SHARE COUNTS FROM JETPACK
// THESE CALL api.facebook.com AND api.twitter.com
// SHARE BUTTONS ARE STILL THERE, JUST NO COUNTS. NBD.
add_filter( 'jetpack_sharing_counts', '__return_false' );
@fangj99
fangj99 / wc_customer_bought_product.php
Created April 7, 2016 21:04 — forked from codearachnid/wc_customer_bought_product.php
WooCommerce check if user has already bought product.
<?php
// if product is already in global space
global $product;
// or fetch product attributes by ID
if( empty( $product->id ) ){
$wc_pf = new WC_Product_Factory();
$product = $wc_pf->get_product($id);
}
@fangj99
fangj99 / app.yml
Created April 20, 2016 00:43
Discourse app.yml AWS setup
# IMPORTANT: SET A SECRET PASSWORD in Postgres for the Discourse User
# TODO: change SOME_SECRET in this template
templates:
- "templates/sshd.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
expose:
- "80:80"
@fangj99
fangj99 / bilibili.zsh
Created May 25, 2016 04:41 — forked from quxiaowei/bilibili.zsh
从哔哩哔哩下载剧,并将视屏片段合并 需要:youtube-dl, ffmpeg
for i in {1..12}
do
url=http://www.bilibili.com/video/av3794937/index_$i.html
echo $url
youtube-dl -o "SeGmEnT-$i-%(playlist_index)s.%(ext)s" $url
rm -f buffer_list
touch buffer_list
for file in $(ls SeGmEnT-$i-*.flv)
do
echo file "'$file'" >> buffer_list
@fangj99
fangj99 / doxygen_integration
Created June 20, 2016 18:01 — forked from efreed/doxygen_integration
Wordpress plugin to read zip'd website into a shortcode
<?php
/**
* Plugin Name: DoxyGen Integration
* Plugin URI: http://www.fivetalent.com/
* Description: Enables shortcodes to embed a doxygen site into a page
* Version: 1.0
* Author: Eric Freed / Five Talent
*/
@fangj99
fangj99 / Install.md
Created August 16, 2016 05:11 — forked from zhiephie/Install.md
Installing nginx, php7-fpm with opcache, memcached, phpredis and xdebug extension on Centos 7

run ./setup.sh

Install Nginx

# yum repository  
$ vim /etc/yum.repos.d/nginx.repo
  [nginx]
  name=nginx repo
  baseurl=http://nginx.org/packages/centos/7/$basearch/
 gpgcheck=0
# device_id, sid, uid 需要自己先抓包获取到
# game_mode 1是无尽模式 2是限时模式
import hashlib
import hmac
import base64
import requests
def data_to_string(data):
@fangj99
fangj99 / main.py
Created September 17, 2016 23:58 — forked from littlecodersh/main.py
Main script behind itchat robot
#!python3
import itchat
# tuling plugin can be get here:
# https://github.com/littlecodersh/EasierLife/tree/master/Plugins/Tuling
from tuling import get_response
@itchat.msg_register('Text')
def text_reply(msg):
if '作者' in msg['Text'] or '主人' in msg['Text']:
return '你可以在这里了解他:https://github.com/littlecodersh'
@fangj99
fangj99 / novel.json
Created October 1, 2016 22:26 — forked from okoala/novel.json
小说下载
{
"不败战神": {
"url": "http://www.23us.com/html/27/27736/",
"bookmark": "第两百八十八节 唐天的判断"
},
"大主宰": {
"url": "http://www.23us.com/html/28/28373/",
"bookmark": "第一百九十五章 取巧"
},
"神级英雄": {