Skip to content

Instantly share code, notes, and snippets.

#!/usr/local/bin/python3
from __future__ import print_function
import json
import boto3
interfaces = ""
cidr_block = ""
cidr_block_description = ""
ip_protpcol = ""
@toripiyo
toripiyo / create_github_issue_sample.rb
Created March 28, 2020 06:33
sample script to create github issue with octokit gem
require 'json'
require 'octokit'
access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
client = Octokit::Client.new(:access_token => access_token)
repo = 'toripiyo/xxxxx'
# read json file
json_file_name = 'sample.json'
file = File.open(json_file_name)
@toripiyo
toripiyo / query.json
Last active April 24, 2020 15:04
obtain over 10000 documents from elasticsearch
{
"size": 10000,
"sort": [
"_doc"
],
"query": {
"bool": {
"must" : [
{ "match": { "sports": "baseball" }},
{ "match": { "date": "2020-04-20" }},
@toripiyo
toripiyo / code.gs
Last active January 20, 2022 21:07
create GitHub issues from selected range on Google SpreadSheet
const ui = SpreadsheetApp.getUi();
const userProperties = PropertiesService.getUserProperties();
const ACCESS_TOKEN = 'access token';
function setToken(){
const scriptValue = ui.prompt('Personal Access Token', ui.ButtonSet.OK);
userProperties.setProperty(ACCESS_TOKEN, scriptValue.getResponseText());
}
function removeToken(){
@toripiyo
toripiyo / code.gs
Last active October 10, 2021 03:09
List GitHub Issues on Google SpreadSheets
const ui = SpreadsheetApp.getUi();
const userProperties = PropertiesService.getUserProperties();
const ACCESS_TOKEN = 'personal access token';
const ALPHABETS = [...Array(26)].map((_, y) => String.fromCharCode(y + 65)); // https://gist.github.com/mreigen/fdeafcc08a9e44d976bd6a8db468c496
function onOpen(){
ui.createMenu('GitHub')
.addItem('List GitHub Issues', 'listGitHubIssues')
.addItem('Set Personal Access Token', 'setToken')
@toripiyo
toripiyo / fetch_securityhub_findings.rb
Created October 22, 2021 07:43
fetch securityhub findings and write csv file
require 'aws-sdk-securityhub'
require 'csv'
require 'pry'
aws_profile_name = 'your profile name that you want to use on this script'
client = Aws::SecurityHub::Client.new(profile: aws_profile_name)
filters = {
# id: [
# {