Skip to content

Instantly share code, notes, and snippets.

View peycho's full-sized avatar
☢️
In Sterquiliniis Invenitur

Peycho Dimitrov peycho

☢️
In Sterquiliniis Invenitur
View GitHub Profile
@peycho
peycho / app.py
Created August 2, 2023 11:48
Execute bash script via basic http api
import http.server
import socketserver
import subprocess
PORT = 8000
REQUEST_TIMEOUT = 600
SCRIPT = "/home/ubuntu/test.sh"
class MyHandler(http.server.SimpleHTTPRequestHandler):
@peycho
peycho / aws firehose update-destination example-config.json
Last active October 4, 2021 13:19
aws firehose update-destination example-config
{
"CurrentDeliveryStreamVersionId": "Obtain this value from the VersionId result of DeliveryStreamDescription. This value is required, and helps the service perform conditional operations. For example, if there is an interleaving update and this value is null, then the update destination fails. After the update is successful, the VersionId value is updated. The service then performs a merge of the old configuration with the new configuration.",
"DeliveryStreamName": "The name of the delivery stream.",
"DestinationId": "The ID of the destination.",
"ElasticsearchDestinationUpdate": {
"BufferingHints": {
"IntervalInSeconds": "Buffer incoming data for the specified period of time, in seconds, before delivering it to the destination. The default value is 300 (5 minutes).",
"SizeInMBs": "Buffer incoming data to the specified size, in MBs, before delivering it to the destination. The default value is 5. \nWe recommend setting this parameter to a value greater than the
@peycho
peycho / procx.sh
Last active April 26, 2019 14:01
Monitoring linux process with bash script.
#!/bin/bash
process="your-process-here"
run_command="command to start the process"
time_check="5" # time to check in sec.
while true ; do
proc_count=$(ps xa | grep -v grep | grep "$process" | wc -l)
if [ "$proc_count" == 0 ]; then
$run_command
Cloud-init v. 0.7.5 running 'modules:config' at Wed, 12 Aug 2015 14:06:28 +0000. Up 17.07 seconds.
2015-08-12 14:06:28,506 - util.py[WARNING]: Activating mounts via 'mount -a' failed
Generating locales...
en_US.UTF-8... up-to-date
Generation complete.
Cloud-init v. 0.7.5 running 'modules:final' at Wed, 12 Aug 2015 14:06:31 +0000. Up 20.04 seconds.
Starting: 2015-08-12 14:06:31
Wait 10 sec. for volumes detection...
Prepare Volumes
2015-08-12 14:06:41,297 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [1]