Skip to content

Instantly share code, notes, and snippets.

View JimLiu's full-sized avatar
🐶
Yesterday is history, tomorrow is a mystery, and today is a gift

Jim Liu 宝玉 JimLiu

🐶
Yesterday is history, tomorrow is a mystery, and today is a gift
View GitHub Profile

Install with Homebrew

brew install mysql

Set up launchctl to auto start mysql

$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

/usr/local/opt/mysql/ is a symlink to /usr/local/Cellar/mysql/x.y.z (e.g., 5.6.16)

Install with Homebrew

brew install redis

Set up launchctl to auto start redis

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

/usr/local/opt/redis/ is a symlink to /usr/local/Cellar/redis/x.y.z (e.g., 2.8.7)

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

"use strict";
var http = require("http");
var url = require("url");
var publicIp;
var fakeIp = "220.181.111." + Math.floor(Math.random() * 254 + 1);
var server = http.createServer(function(request, response) {
console.log("[%s] %s", request.method, request.url);
@JimLiu
JimLiu / README.md
Created October 22, 2015 00:50 — forked from nicerobot/README.md
Mac OS X uninstall script for packaged install of node.js

To run this, you can try:

curl -ks https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh

chmod +x ./uninstall-node.sh

@JimLiu
JimLiu / Gulpfile.js
Created December 26, 2015 07:04 — forked from webdesserts/Gulpfile.js
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.
@JimLiu
JimLiu / 0_reuse_code.js
Created January 19, 2016 07:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@JimLiu
JimLiu / _db.js
Last active January 30, 2016 17:44
Sql helper for operating mysql on node
import mysql from 'mysql';
import moment from 'moment';
import config from './config';
import logger from './logger';
export default class DB {
constructor() {
}
@JimLiu
JimLiu / nginx.conf
Created August 24, 2018 16:05
reverse proxy for 163 music
# Cahce
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=24h max_size=1g;
server {
listen 80;
server_name music.163.com;
resolver 114.114.114.114 223.5.5.5;
access_log /var/log/nginx/access_163.log;
location /weapi/feedback/weblog {
add_header Set-Cookie "os=uwp; path=/";
error_page 405 = $uri;
sudo lsof -n -i4TCP:8081 # get the process' PID
sudo launchctl list | grep <PID> # find the launchd endpoint
sudo launchctl remove com.mcafee.agent.macmn