Skip to content

Instantly share code, notes, and snippets.

@yasinai
yasinai / README.md
Created September 27, 2020 18:54 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@yasinai
yasinai / Jenkinsfile
Created November 11, 2019 17:26 — forked from ysegorov/Jenkinsfile
Jenkinsfile example
#!/usr/bin/env groovy
// https://github.com/freebsd/freebsd-ci/blob/master/scripts/build/build-test.groovy
// http://stackoverflow.com/a/40294220
// https://JENKINS_HOST/scriptApproval/ - for script approval
import java.util.Date
def isMaster = env.BRANCH_NAME == 'master'
def isDevelop = env.BRANCH_NAME == 'develop'
@yasinai
yasinai / Jenkinsfile
Created October 30, 2019 15:34 — forked from ftclausen/Jenkinsfile
Jenkins pipeline - An approach to get all commits since the last successful build.
// -*- mode: groovy -*-
// vim: set filetype=groovy :
node( 'some_node' ) {
stage( "Phase 1" ) {
sshagent( credentials: [ 'some_creds' ] ) {
checkout scm
def lastSuccessfulCommit = getLastSuccessfulCommit()
def currentCommit = commitHashForBuild( currentBuild.rawBuild )
if (lastSuccessfulCommit) {

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@yasinai
yasinai / prometheus
Created January 8, 2019 16:45 — forked from JoergM/prometheus
Prometheus init file for RHEL 5 or 6
#!/bin/bash
#
# /etc/rc.d/init.d/prometheus
#
# Prometheus monitoring server
#
# chkconfig: 2345 20 80 Read
# description: Prometheus monitoring server
# processname: prometheus
@yasinai
yasinai / pom-advance-snapshots.sh
Created March 27, 2018 14:35 — forked from swthomas55/pom-advance-snapshots.sh
Manage POM versions in multi-module Maven projects
#! /bin/sh
#
# Usage: pom-advance-snapshots.sh
#
# Update the version of every POM to the next patch version, append the git branch name and SNAPSHOT
# unless the POM already has a SNAPSHOT version.
#
# Thus, version 1.3.4 becomes 1.3.5-branch-SNAPSHOT.
#
# Requires xmlstarlet and maven versions plugin. Invokes maven as "mvn".
@yasinai
yasinai / changesets.groovy
Created March 7, 2018 08:32 — forked from lsjostro/changesets.groovy
Jenkinsfile: build only changed files
#!groovy
@NonCPS
def getACIChangeSets() {
def aci = []
currentBuild.rawBuild.getChangeSets().each { cs ->
cs.getItems().each { item ->
item.getAffectedFiles().each { f ->
if (f.path.endsWith(".yml")) {
aci << f.path
}
@yasinai
yasinai / Timeout.ps1
Created January 14, 2018 13:57 — forked from lazywinadmin/Timeout.ps1
Timeout in powershell
#requires -Version 2
$maximumRuntimeSeconds = 3
$process = Start-Process -FilePath powershell.exe -ArgumentList '-Command Start-Sleep -Seconds 4' -PassThru
try
{
$process | Wait-Process -Timeout $maximumRuntimeSeconds -ErrorAction Stop
Write-Warning -Message 'Process successfully completed within timeout.'
@yasinai
yasinai / xpath-example.ps1
Created December 21, 2017 06:54 — forked from jpoehls/xpath-example.ps1
Use XPath to update XML using PowerShell
function Edit-XmlNodes {
param (
[xml] $doc = $(throw "doc is a required parameter"),
[string] $xpath = $(throw "xpath is a required parameter"),
[string] $value = $(throw "value is a required parameter"),
[bool] $condition = $true
)
if ($condition -eq $true) {
$nodes = $doc.SelectNodes($xpath)
@yasinai
yasinai / augeas.ps1
Created December 21, 2017 06:54 — forked from spuder/augeas.ps1
Powershell replace single xml line
# Based on this script https://ask.puppetlabs.com/question/4749/augeas-or-alternative-xml-modification-on-windows/
# I had to flip the logic if $node.NodeType -ne 'Element' to get it to work properly
[CmdletBinding()]
param (
[string] $filename = $(throw "filename is a required parameter"),
[string] $xpath = $(throw "xpath is a required parameter"),
[string] $value = $(throw "value is a required parameter")
)