Skip to content

Instantly share code, notes, and snippets.

@testpilot031
testpilot031 / gist:65111d9eaae59adc0ac8674be02a1892
Last active December 19, 2023 02:13
bat file include curl
@echo off
for /l %%n in (1,1,60) do (
time
rem curl -m 2 -I https://www.google.com -s -o nul -w "%{http_code}"
curl https://www.google.com -m 2 -o nul -s -w "%%{http_code}"
echo;
timeout /t 10 > nul
)
pause
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
public class DatabaseInserter {
private static final String DATABASE_URL = "jdbc:mysql://localhost:3306/your_database";
private static final String USERNAME = "your_username";
@testpilot031
testpilot031 / gist:fc477a8b885d5fa141849ae9597e0ff8
Created April 23, 2021 04:15
lambda_ec2_start_alb_rds_modify
import json
import os
import sys
import boto3
import time
import datetime
# import requests
# ログの時間出力用
dt_now = datetime.datetime.now()
def now_string(dt_format="%Y/%m/%d %H:%M:%S"):

make file web server app

cat << EOL > server.js var http = require('http');

var handleRequest = function(request, response) { console.log('Received request for URL: ' + request.url); response.writeHead(200); response.end('Hello World!'); }; var www = http.createServer(handleRequest);

@testpilot031
testpilot031 / gcp_curl_jwt.md
Last active September 8, 2019 09:54
Notes on executing GCP API with curl command

Overview

There are ways to use the gcloud API and SDK to run the GCP API.

Use a service account created with GCP. Since there is OAuth 2.0 authentication, API is accessed after getting a token. However, there was also a method of requesting the API directly without taking a token by encrypting the authentication information and embedding it in the http request header. I think that the latter is more familiar with how to make JWT, so this time I will use it.

The OS used was CentOS7 of Linux. In this article, we will skip creating service accounts. Please see https://jwt.io/introduction/ for details.

(Reference: Call using HTTP / REST https://developers.google.com/identity/protocols/OAuth2ServiceAccount#authorizingrequests:

# webhook の導入
$ sudo yum install wget
wget https://dl.google.com/go/go1.12.5.linux-amd64.tar.gz
# sudo tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz
$ sudo vi ~/.bash_profile
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
$ source ~/.bash_profile
$ sudo yum install git

VM の一覧を表示 $ VBoxManage list vms "Ubuntu17.04" {5ddf05d4-5a41-11e7-80c9-00042e01623a} "CentOS7" {642b939e-5a41-11e7-9d2f-00042e01623a}

VM を起動する Video コンソール有り: $ VBoxManage startvm "Ubuntu17.04" Video コンソール無し: $ VBoxManage startvm 642b939e-5a41-11e7-9d2f-00042e01623a --type headless

<!doctype html>
<html lang="ja">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<title>Angular JSON Get Sample</title>
<link href="./css/style.css" rel="stylesheet" type="text/css">
<link href="./css/bootstrap.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script>
# GW
packet forwrder想定
# NS
## rx 機能
1. GWからパケット受信(待ち受け)
- キューに渡す
2. キュープロセス
- メッセージキューにてパケット受け取り
@testpilot031
testpilot031 / Dockerfile.md
Last active June 21, 2018 04:25
docker for yang-explorer
# build:docker build -t yangb .
# run & bash:docker run docker run -p 80:80 -p 100:100 -it XXXXX /bin/bash
#
FROM ubuntu:17.10
RUN set -x && \
    apt update && \
    apt install -y vim git sudo mlocate lsof python-pip python-dev libffi-dev libssl-dev  && \
    apt install -y graphviz && \
    apt install -y libxml2-dev libxslt1-dev python-dev zlib1g-dev && \

apt install -y virtualenv && \