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
| #303E4D,#60a8cc,#0f658a,#64fcda,#546e7a,#eceff1,#40c4ff,#ff5252 |
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 matplotlib.pyplot as plt | |
| import seaborn as sns | |
| from collections import Counter | |
| def counter_plot(values, max_count=len(set(values)), | |
| figsize=(17,5), dpi=80, | |
| fontsize=12, rotation=90, | |
| xoffset=.05, yoffset=.1): | |
| c = Counter(values) | |
| l, v = zip(*c.most_common(max_count)) |
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
| function FindProxyForURL(url, host) { | |
| return "SOCKS localhost:10080"; | |
| } |
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 -eu | |
| DEFAULT_REGION=ap-northeast-1 | |
| INSTANCE_ID=`curl -fsSL http://169.254.169.254/latest/meta-data/instance-id/` | |
| if [ $? = 0 ]; then | |
| echo "instance-id:["$INSTANCE_ID"]" | |
| else | |
| echo "An unexpected error occurred when trying to get instance-id." | |
| exit 1 | |
| fi |
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 sys | |
| import os | |
| import dotenv | |
| from slackclient import SlackClient | |
| dotenv.load_dotenv('/path/to/.env') | |
| def post_slack(text: str, channel: str): | |
| slack_token = os.environ['SLACK_API_TOKEN'] |
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
| # -*- coding: utf-8 -*- | |
| import logging | |
| import sys | |
| from nvdloader import NVDLoader | |
| def main(): | |
| argv = sys.argv | |
| if len(argv) != 2 or argv[1] not in ['2', '3']: | |
| print('Usage: $ python %s 2|3 (CVSS ver.)' % argv[0]) |
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 os | |
| PATH_DIR = '/path/to/dir' | |
| if not os.path.exists(PATH_DIR): | |
| print('mkdir', PATH_DIR) | |
| os.mkdir(PATH_DIR) |
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 sys | |
| def show_progress(e, i, t, l, v): | |
| ''' | |
| Prints the training progress recursively. | |
| Args: | |
| e (int): the current epoch | |
| i (int): the current batch | |
| t (int): the total batches |
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
| # use --trace-ascii to show the payload | |
| curl -i -d 'key=value' [-v] [--trace-ascii /dev/stdout] https://example.com/ |
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 rest_framework.views import APIView | |
| from rest_framework.decorators import parser_classes | |
| from rest_framework.parsers import FormParser | |
| from django.http import JsonResponse | |
| from drf_yasg import openapi | |
| from drf_yasg.utils import swagger_auto_schema | |
| class TestView(APIView): | |
| '''Test API |