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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / git.squash.commits.in.PR.md
Last active September 8, 2021 09:30
Squash multiple commits in a PR that was already pushed

Find out the SHA for when the branch was initiated:

$ git merge-base feature/248227-create-drop-artifact develop
b373da2f4b24e57a147021df1d3964a46b47edf3

Rebase / squash interactively:

@ojacques
ojacques / batch-encode.md
Created December 20, 2021 22:13
Batch encode GoPRO 4K H265 to H265 with ffmpeg

Use case

Filming with GoPro with H.265, but editing with software which does not support H.265 (like Magix FastCut). Let's convert all those files to H.264, leveraging GPU (like NVidia RTX 3070 -> ~2x speed at 4K->4K)

One liner

for f in *.MP4; do ffmpeg -hwaccel cuvid -i "$f" -map 0 -c copy -c:v h264_nvenc -qp 20 -tune hq -crf 25 -preset slow h264vids/"${f%.*}.mp4"; done
@ojacques
ojacques / README.md
Last active November 17, 2022 20:25
Export aws ssm get-parameters-by-path results as environment variables with jq

Export all AWS SSM Parameters retrieved from a given path as environment variables

Example:

I have the following SSM parameters:

  • /codepipeline/deploy_prod with value "v1.2.0"
  • /codepipeline/deploy_preprod with value "v1.1.1"
  • /codepipeline/deploy_sandbox with value "a0582a5fa7fff7361b18581d04d222a35cceb264"

The following environment variables will be exported: