Skip to content

Instantly share code, notes, and snippets.

View schelkanov's full-sized avatar
:atom:
busy

Alexandr Schelkanov schelkanov

:atom:
busy
View GitHub Profile
@schelkanov
schelkanov / kinesis.py
Created June 7, 2019 17:34 — forked from w3irdrobot/kinesis.py
Reading Data From Kinesis
from datetime import datetime, timedelta
import json
import boto
def get_kinesis_data_iterator(stream_name, minutes_running):
# Connect to Kinesis
kinesis = boto.connect_kinesis()
# Get data about Kinesis stream for Tag Monitor
kinesis_stream = kinesis.describe_stream(stream_name)
@schelkanov
schelkanov / dynamodb_replicate_table.py
Created June 4, 2019 15:32 — forked from Dineshkarthik/dynamodb_replicate_table.py
Copy dynamoDB table to another region using python, boto3. This script creates an exact replica of the table with same key schema and attribute definitions.
# Copyright (C) 2018 Dineshkarthik Raveendran
from __future__ import print_function # Python 2/3 compatibility
import boto3
import argparse
def replicate(table_name, existing_region, new_region, new_table_name):
"""
Replicate table in new region.
@schelkanov
schelkanov / bash.generate.random.alphanumeric.string.sh
Created September 19, 2018 10:28 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@schelkanov
schelkanov / gist:64ba3cd1253896be6d914f3da2a63b14
Created June 22, 2018 07:55 — forked from boznius/gist:ebd49607df11b8054c497ab94f30537a
encrypt all files in a directory with ansible-vault
for i in $(find . -type f); do ansible-vault encrypt $i --vault-password-file ~/.vault && echo $i encrypted ; done
@schelkanov
schelkanov / image2urijpeg.sh
Created June 16, 2018 00:53 — forked from vadimkantorov/image2urijpeg.sh
Convert an image to Base64 data-uri format using ImageMagick and OpenSSL
# Usage:
# bash image2urijpeg.sh image.jpg 320x240 > base64.txt # will resize before conversion
# bash image2urijpeg.sh image.jpg > base64.txt # will keep original size
magick "$1" -resize ${2:--} jpeg:- | openssl enc -base64 -A | sed -e 's/^/data:image\/jpeg;base64,/'
@schelkanov
schelkanov / gifcast.cmd
Created June 16, 2018 00:53 — forked from vadimkantorov/gifcast.cmd
Record a GIF screencast on Windows using FFmpeg
ffmpeg -y -video_size 800x600 -offset_x 10 -offset_y 120 -framerate 5 -show_region 1 -f gdigrab -an -i desktop -vf scale=320:240 output.gif
@schelkanov
schelkanov / genpass.sh
Created June 16, 2018 00:53 — forked from vadimkantorov/genpass.sh
Generate a random password
echo $(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c10)
#!/usr/bin/python
import time
import datetime
import random
timestr = time.strftime("%Y%m%d-%H%M%S")
f = open('access_log_'+timestr+'.log','w')
ips=["123.221.14.56","16.180.70.237","10.182.189.79","218.193.16.244","198.122.118.164","114.214.178.92","233.192.62.103","244.157.45.12","81.73.150.239","237.43.24.118"]
referers=["-","http://www.casualcyclist.com","http://bestcyclingreviews.com/top_online_shops","http://bleater.com","http://searchengine.com"]
@schelkanov
schelkanov / packer-ami-id
Created June 16, 2018 00:13 — forked from dasgoll/packer-ami-id
Get AMI ID from a packer build
packer build packer.json 2>&1 | sudo tee output.txt
tail -2 output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }' > sudo ami.txt
@schelkanov
schelkanov / wildcard-ssl-cert-for-testing-nginx-conf.md
Created June 16, 2018 00:11 — forked from dasgoll/wildcard-ssl-cert-for-testing-nginx-conf.md
create a self signed wildcard ssl cert for testing with nginx.conf example
openssl genrsa 2048 > edgenode1.key

openssl req -new -x509 -nodes -sha1 -days 3650 -key edgenode1.key -subj "/C=JO/CN=*.goll.com"> edgenode1-wildcard.cert

Common Name (eg, your name or your server's hostname) []:*.goll.com