This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function logClass(target: any) { | |
// save a reference to the original constructor | |
var original = target; | |
// a utility function to generate instances of a class | |
function construct(constructor, args) { | |
var c : any = function () { | |
return constructor.apply(this, args); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# 以root权限运行,只支持Ubuntu 14和16 | |
echo 请设置web用户名和密码,如果输错了,按Ctrl+C结束本脚本并重来 | |
echo 输入web用户名: | |
read webuser | |
echo 输入web密码: | |
read webpass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export npm_path=$(npm config get prefix) | |
export PATH=$PATH:$npm_path/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adapted from https://stackoverflow.com/a/13786155/6247478 | |
var cal_days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | |
var month_names = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; | |
var day_names = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']; | |
angular.module('demo') | |
.directive('calendar', function () { | |
return { | |
restrict: 'E', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const INDEX_FILE_NAME = './www/index.html'; | |
const fs = require('fs'); | |
const path = require('path'); | |
const crypto = require('crypto'); | |
function checksum(str, algorithm, encoding) { | |
return crypto | |
.createHash(algorithm || 'md5') | |
.update(str, 'utf8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
qiniu_ak: '', | |
qiniu_sk: '', | |
qiniu_bucket: '', | |
qiniu_domain:'http://cdn.example.com' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* 如果$_REQUEST中出现可能导致sql注入的字符,就返回400。 | |
* 需要在程序一开始的时候就运行。 | |
* | |
* 注意:本方法只对默认的html表单类型(application/x-www-form-urlencoded)有效 | |
* 如果有文件上传类型的(enctype="multipart/form-data"),则不能执行本方法 | |
*/ | |
function guardAgainstBadCharactersInRequest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# crontab: | |
# 30 */8 * * * /root/backup/mysql.sh | |
databases=(db1 db2 db3) | |
basepath='/root/backup/mysql/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias setp="export http_proxy=127.0.0.1:1087 && export https_proxy=127.0.0.1:1087" | |
alias unsetp="export http_proxy= && export https_proxy=" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
"github.com/golang/glog" | |
"github.com/spf13/cobra" | |
"github.com/spf13/pflag" | |
) |
OlderNewer