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 / gist:86cb2f4209d138bce5ac5fd50ea0bd66
Created July 22, 2021 11:31
Encode GitHub App key PEM for Kubernetes use
This CLI will convert a PEM private key from a GitHub app, so that it can be used in Jenkins, to eventually be injected in K8s values file
```
sed ':a;N;$!ba;s/\n/\\\\\\\\n/g' certificate.private-key.pem
```
@ojacques
ojacques / aws-delete-cfn-stacks.md
Created July 22, 2021 11:30
Delete AWS cloudformation stacks which failed deletion

Set of commands which are useful to clean after yourself when I tried to delete AWS Cloud Formation stacks when my infrasec role did not had all the needed permissions.

  • List stacks which can be deleted (DELETE_FAILED status):
    aws cloudformation list-stacks | jq '.StackSummaries[] | select(.StackStatus=="DELETE_FAILED") | .StackName'
    

OR

  • List stacks which contain a specific string in their name:
    aws cloudformation list-stacks | jq '.StackSummaries[] | select(.StackName | contains("bcol")) | .StackName'
    
@ojacques
ojacques / auth.py
Last active July 22, 2021 11:27
JIRA Oauth dance and API
import base64
import urllib
#import tlslite
from tlslite.utils import keyfactory
import oauth2 as oauth
class SignatureMethod_RSA_SHA1(oauth.SignatureMethod):
name = 'RSA-SHA1'
def signing_base(self, request, consumer, token):
@ojacques
ojacques / hubot-on-msteams.md
Created July 22, 2021 11:22
Hubot on MS Teams

A bot in Microsoft Teams is managed through the Bot Framework.

  1. Navigate to https://dev.botframework.com/bots/new.
  2. Fill in the blanks.
  3. Click on Create Microsoft App ID and password.
  4. Save the AppId and the Password, you will need it later.

Create your hubot bot

Use a Dockerfile to create the bot instance. Create the bot

@ojacques
ojacques / metrics-for-github-org.md
Created July 22, 2021 11:21
Metrics for a GitHub org

Getting metrics for a GitHub org

@ojacques
ojacques / README.md
Created July 22, 2021 11:19
GraphQL queries for GitHub
  • Get a collection of opened issues within repositories which have the topic "dojo"
{
  search(query: "topic:dojo", type: REPOSITORY, first: 50) {
    repositoryCount
    pageInfo {
      endCursor
      startCursor
    }
 nodes {
@ojacques
ojacques / README.md
Last active July 5, 2021 17:53
Jenkins: find build details executed on a given agent, at a given time

Scenario

Let's say that you have an issue on a given Jenkins agent at a given time, but you don't know which build can cause it. Here is how to find out which builds where running on that agent, at that time.

In this case, the agent is an AWS EC2 VM, with a well known instance ID (in this case, i-02d41abc1a375089d).

This works with Jenkins organization folders.

1. find all builds executed on the agent

@ojacques
ojacques / Dockerfile
Created November 29, 2020 16:46
Docker container to run tests on AWS Device Farm
```Dockerfile
FROM PYTHON:3.7-buster
RUN apt-get -qq -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
jq \
curl \
less \
git \
vim \
@ojacques
ojacques / ALM-with-REST.md
Last active October 29, 2020 12:28
ALM REST API with curl

This GIST shows example on how to authenticate with HP/HPE/Microfocus ALM REST API and run queries.

Note:

By default, the ALM REST API returns XML data. If you want to get JSON data, add -H "Accept: application/json"

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_useralm_password" 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

@ojacques
ojacques / README.md
Created June 4, 2019 22:10
Useful media manipulation with exiftool

Update iPhone movie files date with EXIF data "MediaCreateDate":

exiftool.exe ExifTool "-FileCreateDate<MediaCreateDate" "-FileModifyDate<MediaCreateDate" *.mov`