This file contains hidden or 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 subprocess | |
from json import dumps | |
# NOTE: Files will be written to the current directory, without any checks to prevent overwriting. Archiving and/or version control are not considered here, but highly encouraged. | |
# get a list of all webtasks for the current user | |
list_request = subprocess.run(['wt', 'ls'], stdout=subprocess.PIPE, text=True) | |
# transform that output into a list of task names | |
tasks = [ ln.replace('Name:','').strip() for ln in list_request.stdout.split("\n") if 'Name:' in ln ] |
This file contains hidden or 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 hashlib | |
from json import dumps | |
from collections import OrderedDict | |
# composerFileContents should be the dict version of the composer.json file | |
def getContentHash(composerFileContents): | |
relevant = OrderedDict((key, composerFileContents[key]) for key in composerFileContents.keys() if key in ['name','version','require','require-dev','conflict','replace','provide','minimum-stability','prefer-stable','repositories','extra']) | |
if 'config' in composerFileContents and 'platform' in composerFileContents['config']: | |
relevant['config']['platform'] = composerFileContents['config']['platform'] |
This file contains hidden or 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
for idx in $(curl -sS https://${DOMAIN}:${PORT}/_cat/indices | awk '{print $3}'); do curl -XDELETE "https://${DOMAIN}:${PORT}/${idx}"; done |
This file contains hidden or 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
from datetime import datetime | |
import pytz | |
UTC = pytz.timezone("UTC") | |
for tzn in pytz.common_timezones: | |
tz = pytz.timezone(tzn) | |
print( | |
tzn, | |
UTC.localize(datetime(2020, 12, 15)).astimezone(tz).strftime('%z'), | |
UTC.localize(datetime(2020, 6, 15)).astimezone(tz).strftime('%z'), |
This file contains hidden or 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 | |
from json import dumps | |
from yaml import dump | |
image = 'amzn2-ami-kernel-5.10-hvm-x86_64-gp2' | |
regions = [ | |
'ap-northeast-1', | |
'ap-northeast-2', | |
'ap-northeast-3', |
This file contains hidden or 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
from requests import get | |
from json import dumps, loads | |
from prettytable import PrettyTable | |
src_server = 'http://localhost:9200' | |
def docCount(idx=None, typ=None): | |
url = src_server | |
if idx: |
This file contains hidden or 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/sh | |
sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel | |
cd /tmp | |
wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz | |
tar -xvf Python-3.9.6.tgz | |
cd Python-3.9.6 | |
./configure --enable-optimizations | |
sudo make altinstall | |
python3.9 --version |
This file contains hidden or 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 | |
destfile() { | |
dir=$(dirname "$1") | |
filename=$(basename -- "$1"); | |
extension="${filename##*.}"; | |
basename="${filename%.*}"; | |
filepath="${dir}/${basename}-faded.${extension}"; | |
c=0 |