在 gradle 內,執行特定 task 時,需要不同的設定時,可以透 taskGraph 來判斷。下面這例子,很典型地是在 publish 新的 library 時,不含設定檔:
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(uploadArchives)) {
jar {
exclude '**/*.properties'
}
}
在 gradle 內,執行特定 task 時,需要不同的設定時,可以透 taskGraph 來判斷。下面這例子,很典型地是在 publish 新的 library 時,不含設定檔:
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(uploadArchives)) {
jar {
exclude '**/*.properties'
}
}
使用 gcloud 由 snapshot 建出機器並加入 loading balancer
--
由 THE_SNAPSHOT_NAME
snapshot 建出一顆 disk MY_INSTANCE
:
gcloud compute disks create MY_INSTANCE --source-snapshot THE_SNAPSHOT_NAME --zone asia-east1-c
import org.apache.commons.lang.StringUtils; | |
import org.apache.spark.SparkConf; | |
import org.apache.spark.api.java.JavaPairRDD; | |
import org.apache.spark.api.java.JavaSparkContext; | |
import org.apache.spark.api.java.function.Function; | |
import org.apache.spark.api.java.function.Function2; | |
import org.apache.spark.api.java.function.PairFunction; | |
import scala.Tuple2; |
from BeautifulSoup import BeautifulSoup as Soup | |
from mechanize import Browser | |
from soupselect import select | |
from datetime import datetime | |
import sys | |
reload(sys) | |
sys.setdefaultencoding("utf-8") | |
docker save $1 > $1.tar && rsync -ravP -e ssh $1.tar philipz@192.168.2.51:/home/philipz/tmp && rm $1.tar
##Add Gzip
docker save busybox | gzip -c - > busybox.tar.gz
gzip -d busybox.tar.gz && docker load < busybox.tar
docker save busybox | gzip | pv | ssh -i ~/.ssh/id_rsa USER@HOSTNAME sudo docker load
MongoDB provides a Javascript shell. But Javascript is no fun without underscore.js | |
Turned out its straight forward to use underscore.js while scripting mongodb. | |
Here are the steps. | |
1) Use underscore to write your db script file (say my_commands.js) | |
E.g: _.each(db.dbname.find().toArray(), function(itm) { ... }) |
On Cassandra 1.1.x, nodetool removetoken on a dead node hangs. The only way to reliably remove the node from the cluster is to use an undocumented JMX command to force the remove of the node from gossip.
Upgrading to 1.2.x and above should obviate these steps in favor of nodetool removenode
- See 1.2 Docs
It's probably also a good idea to run a nodetool repair
after this operation - See wiki
#!/usr/bin/env python | |
# | |
# usage: | |
# conv2vmx-ovf.py some-vm.ovf | |
# | |
# ref: http://www.cnblogs.com/eshizhan/p/3332020.html | |
# | |
import sys | |
fn = sys.argv[1] |
// http://jsfiddle.net/suBPQ/ | |
$.ajax({ | |
url: "http://api_test_server.proudlygeek.c9.io/", | |
success: function(data) { | |
console.log(data); | |
} | |
}); |
#!/bin/bash -l | |
# find latest backup | |
thinbackup_path="$JENKINS_HOME/thinBackup" | |
latest_backup_folder=$(ls -t $thinbackup_path | head -n1) | |
full_path="$thinbackup_path/$latest_backup_folder" | |
echo "Latest backup is located at ${full_path}" | |
# pack it up | |
backup_name="$latest_backup_folder.tar.gz" |