Skip to content

Instantly share code, notes, and snippets.

View otakusid's full-sized avatar
🏠
Working from home

otakuSiD otakusid

🏠
Working from home
View GitHub Profile
ARG FUNCTION_RUNTIME
FROM mikesir87/aws-cli as code
ARG FUNCTION_NAME
ARG AWS_DEFAULT_REGION
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
RUN wget -O function.zip `aws lambda get-function --function-name $FUNCTION_NAME --query 'Code.Location' --output text`
@vozerov
vozerov / gist:c3578e727e511cd99fd7e9af3e348e14
Created February 15, 2019 11:05
Calculate working interval between 2 timestamps in elasticsearch
// constants
// holidays or vacations, date format must be the same
Set HOLIDAYS = new HashSet(['02.02.2019', '03.02.2019']);
// date format need by date check
def SIMPLE_DATE_FORMAT = new SimpleDateFormat('dd.MM.YYYY');
// time/date constants
long DAY = 24 * 60 * 60 * 1000, HOUR = 60 * 60 * 1000;
@astrikos
astrikos / stale_security_groups.py
Created November 9, 2017 15:52
Script to detect stale AWS security groups
#!/usr/bin/env python
import boto3
import argparse
class StaleSGDetector(object):
"""
Class to hold the logic for detecting AWS security groups that are stale.
"""
def __init__(self, **kwargs):
@cludden
cludden / howto-installing-vault-on-aws-linux.md
Created February 3, 2016 00:30
HOWTO: Installing Vault on AWS Linux

HOWTO: Installing Vault On AWS Linux

This is quick howto for installing vault on AWS Linux, mostly to remind myself. At the end of this tutorial, you'll have a working vault server, using s3 for the backend, self signed certificates for tls, and supervisord to ensure that the vault server is always running, and starts on reboot.

Setting up S3

First things first, let's set up an s3 bucket to use as the storage backend for our s3 instance.

  1. From the AWS Mangement Console, go to the S3 console.

  2. Click on the Create Bucket button

@rainydio
rainydio / init.coffee
Last active January 28, 2016 09:43
Hide tree view when entering full screen mode
do () ->
restoreTreeView = false
hasTreeView = () ->
return document.getElementsByClassName "tree-view"
.length isnt 0
atom.commands.onDidDispatch (e) ->
if e.type is "window:toggle-full-screen"
if atom.isFullScreen()
@nrollr
nrollr / ApacheHTTPSConfig.md
Last active March 11, 2024 13:32
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using Terminal.app: sudo mkdir /etc/apache2/ssl
Next, generate two host keys:

#Importing IIS module to make the IIS:\ Drive available
Import-Module WebAdministration -ErrorAction SilentlyContinue
#Make sure to put the name of your deploy step name inside the Brackets.
$appPool = "IIS:\\AppPools\" + $OctopusParameters['Octopus.Action[YOURDEPLOYSTEPNAME].IISWebSite.ApplicationPoolName']
#Setting the .NET CLR Runtime of the app pool to "" which is the same as "No Managed Code"
Set-ItemProperty $appPool managedRuntimeVersion "" -verbose
@sumpfgottheit
sumpfgottheit / gunicorn.init.sh
Last active February 18, 2019 18:29
Gunicorn Init Script
#!/bin/sh
#
# gunicorn_pypiserver Startup script for gunicorn for
#
# chkconfig: - 86 14
# processname: gunicorn_pypiserver
# pidfile: /var/run/pypiserver.pid
# description: Python application server for pypiserver
#
### BEGIN INIT INFO
@joepie91
joepie91 / vpn.md
Last active May 5, 2024 17:55
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@magnetikonline
magnetikonline / README.md
Last active June 7, 2023 20:57
AWS Elastic Beanstalk deploy user restricted IAM policy.

AWS Elastic Beanstalk deploy user restricted IAM policy

An IAM user policy document to give minimal rights for deploying an Elastic Beanstalk application.

Where:

  • REGION: AWS region.
  • ACCOUNT_ID: AWS account ID.
  • APPLICATION_NAME: Desired target Elastic Beanstalk application name(space).
  • IAM_INSTANCE_PROFILE_ROLE: The instance profile (IAM role) Elastic Beanstalk EC2 instaces will run under.