Skip to content

Instantly share code, notes, and snippets.

View maozza's full-sized avatar

Maoz Zadok maozza

View GitHub Profile
@maozza
maozza / eks-internal-endpoint.go
Created November 24, 2021 17:34
get EKS internal IP and cluster endpoint to push into hosts file
package main
import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/eks"
"os"
"fmt"
@maozza
maozza / bitly_to_yourls.py
Last active June 24, 2017 11:21 — forked from PiotrKrzyzek/bitly_to_yourls.py
migration script from bitly to yourls using API #1742
#! /usr/bin/python
#Simple script for importing data from bitly to yourls using bitly and yourls API.
import urllib2, json, urllib
#Add the following data
yourls_host = 'your-domain-where-yours-is-installed.com'
bitly_token = 'your-bitly-token'
yourls_signature = 'your-yourls-signature-key'
@maozza
maozza / create temporary swap
Created June 8, 2017 22:43
Create temporary swap on Linux machine with one line
export SWAPFILE="/swap/swap.`date +%y%m%d`.image"\
&& mkdir /swap\
&& dd if=/dev/zero bs=4k of=${SWAPFILE} count=250000\
&& mkswap ${SWAPFILE}\
&& chmod 600 ${SWAPFILE}\
&& swapon ${SWAPFILE}
@maozza
maozza / elasticsearch2csv.py
Last active December 26, 2017 15:51
Tool for exporting elasticsearch query to CSV file assumption: the response document is not multidimensional(nested) document. it will execute elasticsearch query_string, for example query_string: this AND that OR thus
#!/usr/bin/python3
import elasticsearch
import argparse
import csv
from elasticsearch import helpers
import json
'''
Tool for exporting elasticsearch query to CSV file
assumption: the response document is not multidimensional(nested) document.
#! /usr/bin/python
import argparse
import sys
import requests
import xml.etree.ElementTree as ET
'''
Nagios plugin that check pending messages or low numbers of consumers in ActiveMQ queue
Author: Maoz Zadok
'''
@maozza
maozza / s3_backup.py
Created March 27, 2017 22:50
backup to amazon S3
#! /usr/bin/python
import boto3
import os
from boto3.s3.transfer import S3Transfer
import socket
import argparse
import time
import hashlib
from botocore.exceptions import ClientError
import sys