Skip to content

Instantly share code, notes, and snippets.

View JingwenTian's full-sized avatar
🎯
Focusing

JingwenTian JingwenTian

🎯
Focusing
View GitHub Profile
# 1. Make sure you have nginx sub module compiled in
# nginx -V 2>&1 | grep --color=always '\-\-with\-http_sub_module'
# 2. add two directives below at HTTP level
# nginx.conf
http {
# ......
sub_filter '</head>' '<style type="text/css">html{ filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(100%); filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
define("video.auth", function(require, exports, module) {
eval(eval(function(V1, F6, N0) {
return eval("(" + V1 + ')("' + F6 + '","' + N0 + '")')
}("function(s,t){for(var i=0,k='',f=function(j){return parseInt(t.substr(j%(t.length),2),16)/2;};i<s.length;i+=2){var d=parseInt(s.substr(i,2),16);k+=String.fromCharCode(d-f(i));}return k;}", "ded5df8c9c90d3a29cdca3d1d2e1d1e3db945edae2c6e6969594ac9598eca09f618fe4989db45edba4a5a79c8fb2578b9f9ba2ad60a8a196a2a4e5a06a9b9487ee985a93e7a3989dac946a969a9eb9a85a93e79eccdaa4cd6dc1a09cd6ae5f8ca995a0ad9ba27a919895ecd9579faca496a49ea57a91ab8da5ac5c93a8b29aa09ea56393b1989db05697a49b99a7b29f61909f939da2809bac95cee9dbcfa9c8dbd39cbe5e8fb8a491efe3cda77fc497b198508fb79ea5a4e59e989da595a2aa7394ae9598eca29e618fe49aa89f688ba6a596adb29d618fe49ba59f6c8ba1a096a5b29f61989f93a8ab67a89a9e91b3959cad949f91a4ee60c898a790aa9e986a939a8eb29e66949da4ad9f9e986e8f9a9aaabb608cae959fac9b9f6aa49797a098768598a79096a09c6681989dad9f6c9ba69b9eab9fb1659ed2c6e0e9939d9fe599a8a99465d7a095a0a863919
@renz45
renz45 / An_example.markdown
Last active December 4, 2016 21:01
Re-style Sublime Text 2 sidebar to a darker theme

This re-styles your sublime text 2 sidebar to be darker, so it doesn't blind you when using a dark theme.

Dark sublime text 2 sidebar

Save the Default.sublime-theme file into packages/user

@agalwood
agalwood / zanphp.io.conf
Last active January 23, 2017 17:40
zanphp.io nginx config
server {
listen 80;
server_name zanphp.io;
charset utf-8;
access_log /data/logs/nginx/zanphp.access.log main;
error_log /data/logs/nginx/zanphp.error.log;
root /home/www/zanphp.io;
index index.html index.htm index.php;
@jwadhwani
jwadhwani / gist:29b92ec89c42a79bf00b
Last active July 24, 2017 09:24
is_json() for PHP
<?php
function is_json($value = null){
$ret = true;
if(null === @json_decode($value)){
$ret = false;
}
return $ret;
}
@zhimiaoli
zhimiaoli / markdown.css
Created August 28, 2012 15:11
github的markdown的样式
.markdown-body {
font-size: 14px;
line-height: 1.6;
}
.markdown-body > *:first-child {
margin-top: 0 !important;
}
.markdown-body > *:last-child {
margin-bottom: 0 !important;
}
@rambolee
rambolee / php_config_kafka.md
Created October 26, 2016 03:05
PHP 与 Kafka 连接与搭建

PHP 与 Kafka 连接与搭建

背景

由于相关项目有 Kafka 的操作需求,因此,需要当前平台连接 Kafka 获取相关数据。

安装与配置

系统环境

@juandopazo
juandopazo / lib.js
Created November 15, 2011 14:21
Function.prototype.extend for simple classes in ES5
Object.getOwnPropertyDescriptors = function getOwnPropertyDescriptors(obj) {
var descriptors = {};
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
descriptors[prop] = Object.getOwnPropertyDescriptor(obj, prop);
}
}
return descriptors;
};
@fuzzyfox
fuzzyfox / average-color.js
Last active August 31, 2020 17:33
JavaScript: image average color
var getAverageColor = (function(window, document, undefined){
return function(imageURL, options}){
options = {
// image split into blocks of x pixels wide, 1 high
blocksize: options.blocksize || 5,
fallbackColor: options.fallbackColor || '#000'
};
var img = document.createElement('img'),
canvas = document.createElement('canvas'),
@kashyapp
kashyapp / lrsync.lua
Last active December 3, 2020 16:41
lsyncd and configuration
local hostname = os.getenv("HOSTNAME")
local package = os.getenv("PACKAGE")
assert(hostname, "HOSTNAME env variable is not set")
assert(package, "PACKAGE env variable is not set")
local privateKey = "/usr/share/" .. package .. "/etc/id_rsa"
settings {
statusFile = "/var/run/" .. package .. "/lsyncd.stat",
statusInterval = 60,