Skip to content

Instantly share code, notes, and snippets.

View abn's full-sized avatar

Arun Babu Neelicattu abn

View GitHub Profile
@abn
abn / install-jetbrains-toolbox.sh
Last active December 1, 2023 14:00
Install JetBrains Toolbox App
#!/usr/bin/env bash
# Reference: https://github.com/nagygergo/jetbrains-toolbox-install/blob/master/jetbrains-toolbox.sh
# Note that we grep for linux here, if you are using this on mac/windows please see json output
TOOLBOX_URL=$(curl --silent 'https://data.services.jetbrains.com//products/releases?code=TBA&latest=true&type=release' \
-H 'Origin: https://www.jetbrains.com' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Accept-Language: en-US,en;q=0.8' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Referer: https://www.jetbrains.com/toolbox/download/' \
@abn
abn / bash-alias-unzipy.sh
Created April 22, 2018 03:34
An alias to unzip files when unzip command is unavailable, but python is.
# usage: unzipy <source.zip> <dest dir>
alias unzipy="python -c \"import os, sys, zipfile; zipfile.ZipFile(sys.argv[1], 'r').extractall(sys.argv[2])\""
@abn
abn / Makefile
Last active April 19, 2018 08:13
An example makefile with embedded help messages and dynamic help targets
MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
ROOT_DIR := $(patsubst %/,%,$(dir $(MAKEFILE_PATH)))
.PHONY: %/help
%/help: HELP_TARGET = $(subst /help,,$@)
%/help:
@make -C $(ROOT_DIR) help | grep -Pzo "$(HELP_TARGET)(/\w+)*:.*(\n\s+(.*)?)*\n"
### help: Displays this help message.
.PHONY: help
@abn
abn / ansible-letsencrypt-install-ca-certs.yaml
Created April 1, 2018 15:03
Install letsencrypt cross signed certs for Red Hat distros
---
# https://letsencrypt.org/certificates/
- hosts: all
tasks:
- name: install letsencrypt cross-signed x3
get_url:
url: https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem.txt
dest: /etc/pki/ca-trust/source/anchors/lets-encrypt-x3-cross-signed.pem
register: x3
- name: install letsencrypt cross-signed x4
@abn
abn / azure-networkmanager-preserve-search-domain.yaml
Created March 31, 2018 06:32
Ensure default search domain is preserved when converting Azure VM network interface to be managed by NetworkManager
- hosts: all
tasks:
- name: create custom fact directory
file:
path: /etc/ansible/facts.d
state: directory
- name: insert azure fact file
copy:
src: azure_resolv.fact
@abn
abn / openshift-dotnet-service-multiproject.yml
Created November 30, 2017 13:45
OpenShift Template: .NET build w/ pipeline configuration using multiple sources when using no dependency management
---
apiVersion: v1
kind: Template
labels:
template: dotnet-service-multisource-template
metadata:
annotations:
openshift.io/display-name: .Net Multi-Source Service
description: .Net Multi-Source Service
iconClass: icon-dotnet
@abn
abn / openshift-jenkins-slave-pod-template.yml
Created November 30, 2017 13:43
OpenShift Template: Jenkins Slave Pod ConfigMap
---
apiVersion: v1
kind: Template
labels:
template: jenkins-slave-config-template
metadata:
annotations:
description: |
A template to create a Jenkins slave ConfigMap.
openshift.io/display-name: Jenkins Slave ConfigMap
@abn
abn / openshift-jenkins-configmap-dotnet-pod.yml
Created November 28, 2017 23:12
Jenkins on OpenShift: Example configmap to dynamically configure a dotnet-build-pod PodTemplate
# References:
# - https://docs.openshift.com/container-platform/3.6/using_images/other_images/jenkins.html#using-the-jenkins-kubernetes-plug-in-to-run-jobs
# - https://github.com/jenkinsci/kubernetes-plugin/blob/master/README.md
apiVersion: v1
items:
- apiVersion: v1
data:
dotnet-build-pod: |-
<org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
<inheritFrom></inheritFrom>
@abn
abn / Jenkinsfile
Created November 28, 2017 23:06
Jenkinsfile: OpenShift podTemplate example
// this currently is restricted on OpenShift Online, however is possible on OSD/OCP clusters
// we create a dotnet builder pod using the provided jenkins slave image for executing dotnet commands in
podTemplate(
label: 'dotnet-build-pod', cloud: 'openshift',
containers: [
containerTemplate(
name: 'dotnet-build-pod', image: 'registry.access.redhat.com/dotnet/dotnet-20-jenkins-slave-rhel7:latest'
)
]) {
node('dotnet-build-pod-x') {
@abn
abn / keycloak-fetch-token-postman-pre-request.js
Created October 12, 2017 13:02
A postman pre-request script to fetch a valid token from Red Hat SSO (Keycloak) and set it to a template variable to use in request headers.
// modify these configurations to work with your environment
var server = "https://sso.example.com";
var realm = "realm";
var resource = "client";
var username = "username";
var password = "url encoded password";
var url = `${server}/auth/realms/${realm}/protocol/openid-connect/token`;
var data = `grant_type=password&client_id=${resource}&username=${username}&password=${password}`;