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 | |
usage(){ | |
echo "USAGE: bash $0 OUTPUT_PATH" | |
exit 1 | |
} | |
[[ $# -ne 1 ]] && usage | |
backup_path=$1 |
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
<?xml version='1.0' encoding='UTF-8'?> | |
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> | |
<xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/> | |
<xsl:template match="plist"> | |
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
namespace :db do | |
desc "Migrate the db" | |
task :migrate do | |
connection_details = YAML::load(File.open('config/database.yml')) | |
ActiveRecord::Base.establish_connection(connection_details) | |
ActiveRecord::Migrator.migrate("db/migrate/") | |
end | |
desc "Create the db" |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
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
{ | |
"title": "Apache and Tomcat Logs", | |
"services": { | |
"query": { | |
"list": { | |
"0": { | |
"query": "apache !tomcat !static", | |
"alias": "", | |
"color": "#7EB26D", | |
"id": 0, |
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
ARGS=`getopt -o dph -l help,debug,jdk-update,jdk-retreat,tomcat-update,tomcat-retreat,apache-update,apache-retreat,tomcat-conn-update -- "$@"` | |
[ $? -ne 0 ] && usage | |
eval set -- ${ARGS} | |
while [ true ] | |
do | |
case $1 in | |
--debug) | |
IS_DEBUG="true" | |
debug=1 |
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
while getopts "abc:def:ghi" OPT | |
do | |
echo "$OPT" $OPTIND $OPTARG # 这里$OPTIND 是一个索引序列号,$OPTARG 是选项里所记录的值,无值是为空,默认情况下选项是以空格分隔 | |
case $OPT in | |
a) aflag=1 | |
;; | |
b) bflag=1 | |
;; | |
c) cflag=1 | |
clist=$OPTARG |
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
dir_of_script=$(cd "$(dirname "$0")"; pwd) |
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
require 'active_support/core_ext/hash/conversions' | |
require 'yaml' | |
file = File.open("data/mconvert.xml", "r") | |
hash = Hash.from_xml(file.read) | |
yaml = hash.to_yaml | |
File.open("data/mirador.yml", "w") { |file| file.write(yaml) } |
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/sh | |
git filter-branch --env-filter ' | |
OLD_EMAIL="[email protected]" | |
CORRECT_NAME="echo" | |
CORRECT_EMAIL="[email protected]" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then |
NewerOlder