This file contains hidden or 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
/** | |
* A helper module for AngularUI Router, which allows you to define your states as an object tree. | |
* @author Mark Lagendijk <[email protected]> | |
* @license MIT | |
*/ | |
+function(){ | |
angular.module('ui.router.stateHelper', [ 'ui.router' ]) | |
.provider('stateHelper',['$stateProvider', function($stateProvider){ | |
var self = this; |
This file contains hidden or 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
// returns things in array 'a' that are not in array 'b' | |
// > ['a','b','c','1', '2', '3'].complement(['b', 'c', 'd', 'e']); | |
// ['a', '1', '2', '3'] | |
function complement(a, b){ | |
(b)||(b=a, a=this); | |
return (Array.isArray(a) && Array.isArray(b)) | |
? a.filter(function(x){return b.indexOf(x)===-1;}) | |
: undefined; | |
} | |
Array.prototype.complement=complement; |
This file contains hidden or 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
'use strict'; | |
const mongoUrl = 'mongodb://my-db-address:27017';// MongoDB connection URL. | |
const filePath = 'id.list';// This must be Unix/Linux ID list file. | |
const limit = 100;// Buffer this number of documents. Then do insert. | |
const dbName = 'myDB';// DB name. | |
const collectionName = 'myCollection';// Collection name. | |
const MongoDB = require('mongodb'); | |
const MongoClient = MongoDB.MongoClient, assert = require('assert'); |
This file contains hidden or 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
This file contains hidden or 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 getQuestionListUrl(index) { | |
return 'https://workorder.console.aliyun.com/json/page/query_index.json?__preventCache=' + (new Date()).getTime() + '¤tPage=' + index + '&page=' + index + '&pageSize=100&status='; | |
} | |
function getQuestions() { | |
let questions = []; | |
for (let p = 1; p <= 4; p++) { | |
let url = getQuestionListUrl(p); | |
$.ajax({ | |
url, |
This file contains hidden or 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
[Unit] | |
Description=Renews letsencrypt certificates | |
After=network.target | |
[Service] | |
Type=oneshot | |
WorkingDirectory=/etc/letsencrypt | |
ExecStart=/usr/bin/certbot renew --quiet --agree-tos --pre-hook "systemctl stop nginx.service" --post-hook "systemctl restart nginx.service" |
This file contains hidden or 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/sh | |
# Use common shell. Or edit this for whatever shell you love. | |
# This is for building Spigot server for Minecraft game. | |
# This is a common script. You can use this directly, or customize for your own. | |
# Require Java 8+ and Git. | |
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar && | |
java -jar BuildTools.jar | |
# Or add --dev for building development version Spigot: |
This file contains hidden or 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 | |
ProjectName="sundries" # 项目名称 | |
Port=3030 # 服务监听端口 , 通过设置 NODE_PORT 环境变量实现 | |
CleanNodeModules=true # 是否每次都清除 node_modules | |
NodeVersion=8.1.2 # node 版本, 需确保 nvm 有该版本 | |
Restart=true # 是否每次都重启服务 | |
if [[ -e $1 ]]; then |
This file contains hidden or 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/zsh | |
for url in `curl --silent https://api.github.com/repos/$1/releases/latest | awk '/browser_download_url/ { print $2 }' | sed 's/"//g'` | |
do | |
echo $url | |
curl -LOk $url | |
done |
This file contains hidden or 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
[Unit] | |
Description=Shadowsocks Server | |
After=network.target | |
[Service] | |
ExecStart=/usr/local/bin/ssserver -c /etc/shadowsocks/ss-config.json | |
Restart=on-abort | |
[Install] | |
WantedBy=multi-user.target |
OlderNewer