Skip to content

Instantly share code, notes, and snippets.

View lijinma's full-sized avatar

金马 lijinma

View GitHub Profile
var obj1 =
[
{
userid: 'james',
status: 'open',
open_count: 2
},
{
/*
On OS X, basic text manipulations (left, right, command+left, etc) make use of the system key bindings,
and don't need to be repeated here. Anything listed here will take precedence, however.
*/
[
{ "keys": ["super+shift+n"], "command": "new_window" },
{ "keys": ["super+shift+w"], "command": "close_window" },
{ "keys": ["super+o"], "command": "prompt_open" },
{ "keys": ["super+shift+t"], "command": "reopen_last_file" },
{ "keys": ["super+alt+up"], "command": "switch_file", "args": {"extensions": ["cpp", "cxx", "cc", "c", "hpp", "hxx", "h", "ipp", "inl", "m", "mm"]} },
@lijinma
lijinma / addvh.sh
Last active August 29, 2015 13:57
Auto add virtual host for Apache
#! /bin/bash
httpd_conf_file='/etc/apache2/httpd.conf';
hosts_file='/etc/hosts';
server_name='';
function check()
{
if [ "$httpd_conf_file" = "" ]; then
echo "You must config the httpd_conf_file!";
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Drag</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script>
<style>
.b_step33 .block_right .list li { float:left; display:block; line-height:140%; margin-bottom:2px; }
.b_step33 .block_right .list li.dot { height:36px; padding:5px 8px; background:#F5F6FA; }
@lijinma
lijinma / Max sum of sub array
Last active August 29, 2015 14:04
Get max sum of sub array in a array
#include <iostream>
using namespace std;
int maxSumOfSubArray (int * array, int length)
{
int sum = 0;
int result = 0;
for (int index = 0; index < length; index ++) {
if (sum + array[index] > array[index]) {
sum = sum + array[index];
@lijinma
lijinma / bash_aliases
Created July 31, 2014 05:23 — forked from frdmn/bash_aliases
Nginx configuration
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php55.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.restart='mysql.stop && mysql.start'
alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log'
@lijinma
lijinma / gist:4529198
Created January 14, 2013 10:38
The fix of issue when configuration cairo
Issue:
checking for pixman... no
configure: error: pixman >= 0.10.0 is required
(http://cairographics.org/releases/)
Fix:
Execute this command before you configure Cairo:
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@lijinma
lijinma / firewall.sh
Created December 10, 2013 04:16 — forked from x1a0/firewall.sh
#! /bin/bash
# Set the default policies to allow everything while we set up new rules.
# Prevents cutting yourself off when running from remote SSH.
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
# Flush any existing rules, leaving just the defaults
iptables -F
@lijinma
lijinma / markdownhere.css
Last active June 19, 2017 02:55 — forked from xiaolai/markdownhere.css
markdown-here-css
.markdown-here-wrapper {
font-size: 16px;
line-height: 1.8em;
letter-spacing: 0.1em;
}
pre, code {
font-size: 14px;
font-family: Roboto, 'Courier New', Consolas, Inconsolata, Courier, monospace;