Skip to content

Instantly share code, notes, and snippets.

View Alex-Just's full-sized avatar

AlekseiK Alex-Just

View GitHub Profile
"""
The script fetches and prints the average CPU utilization for a given AWS RDS instance ID for the past specified months
"""
from datetime import datetime, timedelta
import boto3
# Configuration
INSTANCE_ID = '...'
"""
This script retrieves and displays the top five AWS service costs for each of the past six months.
It uses the AWS Cost Explorer API through the AWS CLI to fetch cost data, then processes and
sorts this data to find the most significant service costs. The costs are displayed in USD format,
showing the service name and the incurred cost over each month's period.
Note: AWS CLI must be configured with the appropriate permissions for this script to run successfully.
Sample output:
cd /tmp
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig:/usr/lib
export PATH=/usr/bin:$PATH
export LDFLAGS=-L/usr/lib64:/usr/lib
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/usr/local/lib/
export CPPFLAGS=-I/usr/include
sudo yum groupinstall "Development Tools" -y
sudo yum install pango-devel.x86_64 giflib-devel libjpeg-devel cairo-devel cairo-gobject-devel libXi-devel cups-libs dbus-glib libXrandr libXcursor libXinerama libXt.{i686,x86_64} -y
# Get all keys from the DB
redis-cli -n 8 --scan
# Get all keys and values from the DB
echo 'keys *' | redis-cli -n 8 | sed 's/^/get \"/' | sed 's/$/\" /' | redis-cli -n 8 | jq .
AWS_ACCESS_KEY_ID=X AWS_SECRET_ACCESS_KEY=X aws dynamodb list-tables --endpoint-url http://localhost:8000 --region x
AWS_ACCESS_KEY_ID=X AWS_SECRET_ACCESS_KEY=X aws dynamodb scan --table-name smpl_auth --endpoint-url http://localhost:8000 --region x
@Alex-Just
Alex-Just / karabiner.json
Created May 3, 2019 12:54
left_command -> English, right_command -> Russian
{
"rules": [
{
"description": "left_command -> English, right_command -> Russian",
"manipulators": [
{
"conditions": [
{
"input_sources": [
{
cqlsh
DESCRIBE keyspaces;
SELECT * FROM scraper_logs_dev.scraper_log;
TRUNCATE scraper_logs_dev.scraper_log;

GENERAL QUESTIONS

  1. What's faster: lookup a value in an array or in object keys?

  2. What's the easiest way of deduplicating an unordered array of numbers?

  3. Http requests. PUT vs PATCH vs POST

  4. git merge vs rebase

  5. How do you know if your API is RESTful?

# Print raw XML
from lxml import etree
etree.tostring(etree.ElementTree(xml), pretty_print=True, encoding='unicode')
var date = new Date();
undefined
date
Thu Apr 19 2018 17:52:34 GMT+0300 (MSK)
date.setHours(0);
1524088354412
date.setMinutes(0);
1524085234412
date.setSeconds(0);
1524085200412