Skip to content

Instantly share code, notes, and snippets.

@aont
aont / eject_drive.bat
Created April 23, 2024 13:38
ハードウェアの安全な取り外し
@rem https://superuser.com/questions/1547316/eject-connected-external-hard-drive-using-cmd
C:\Windows\System32\rundll32.exe shell32.dll,Control_RunDLL hotplug.dll
#!/usr/bin/env python
import os
import sys
input_fn = sys.argv[1]
with open(input_fn, "rt", encoding="UTF-8") as fp:
input_text = fp.read()
// ref: https://users.wfu.edu/natalie/s14phy770/projects/
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <vector>
#include <random>
#!/usr/bin/env python
import os
import glob
import sys
import json
import subprocess
import zipfile
import io
import shutil
diff -u a/bash.bash_logout b/bash.bash_logout
--- a/bash.bash_logout 2024-01-06 23:09:23.578819100 +0900
+++ b/bash.bash_logout 2024-01-06 23:06:58.672315000 +0900
@@ -10,6 +10,6 @@
# System-wide bashrc file
# when leaving the console clear the screen to increase privacy
-if [ "$SHLVL" = 1 ]; then
- [ -x /usr/bin/clear ] && /usr/bin/clear
-fi
@aont
aont / caw.py
Last active April 11, 2024 03:57
change active window
#!/usr/bin/env python
import os
import sys
import ctypes
import ctypes.wintypes
import time
import ctypes
Array.from(document.querySelectorAll("img[src^=\"https://private-user-images.githubusercontent.com/\"]")).forEach((img, index, array)=>{
if(!img.complete) {
let imgSrc = img.src;
img.src = "";
img.style.display = "none";
// img.setAttribute("_src", imgSrc)
let anchor = img.parentElement;
// anchor.removeChild(img);
let textNode = document.createTextNode("click to view image");
anchor.appendChild(textNode)
Array.from(document.querySelectorAll("img[src^=\"https://private-user-images.githubusercontent.com/\"]")).forEach((img, index, array)=>{
if(img.complete) {
var anchor = img.parentElement;
anchor.removeAttribute("href")
// console.log(img)
var canvas = document.createElement("canvas")
canvas.height = img.naturalHeight
canvas.width = img.naturalWidth
canvas.style.maxWidth = "100%"
var context = canvas.getContext("2d")
@aont
aont / ec2aux.py
Last active December 3, 2023 11:55
import sys
import os
import datetime
import argparse
import re
import asyncio
import ipaddress
import socket
try: import tomllib as toml
#!/usr/bin/env python
import sys
import os
import json
import ctypes
import pywintypes
import win32api
import win32gui