Skip to content

Instantly share code, notes, and snippets.

View ojacques's full-sized avatar
🌤️
Head in the cloud; feet, too.

Olivier Jacques ojacques

🌤️
Head in the cloud; feet, too.
View GitHub Profile
@ojacques
ojacques / git.cheat.sheet.md
Created July 22, 2021 11:51
GIT cheat sheet

Setting up the Environment (One Time Setup)

  • developer@github: fork repo: git://github/team-org/repoX -> git://github/developer/repoX
  • developer@workstation: git clone git@github:developer/repoX.git
  • developer@workstation: git remote add upstream git@github:team-org/repoX.git

Synchronize Fork with Upstream

  • developer@workstation/master: git pull upstream master
@ojacques
ojacques / debug-jenkinsfile.md
Created July 22, 2021 11:47
Debugging Jenkinsfile

How to execute locally Jenkinsfile

One time setup: Jenkins

  • Install a local Jenkins (avoid Docker to avoid to have port mapping, volume and other issues)
  • https://jenkins.io/download/ -> get the war file
  • Start Jenkins:
wget [jenkins.war]
mkdir jenkins_home
JENKINS_HOME=$PWD/jenkins_home java -jar jenkins.war
@ojacques
ojacques / README.md
Created July 22, 2021 11:45
GIT: Squash commits inside a PR, before even merging

When you have a PR which has been here for some times, and master is very active, you will end up have lots of commits in your history when you get the changes from master.

To clean this up:

  • git fetch origin: get the latest from the repo
  • git checkout my_branch: go to your branch for pull request
  • git rebase origin/master: this will rebase the current branch with master
  • git push -f: force push, as we are rewriting history
@ojacques
ojacques / ALM_REST_CURL.md
Last active July 22, 2021 11:43
ALM REST API usage with curl

Authenticate with ALM and set the LWSSO_COOKIE_KEY cookie

curl -X POST -H "Content-Type: text/xml" --cookie cookies.txt -k --cookie-jar cookies.txt -d "<alm-authentication><user>alm_user</user><password>alm_password</password></alm-authentication>" https://alm_host:8443/qcbin/authentication-point/alm-authenticate

Alternatively (same result):

curl --cookie cookies.txt --cookie-jar cookies.txt --user alm_user:alm_password https://alm_host:8443/qcbin/authentication-point/authenticate

Setup QCSession cookie (need with ALM >= 12.x)

curl -X POST --cookie cookies.txt --cookie-jar cookies.txt https://alm_host:8443/qcbin/rest/site-session

Get defects assigned to an individual

curl --cookie cookies.txt --cookie-jar cookies.txt -g "https://alm_host:8443/qcbin/rest/domains/[ALM_DOMAIN]/projects/[ALM_PROJECT]/defects?fields=id,name,status,severity,owner&query={owner['alm_user']}"

@ojacques
ojacques / ssh-command.coffee
Created July 22, 2021 11:40
Hubot: Execute ssh command asynchronously and provide nicely formatted output on slack
# Description:
# Execute ssh command asynchronously and provide nicely formatted output on slack
#
# Commands:
# hubot my_ssh_command server - Your ssh command to run on host
#
module.exports = (robot) ->
robot.respond /my_ssh_command (.*)/i, (msg) ->
server = msg.match[1]
@ojacques
ojacques / git-ssh-behind-proxy-or-vpn.md
Last active July 22, 2021 11:39
GitHub ssh/git behind proxy or on restrictive VPN

Issue: can't use ssh or git commands when connected on VPN. This is because, for now, outgoing ssh / TCP 22 is blocked.

We have to tunnel through the web proxy. Here is how:

On Windows

  • Download and install nmap-7.70-setup.exe from https://nmap.org/download.html. We will use ncat tool to send all packets through the proxy.
  • Open command line (WIN Key+R+cmd+ENTER)
  • cd %USERPROFILE%\.ssh. This is where you have stored your ssh private key for GitHub
  • Create a new file named config
  • Add
@ojacques
ojacques / devops-questions.md
Created July 22, 2021 11:35
DevOps questions
  • If you had to explain the concept of DevOps to a child, what would you say?
  • How does the interface with product management aid or detract from the flow of work?
  • How do we start a DevOps transformation?
  • You are involved in “re-platforming” (lift existing physical hardware to cloud) but leave the software untouched. Can you do DevOps?
  • What are your favorite sources for learning today, related to DevOps transformations?
  • How have mainstream stories of security breaches affected the way we and organizations work?
  • What mechanisms should be in place to challenge pre-existing notions about software delivery in an enterprise?
  • How do we get people outside of the tech organization to not just participate in the DevOps journey, but be active leaders in it as well?
  • How do you see DevOps practices being implemented outside of Development and IT Operations?
  • What obstacles do technology leaders face in large, complex organizations that are outside the technology value stream?
@ojacques
ojacques / README.md
Created July 22, 2021 11:35
Skin AWS console based on region
@ojacques
ojacques / jenkins-groovy-scripts.md
Created July 22, 2021 11:33
Jenkins useful groovy scripts

https://the-jenkins/script

Delete offline nodes

for (aSlave in hudson.model.Hudson.instance.slaves) {
    if (aSlave.getComputer().isOffline()) {
        aSlave.getComputer().setTemporarilyOffline(true,null);
        aSlave.getComputer().doDoDelete();
    }
@ojacques
ojacques / hugo-go-snippets.md
Created July 22, 2021 11:32
Collection of hugo / template snippets

Collection of hugo / template snippets

Go through all pages of the site

{{ range .Site.Pages }}
  {{ if eq .File.BaseFileName "_index" }}
    👉INDEX!: type: {{ .Type }}, File: {{ .File.BaseFileName }}, {{ .Title }}<br/>
  {{ else }}
  type: {{ .Type }}, File: {{ .File.BaseFileName }}, title: {{ .Title }} <br/>
 {{ end }}