This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remove outliner | |
upper = df.quantile(0.99) | |
cols = set(list(df)) - {"ts", "tss"} | |
df_clean = df | |
for col in cols: | |
df_clean = df_clean[(df_clean[col] < upper[col])] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
streamlit | |
openai <= 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
import urllib.parse | |
import uuid | |
import os | |
def lambda_handler(event, context): | |
sfn = boto3.client('stepfunctions') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import urllib3 | |
bot_token = os.environ.get('SLACK_BOT_TOKEN') | |
def send_slack_message(channel, message, blocks=[], attachments=[]): | |
http = urllib3.PoolManager() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# grab the first unformatted disk and format it, then label it and update to fstab | |
# this must be ran as root | |
import subprocess | |
import time | |
import os | |
import datetime | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import redis | |
from concurrent.futures import ThreadPoolExecutor | |
from tqdm import tqdm | |
source = redis.Redis.from_url(sys.argv[1]) | |
dest = redis.Redis.from_url(sys.argv[2]) | |
print "Migrating %s -> %s" % (source, dest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright (c) 2018 Bao Nguyen <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -f "/etc/systemd/system/node_exporter.service" ]; then | |
wget https://github.com/prometheus/node_exporter/releases/download/v0.15.2/node_exporter-0.15.2.linux-amd64.tar.gz | |
tar -xvf node_exporter* | |
sudo mv node_exporter-0.15.2.linux-amd64/node_exporter /usr/sbin | |
sudo bash -c 'cat <<EOT > /etc/systemd/system/node_exporter.service | |
[Unit] | |
Description=Node Exporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------- | |
Exception happened during processing of request from ('10.26.0.173', 63486) | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock | |
self.process_request(request, client_address) | |
File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request | |
self.finish_request(request, client_address) | |
File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request | |
self.RequestHandlerClass(request, client_address, self) | |
File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
ec2 = boto3.client('ec2') | |
images = ec2.describe_images(Owners=['self']) | |
for image in images['Images']: | |
if image['State'] == 'available': | |
snapshots = image['BlockDeviceMappings'] | |
NewerOlder