Skip to content

Instantly share code, notes, and snippets.

View KamilMroczek's full-sized avatar

Kamil Mroczek KamilMroczek

View GitHub Profile
# An unique identifier for the head node and workers of this cluster.
cluster_name: cluster_name
# The maximum number of workers nodes to launch in addition to the head
# node.
max_workers: 16
# The autoscaler will scale up the cluster faster with higher upscaling speed.
# E.g., if the task requires adding more nodes then autoscaler will gradually
# scale up the cluster in chunks of upscaling_speed*currently_running_nodes.
class HttpDownloader(object):
def get_to_s3(self, http_get_source_url: str, bucket_name: str, key: str, max_concurrency: int = 4):
"""
Taken from https://amalgjose.com/2020/08/13/python-program-to-stream-data-from-a-url-and-write-it-to-s3/.
:param http_get_source_url: The url to download the data from. Should be a GET request.
:param bucket_name: The target bucket name.
:param key: The target S3 key.
:param max_concurrency: The maximum number of threads to upload concurrently.
@KamilMroczek
KamilMroczek / logentries_grep.sh
Last active August 27, 2015 17:44
Log Entries Grep
# Search for request line
\d\d [A-Za-z]* \d\d\d\d \d\d:\d\d:\d\d.\d\d\d \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d\d\d\d\d\d\+00:00 heroku router.*path="(.*)\?.*" host=.* request_id=.* fwd=".*" dyno=(.*) connect=.*ms service=(.*)ms status=.* bytes=.* Context
# Search for lines with CPU Load Avg
\d\d [A-Za-z]* \d\d\d\d \d\d:\d\d:\d\d.\d\d\d \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d\d\d\d\d\d\+00:00 heroku.*source=(.*) dyno=(.*) sample#load_avg_1m=.* sample#load_avg_5m=.* sample#load_avg_15m=.* Context
# Search for Memory
\d\d [A-Za-z]* \d\d\d\d \d\d:\d\d:\d\d.\d\d\d \d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d\d\d\d\d\d\+00:00 heroku.*source=.* dyno=.* sample#memory_total=.* sample#memory_rss=.* sample#memory_cache=.* sample#memory_swap=.* sample#memory_pgpgin=.*pages sample#memory_pgpgout=.*pages
.ruby-gemset
.ruby-version
.DS_Store
@KamilMroczek
KamilMroczek / ec2-logrotate-elasticbeanstalk
Created November 4, 2013 00:45
Stock log rotate script on EC2.
/var/log/tomcat7/catalina.out /var/log/tomcat7/localhost_access_log.txt {
size 1M
missingok
rotate 5
compress
notifempty
copytruncate
dateext
dateformat -%s
}