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
#!/usr/bin/python | |
import argparse,ipaddress,subprocess,re | |
import qrcode | |
def generate_privkey(): | |
return subprocess.check_output(["wg","genkey"]).decode("UTF-8").strip() | |
def get_pubkey(privkey): | |
return subprocess.check_output(["wg","pubkey"], input=privkey.encode("UTF-8")).decode("UTF-8").strip() |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript"> | |
var data = { | |
"種別":"請求", | |
"番号":"20130930-01", | |
"担当者":"嶋田 大貴", | |
"宛先":{ | |
"名称":"株式会社○○ 御中", |
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
/* | |
MIT License | |
Copyright (c) Tomoatsu Shimada 2024 | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is |
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 | |
BACKUP_ROOT=rsync://backup.local/backup | |
LOGFILE=/var/log/backup.log | |
PIDFILE=/run/backup.pid | |
FAILFILE=/run/backup.fail | |
exec_rsync() { | |
local name=$1 | |
local source=$2 | |
rsync -avx --delete-excluded $source $BACKUP_ROOT/$name |
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
/* | |
* modbus_rtu_get_device_info.cpp | |
* MODBUS RTU Device Info Getter for ESP32 series | |
* | |
* SPDX-FileCopyrightText: 2024 Tomoatsu Shimada/Walbrix Corporation | |
* | |
* SPDX-License-Identifier: MIT | |
*/ | |
#include <cstdint> |
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
def is_shift_key_being_pressed(): | |
TIOCLINUX = 0x541C # TIOCLINUXの値はLinuxのカーネルヘッダファイルから取得 | |
shift_state = 6 # 変数の初期値 | |
# 変数をバイトオブジェクトに変換 | |
shift_state_buf = struct.pack('B', shift_state) | |
try: | |
# ioctlシステムコールを使用してシフト状態を取得 | |
shift_state_buf = fcntl.ioctl(sys.stdin.fileno(), TIOCLINUX, shift_state_buf) | |
# 取得した結果をアンパックして表示 |
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
<?php | |
/** | |
* event.php | |
* JavaScriptのEventSource APIにサーバー側でのファイル更新イベントを通知するためのエンドポイント | |
* | |
* PHPにinotifyエクステンションが必要 https://github.com/arnaud-lb/php-inotify | |
* | |
* 2024 Tomoatsu Shimada | |
*/ |
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
#!/usr/bin/python | |
import socket | |
import argparse | |
def get_ssh_version_string(host, port=22, timeout=5): | |
try: | |
# ソケットアドレス情報を取得 | |
addr_info = socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM) | |
for res in addr_info: |
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 selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
def image_loaded(driver, element): | |
try: | |
# 画像が完全にロードされているかどうかを確認するJavaScript | |
return driver.execute_script("return arguments[0].complete && typeof arguments[0].naturalWidth != 'undefined' && arguments[0].naturalWidth > 0", element) |
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
#!/usr/bin/python | |
import MySQLdb | |
import ssl | |
import socket | |
from datetime import datetime | |
import smtplib | |
from email.mime.text import MIMEText | |
from email.mime.multipart import MIMEMultipart | |
# MySQLデータベース接続設定 |
NewerOlder