Skip to content

Instantly share code, notes, and snippets.

View jbontech's full-sized avatar
:octocat:
Focusing

Jothibasu jbontech

:octocat:
Focusing
View GitHub Profile
@jbontech
jbontech / tmux-cheatsheet.markdown
Created April 18, 2019 03:33 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jbontech
jbontech / Jenkinsfile
Created July 26, 2019 07:45 — 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
@jbontech
jbontech / gist:e132a57988bf5694adce7086c9adcf9a
Created April 5, 2020 04:13 — forked from mgedmin/gist:d6d271f4ee6ae82d9a86
Jenkins groovy script to print scheduling rules for all the jobs
import hudson.triggers.*;
for (item in Jenkins.instance.getItems(Project)) {
println("--- Scheduling for " + item.name + " ---")
def trigger = item.triggers.get(Jenkins.instance.getDescriptor(TimerTrigger.class));
if (trigger) {
println trigger.spec;
}
}
@jbontech
jbontech / generate_aws_ssh_config.py
Created April 20, 2020 13:16 — forked from mjbommar/generate_aws_ssh_config.py
Generate .ssh/config lines from EC2 instance information using boto.
'''
@author Bommarito Consulting, LLC
@date 2012-12-23
Generate .ssh/config lines from EC2 instance information.
'''
# Imports
import boto
import os
@jbontech
jbontech / create_ec2_ssh_config.py
Created April 20, 2020 13:17 — forked from Havoc24k/create_ec2_ssh_config.py
Python script to generate an SSH config file for EC2 instances
#!/usr/bin/python
"""AWS EC2 SSH config Generator."""
import boto3
import os
# The location and name of our generated config file
path_to_config = '/.ssh/aws_demo.config'
@jbontech
jbontech / complex_salt_orchestrate.sls
Created April 28, 2020 07:00 — forked from whiteinge/complex_salt_orchestrate.sls
An example of a complex, multi-host Salt Orchestrate state that performs status checks as it goes
# /srv/salt/upgrade_the_app.sls
# Example of a complex, multi-host Orchestration state that performs status checks as it goes.
# Note, this is untested and is meant to serve as an example.
# Run via: salt-run state.orch upgrade_the_app pillar='{nodes: [nodeA, nodeB], version: 123}'
{% set nodes = salt.pillar.get('nodes', []) %}
{% set all_grains = salt.saltutil.runner('cache.grains',
tgt=','.join(nodes), tgt_type='list') %}
{# Default version if not given at the CLI. #}
@jbontech
jbontech / _readme.md
Created May 13, 2020 10:27 — forked from mislav/_readme.md
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@jbontech
jbontech / Jenkinsfile
Created May 21, 2020 12:09 — forked from merikan/Jenkinsfile
Some Jenkinsfile examples
Some Jenkinsfile examples
@jbontech
jbontech / power.sh
Created June 16, 2020 14:19 — forked from chrisyco/power.sh
Suspend, hibernate, restart or shutdown the computer without sudo!
#!/bin/sh
# Suspend, hibernate, restart or shutdown the computer without sudo!
# by Chris Wong
# Released to the public domain.
NAME=$0
usage() {
echo "Usage: $NAME suspend|hibernate|restart|shutdown"
@jbontech
jbontech / _readme.md
Created August 2, 2020 19:12 — forked from fm-jason/_readme.md
Salt SSL Certificate Deployment

Overview

This gist provides a quick overview of deploying SSL certificates to servers using Salt. I use a wildcard certificate for our domain, which makes management easier.

Quick Start

  1. Start with pillar_ssl-certificate.sls, which should be populated with your certificates and placed in Salt's pillar_roots directory (typically /srv/pillar).
  2. Place state_ssl-certificate.sls in Salt's file_roots directory (typically /srv/salt).
  3. Include the contents of top.sls in both the pillar and state top.sls file. (Modify for your minion IDs of course.)

Details

Use pillars to distribute sensitive data, such as SSL certificates. Accoring to the [Salt Pillar Walkthrough][2]:

Information transferred via pillar is guaranteed to only be presented to the minions that are targeted, making Pillar suitable for managing security information, such as cryptographic keys and passwords.