Skip to content

Instantly share code, notes, and snippets.

View mofelee's full-sized avatar
🎯
Focusing

mofelee

🎯
Focusing
View GitHub Profile
@mofelee
mofelee / gist:6c23b1cc3878beaa692cd56bb53d7297
Created April 17, 2016 11:24 — forked from timonwong/gist:eb45ca8b90128f0d49d2
Ubuntu 14.04 mirror using aliyun
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
@mofelee
mofelee / nginxproxy.md
Created February 20, 2016 07:09 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

Handlebars is a semantic web template system, started by Yehuda Katz in 2010.
Handlebars.js is a superset of Mustache, and can render Mustache templates in addition to Handlebars templates.
More: http://handlebarsjs.com/
1. Expressions.
1.1 Basic usage.
function make_promise() {
var status = 'unresolved',
outcome,
waiting = [],
dreading = [];
function vouch (deed, func) {
switch (status) {
case 'unresolved':
(deed === 'fulfilled' ? waiting: dreading).push(func);
@mofelee
mofelee / center.html
Last active September 23, 2015 15:15
把一个层定位在屏幕中间
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>层定位在屏幕中间</title>
<style type="text/css" media="screen">
*{margin:0;padding:0;}
body,html{height:100%;overflow:hidden;}
.body{height:100%;overflow:auto;}
@mofelee
mofelee / mime.types
Last active September 12, 2015 03:45 — forked from zeroasterisk/mime.types
nginx config: /etc/nginx/mime.types
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/rss+xml rss;
@mofelee
mofelee / pg.md
Last active August 29, 2015 14:26
连接用ssh连接到远程postgresql数据库

配置和连接

pg_hba.conf

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

映射远程端口到本地

ssh -L 63333:localhost:5432 root@pg.mofe.me -f -N

@mofelee
mofelee / start.sh
Created August 4, 2015 23:14
安装postgresql(ubuntu14.04)
#!/bin/sh
locale-gen zh_CN.UTF-8
apt-get update
echo 'deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main' > /etc/apt/sources.list.d/pgdg.list
# add key
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
apt-key add -
apt-get update
@mofelee
mofelee / offlineInstallMeteor.sh
Last active November 10, 2021 21:26
离线安装meteor--使用前先把安装包放在同一个文件夹里
#!/bin/sh
# This is the Meteor install script!
#
# Are you looking at this in your web browser, and would like to install Meteor?
# Just open up your terminal and type:
#
# curl https://install.meteor.com/ | sh
#
# Meteor currently supports: