Skip to content

Instantly share code, notes, and snippets.

View eugenestarchenko's full-sized avatar
:octocat:

Eugene S eugenestarchenko

:octocat:
View GitHub Profile
@eugenestarchenko
eugenestarchenko / jenkins_modify_jobs.py
Created August 30, 2018 12:46 — forked from govindsh/jenkins_modify_jobs.py
Python script to modify jenkins jobs using requests module
# I wrote this program after several attempts to work with jenkinsapi and python-jenkins packages.
# This script got the job done without any issues.
import requests
import sys
jenkins_host = "localhost:8080"
jenkins_user = "admin"
jenkins_api = "z01c688ffc46511f7e8dd95014ggaf05"
# Check command line args
@eugenestarchenko
eugenestarchenko / gist:2e8d7e600de860eba6456d9f7ee6b839
Created August 28, 2018 10:04 — forked from jagregory/gist:710671
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork [email protected]
#!/usr/bin/php
<?php
/**
* ELB Internal Route53 Updater
* @author Cyril Aknine https://github.com/darylounet
*/
$vpcId = 'your-vpc-id';
$elbNetworkDescription = 'Your ELB network interface description (generated like "ELB your-elb-name")';
$route53InternalHostedZoneId = 'Your Route53 Internal hosted zone ID';
@eugenestarchenko
eugenestarchenko / tar.md
Created July 2, 2018 10:56 — forked from bengarrett/tar.md
Helpers and common usage for tar

Tar

Compress (backup) files and directories

Common arguments

-c create an archive

-f file.tar filename of archive

-v verbose

@eugenestarchenko
eugenestarchenko / snapshot.sh
Created July 2, 2018 10:30 — forked from eekfonky/snapshot.sh
AWS Snapshot
#!/bin/bash
# error handling
error_handler() {
echo "Error occurred in script at line: ${1}"
echo "Line exited with status: ${2}"
}
trap 'error_handler ${LINENO} $?' ERR
@eugenestarchenko
eugenestarchenko / jenkins-backup-s3
Created June 26, 2018 11:10 — forked from ErmisCat/jenkins-backup-s3
Backup Jenkins config to an S3 bucket.
#!/bin/bash
# MKDIR /backup
# git clone this script there
# SETUP CRONTAB:
# crontab -e
# PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin
# 0 0 * * * cd /backup && ./jenkins-backup-s3.sh
set -ex
@eugenestarchenko
eugenestarchenko / README.md
Created May 21, 2018 13:19
Simple ECS service deploy script

Deploy updates to aws ecs services based on github commits. Posts deploy notifications to slack.

Assumptions:

  • Task definitions map 1:1 with services, and they have the same name.
  • Code is stored on github
  • You want to deploy the latest commit in a branch
  • Docker images are tagged with commit SHA
  • Docker images are stored on AWS ECR
@eugenestarchenko
eugenestarchenko / pr.md
Created May 11, 2018 08:49 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@eugenestarchenko
eugenestarchenko / AWS IAM Policy - ForceMFA.json
Created May 7, 2018 14:50 — forked from incyclum/AWS IAM Policy - ForceMFA.json
AWS IAM Policy - Force MFA - This policy allows users to manage their own passwords and MFA devices but nothing else unless they authenticate with MFA -- *EDIT*: I forgot where I found it in the 1st place. In fact this policy is explained statement by statement in AWS docs: https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_users-self-man…
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowAllUsersToListAccounts",
"Effect": "Allow",
"Action": [
"iam:ListAccountAliases",
"iam:ListUsers",
"iam:GetAccountPasswordPolicy",

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.