Skip to content

Instantly share code, notes, and snippets.

View shimarin's full-sized avatar

Tomoatsu Shimada shimarin

View GitHub Profile
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)
@shimarin
shimarin / vtermtest.cpp
Last active April 6, 2024 13:00
SDL2 terminal emulator using libvterm
// g++ -o vtermtest vtermtest.cpp -lvterm -lutil -lSDL2 -lSDL2_ttf -licuuc
#include <termios.h>
#include <pty.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <iostream>
#include <vector>
#include <vterm.h>
#include <SDL2/SDL.h>
#!/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データベース接続設定
@shimarin
shimarin / bios-efi.txt
Last active February 13, 2024 03:40
BIOSとEFIの両方で起動出来るブートパーティションの作成
BIOSで起動できないディスク
2TBを超えるディスク
4096bytes/sectorなディスク
fdisk pコマンド
physicalが 4096bytesでも logicalが 512bytesならセーフ
Sector size (logical/physical): 512 bytes / 512 bytes
# 古典的なMS-DOSパーティションテーブルを作成
parted --script /dev/sdX 'mklabel msdos'
# 1MiB-513MiBを境界とする容量512MiBの起動パーティションを作成
@shimarin
shimarin / block_device_sector_size.py
Last active January 11, 2024 13:24
Determining block device's sector size in Linux+Python
#!/usr/bin/python
import fcntl
import os
import struct
import array
import sys
BLKGETSIZE=0x1260
BLKGETSIZE64=0x80081272
BLKSSZGET=0x1268
@shimarin
shimarin / invoice.html
Created September 10, 2013 13:48
HTML請求書
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var data = {
"種別":"請求",
"番号":"20130930-01",
"担当者":"嶋田 大貴",
"宛先":{
"名称":"株式会社○○ 御中",
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <Adafruit_GFX.h> // Core graphics library by Adafruit
#include <Arduino_ST7789.h> //https://github.com/ananevilya/Arduino-ST7789-Library
#include "edogawa_unit.h"
#include "background.h" // 背景イメージ
#include <sys/mman.h>
#include <unistd.h>
#include <iostream>
int main()
{
auto fd = memfd_create("mytmpfile", 0);
if (fd < 0) throw std::runtime_error("memfd_create");
std::string tmp_filename = "/proc/" + std::to_string(getpid()) + "/fd/" + std::to_string(fd);
ffmpeg -ss 00:00:44 -i testa.mkv -to 00:01:30 -vf "scale=1920:-2" -vcodec libx264 testa.mp4
#include <cstring>
#include <string>
#include <stdio.h>
#include "sdkconfig.h"
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "driver/gpio.h"
#include "esp_wifi.h"
#include "esp_log.h"