Skip to content

Instantly share code, notes, and snippets.

@imzhi
imzhi / twitter-proxy.md
Last active November 23, 2022 04:28 — forked from JingwenTian/twitter-proxy.md
nginx反代twitter完整镜像 (原文:http://jude.me/2014/10/04/twitter-mirror-2.html

示例

需要注意的几点

  • content-security-policy这个header要去掉,或者重写进你自己的域名,不然有些浏览器不会加载外部的元素
  • 使用proxy_cookie_domain替换cookies的作用域。twitter返回的cookies作用域是.twitter.com,也就是twitter.com的所有二级域名都可以调用,为使用者的安全考虑建议替换成反代所使用的二级域名比如tt.jude.me
@imzhi
imzhi / heart.coffee
Created February 18, 2016 17:04 — forked from weakish/heart.coffee
Matrix digital rain http://jsbin.com/ORIpOxi/
# Preview: http://jsbin.com/bijag
c = document.getElementById('c')
ctx = c.getContext('2d')
# full screen
c.height = window.innerHeight
c.width = window.innerWidth
@imzhi
imzhi / app.js
Created March 2, 2016 09:50 — forked from yang-wei/app.js
React JS color slider
(function(exports) {
'use strict';
var Slider = React.createClass({
getDefaultProps: function() {
return {
redVal: '',
greenVal: '',
blueVal: ''
@imzhi
imzhi / React sortable
Created March 4, 2016 06:32 — forked from petehunt/React sortable
Here's an example of React + jQuery UI sortable. The key thing to note is that we have the render() method do absolutely nothing and use componentDidUpdate() + React.renderComponent() to proxy updates through to the children. This lets us manage the DOM manually but still be able to use all the React goodies you know and love.
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://fb.me/react-0.5.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script>
</head>
@imzhi
imzhi / nginx-location
Created April 7, 2016 02:20 — forked from luxixing/nginx-location
nginx location 匹配规则
1 普通匹配,遵循最长匹配规则,假设一个请求匹配到了两个普通规则,则选择匹配长度大的那个
例如:
location /{
[matches]
}
location /test{
[matches]
}
2 精确匹配
location = /{
@imzhi
imzhi / tmux-cheatsheet.markdown
Created August 18, 2016 08:17 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@imzhi
imzhi / git-branch-simplify.md
Created November 5, 2016 01:30 — forked from datagrok/git-branch-simplify.md
How to simplify the graph produced by git log --graph

Ideas for improvements to git log --graph

I will maybe someday get around to dusting off my C and making these changes myself unless someone else does it first.

Make the graph for --topo-order less wiggly

Imagine a long-running development branch periodically merges from master. The git log --graph --all --topo-order is not as simple as it could be, as of git version 1.7.10.4.

It doesn't seem like a big deal in this example, but when you're trying to follow the history trails in ASCII and you've got several different branches displayed at once, it gets difficult quickly.

@imzhi
imzhi / nginx.conf
Created January 10, 2017 16:00 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@imzhi
imzhi / ssh_config
Created March 28, 2020 07:32 — forked from rbenaley/ssh_config
GitHub ssh access via HTTP Proxy
host github.com
user git
hostname ssh.github.com
port 443
proxycommand socat - PROXY:<hostname>:%h:%p,proxyport=<port>
@imzhi
imzhi / .tmux.conf
Created May 23, 2020 02:19 — forked from tsl0922/.tmux.conf
vim style tmux config
# vim style tmux config
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."