find . -type f -ls | sort -k11 | perl -ne '@x=split;splice @x,9,1;splice @x,0,1; print join("\t", @x), "\n";' | tail
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Friday, February 24, 2017
Remove arbitrary columns from text lines with perl and splice
Probably not the shorted ... remove the 9th and 0th column from an ls with perl and splice
Friday, February 3, 2017
Moving one git repository to another git repository host
You can refer to the GitHub page "Duplicating a repository"
It uses:
git clone --mirror
: to clone every references (commits, tags, branches)git push --mirror
: to push everything
That would give:
git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repository
cd repository-to-mirror.git
git remote set-url --push origin https://github.com/exampleuser/mirrored
# Set the push location to your mirror
git push --mirror
Labels:
git
Wednesday, February 1, 2017
Jenkins / CloudBees : moving jobs between servers .... how ...
curl -s https://USER:API_TOKEIN@jenkins.prod.com:8443/jenkins/job/SCM_SVN_MODEL/config.xml | curl -X POST 'http://USER:APITOKEN@jenkins-dev.test.com:8080/jenkins/createItem?name=JOBNAME' --header "Content-Type: application/xml" -d @-Get the API token on the target machine (in this case jenkins-dev.test.com)
- Open browser and login on target machine - http://jenkins-dev.test.com:8080/jenkins/user/USER/configure - hit the API TOKEN buttonIf you want to directly copy to a folder do this ...
curl -s https://USER_SRC:APITOKEN_SRC@jenkins.prod.com:8443/jenkins/job/SCM_SVN_MODEL/config.xml | \ curl -X POST 'http://USER_TGT:APITOKEN_TGT@jenkins-dev.test.com:8080/jenkins/job/SANDBOX/createItem?name=JOBNAME' --header "Content-Type: application/xml" -d @-or if you have a list of them ....
declare -a arr=( "SEFS_ABSTRACT_ACTION_MODEL" "SEFS_ABSTRACT_BUILD_ENV_MODEL" "SEFS_ABSTRACT_BUILD_MODEL" "SEFS_ABSTRACT_SCM_MODEL" "SEFS_ABSTRACT_TEST_MODEL" "SEFS_BASE_AUX_MODEL" "SEFS_BUILDER_TMPL" "SEFS_JAVA_BUILD_MODEL" "SEFS_MASTER_BUILD_TMPL" "SEFS_PROJECT_TMPL" "SEFS_SCM_GIT_MODEL" "SEFS_SCM_SVN_MODEL" "SEFS_SILVER_FABRIC_DEPLOY_TMPLT" "SEFS_STANDARD_BUILD_ENV_MODEL" "SEFS_TEST_JUNIT_MODEL" "SEFS_TIBCO_BUILD_MODEL" "SEFS_UC_DEPLOY_MODEL") ## now loop through the above array for i in "${arr[@]}" do curl -s https://USERID_SRC:2615adec2asas558a20790eec2994096c3c455b43@jenkins.prod.com:8443/jenkins/job/$i/config.xml | curl -X POST "http://USERID_TGT:efd517beb69f2ca1sfasfd81371885a48a928cf565@jenkins-dev.test.com:8080/jenkins/job/SANDBOX/createItem?name=$i" --header "Content-Type: application/xml" -d @- # or do whatever with individual element of the array done
Subscribe to:
Posts (Atom)