Skip to content

Instantly share code, notes, and snippets.

View bvlion's full-sized avatar
🏠
Working from home

Satoshi Iwai bvlion

🏠
Working from home
View GitHub Profile
// 指定のウィンドウサイズに変更
int width = 480;
int height = 600;
driver.manage().window().setSize(new Dimension(width, height));
// 最大化
/* driver.manage().window().maximize(); */
if (isFirefox) {
FirefoxProfile profile = new FirefoxProfile();
@bvlion
bvlion / spring_meta_table_clean.sh
Created March 23, 2017 01:22
Springバッチの管理DBの指定日以前のデータを削除するシェル(パスワードの管理方法に関しては.my.cnf等を検討)
#!/bin/bash
# SQL情報
PREFIX=
USER=
PASSWORD=
SCHEMA=
# 最終保存日
DATE=`date '+%Y-%m-%d'`
@bvlion
bvlion / server.js
Created June 29, 2017 02:35
Node.jsでhtmlを表示するサンプル
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
var server = http.createServer();
server.on('request', doRequest);
var fs = require('fs');
function doRequest(req, res) {
var url = req.url;
@bvlion
bvlion / Main.java
Last active July 20, 2017 08:12
「今さらJava8のStreamとLambdaの関係」の資料用
import java.util.function.Function;
import java.util.stream.Stream;
public class Main {
public static void main(String... args) {
// これまでのJavaのように書くと、こんな感じになります。
Function<String, Integer> fullFunction = new Function<String, Integer>() {
@Override
public Integer apply(String arg) {
return Integer.parseInt(arg);
@bvlion
bvlion / AzureService.java
Created September 12, 2017 14:35
翻訳をJavaで実行してみるソース
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
@bvlion
bvlion / SlackBinaryPost.java
Created March 12, 2017 07:52
SlackにJavaからBinaryを送信するサンプル
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.ProtocolException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.Calendar;
@bvlion
bvlion / asana_section_add_task.php
Created November 30, 2018 02:41
asanaのセクション配下にタスクをPHPで追加するサンプル
<?php
$data = array('data' => array(
'memberships' => array(array('project' => $_POST['project'], 'section' => $_POST['section'])),
'name' => $_POST['word'],
'workspace' => $_POST['workspace'],
'notes' => $_POST['note']
));
$header = array(
'Content-Type: application/json',
@bvlion
bvlion / cert_check.sh
Created December 30, 2019 10:29
openssl を使って証明書期限切れを確認する
#!/bin/bash
IFS=$'\n'
for line in `/usr/bin/openssl x509 -noout -dates -in target.pem`
do
CHECK=`echo $line | cut -d '=' -f 2`
done
END_DATE=`date -d $CHECK +%s`
@bvlion
bvlion / payBackContact.js
Created June 6, 2021 03:48
Google スプレッドシートで始めるアプリ運用
var userName = ''
var gmailUserName = ''
var gmailAddress = ''
function reply() {
var sheet = SpreadsheetApp.getActiveSheet()
var active = sheet.getActiveCell()
if (sheet.getName() != 'contact') {
return
}
@bvlion
bvlion / Application.kt
Created March 8, 2022 00:14
Bearer トークンの妥当性だけを確認する
import io.ktor.application.*
import io.ktor.auth.*
import io.ktor.http.*
import io.ktor.response.*
import io.ktor.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*
@Suppress("unused")
fun Application.module() {