Skip to content

Instantly share code, notes, and snippets.

View rantoniuk's full-sized avatar
Enjoying espresso

Radek Antoniuk rantoniuk

Enjoying espresso
View GitHub Profile
@rantoniuk
rantoniuk / aws-cli-hints.md
Created November 5, 2024 11:56
AWS CLI useful commands

Fetch EC2 Instance Prices for a region

aws --region us-east-1 pricing get-products --service-code AmazonEC2 --filters \
 "Type=TERM_MATCH,Field=capacitystatus,Value=Used" \
 "Type=TERM_MATCH,Field=marketoption,Value=OnDemand" \
 "Type=TERM_MATCH,Field=currentGeneration,Value=Yes" \
 "Type=TERM_MATCH,Field=instanceType,Value=inf1.2xlarge" \
 "Type=TERM_MATCH,Field=location,Value=US West (Oregon)" \
 "Type=TERM_MATCH,Field=operatingSystem,Value=Linux" \
### Cross-IAM Invalidate CloudFront from a central pipeline account
###
### new codepipelineActions.LambdaInvokeAction({
### runOrder: 3,
### actionName: 'InvalidateCloudFront',
### role: this.devOpsPipelineRole,
### lambda: Function.fromFunctionArn(this, "test-cloudfrontInvalidator", "arn:aws:lambda:eu-west-1::function:pipelineInvalidateCloudFront"),
### userParameters: {
### bucketName: bucket.bucketName,
### targetPipelineRole: this.testPipelineRole.roleArn
### Unlock card during ykman usage
.zshrc
```
GPG_TTY=$(tty)
export GPG_TTY
```
@rantoniuk
rantoniuk / sonar.py
Last active January 14, 2021 18:40
SonarQube set main branch
### Dependencies:
### pip3 install python-sonarqube-api
###
### Usage:
### SONARQUBE_API_TOKEN=123 SONARQUBE_API_URL=https://my.sonar.service.com/ python3 sonar.py <project-name>
import os
import sys
from distutils.util import strtobool
@rantoniuk
rantoniuk / index.js
Created July 1, 2020 16:18
Export Endomondo gpx for Strava
require('cross-fetch/polyfill');
const fs = require('fs');
const { Api } = require('endomondo-api-handler');
const { DateTime } = require('luxon');
const api = new Api();
(async () => {
await api.login(LOGIN, PASSWORD);
@rantoniuk
rantoniuk / pre-commit
Last active April 30, 2020 18:33
Git checkstyle pre-commit hook
#!/bin/bash -e
set -x
DIFF=$(git diff master --name-only | grep java | xargs)
JAR_SRC="https://github.com/checkstyle/checkstyle/releases/download/checkstyle-8.32/checkstyle-8.32-all.jar"
JAR_PATH="checkstyle-8.32-all.jar"
if [ -z "$DIFF" ]; then
exit 0
fi
@rantoniuk
rantoniuk / git-commit-guidelines.md
Last active September 2, 2019 13:46
Git Commit Guidelines

Commit Message Guidelines

Example of a properly formed commit message:

JIRA-123 Short (72 chars or less) summary

More details about the change, including functional and/or technical
explanation. Wrap it to 72 characters. The blank line separating the
summary from the body is critical (unless you omit the body entirely).
@rantoniuk
rantoniuk / Jenkinsfile
Created August 27, 2019 12:31 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage c…
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8-alpine
@rantoniuk
rantoniuk / Jenkinsfile
Created August 27, 2019 12:10
Jenkinsfile - deploying to environments depending on the choice param
// Requires:
// https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin
pipeline {
agent {
label "master"
}
parameters {
choice(name: 'ENV', choices: ['DEV', 'TEST'], description: 'Select environment to deploy to')
gitParameter name: 'TAG', type: 'PT_BRANCH_TAG', sortMode: 'DESCENDING_SMART', defaultValue: 'develop'
@rantoniuk
rantoniuk / SSLPoke.java
Created August 24, 2019 17:36 — forked from MatthewJDavis/SSLPoke.java
Java SSL poke from atlassian
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {