This file contains 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
import gradio as gr | |
import numpy as np | |
def func(img, n): | |
R = img[:,:,0] | |
G = img[:,:,1] | |
B = img[:,:,2] | |
R = np.where(R <= n, 0, R) |
This file contains 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
import bpy | |
for m in bpy.data.materials: | |
if not m.use_nodes: | |
continue | |
#print(m) | |
nodes = m.node_tree.nodes | |
#print(nodes) | |
img_nodes = [n for n in nodes if n.type == "TEX_IMAGE"] | |
#print(nodes[:]) |
This file contains 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 telnetlib import Telnet | |
with Telnet('koukoku.shadan.open.ad.jp', 23) as tn: | |
while (b := tn.read_some()) != b'': | |
print(b.decode('sjis'), end='') |
This file contains 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
#################### | |
# Batch Import OBJ # | |
#################### | |
import bpy | |
def f(**kwargs): | |
print(kwargs) |
This file contains 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/env python3 | |
import os, sys | |
if os.environ.get("PAM_TYPE") != "open_session": | |
sys.exit(0) | |
WEBHOOK_URL = "<DiscordのWebhook URL>" | |
from datetime import datetime | |
import pytz, locale, requests |
This file contains 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
# $ ssh example-tmux | |
# を実行したときに、 | |
# $ ssh example -t -- tmux -u -2 attach | |
# を実行させる設定の書き方 | |
# | |
# Matchを使うことで名前に-tmuxが付くときだけに有効な設定を書くことができて、 | |
# ユーザー名やポートなどの設定は共通化できる | |
Host example example-tmux | |
HostName example.com |
This file contains 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
// 3D Tiles の tileset.json の transform に書く内容を出力してみる | |
// | |
// deno で npm が使えるようになったのでお手軽になった | |
// Vim で :QuickRun typescript/deno とかする | |
// | |
// See: https://groups.google.com/g/cesium-dev/c/0K_RXY0gIM4 | |
import * as Cesium from "npm:cesium"; | |
const lon = 175.3050519951; // 経度 |
This file contains 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
import bpy | |
context = bpy.context | |
def selected_objects_as_active(): | |
for o in context.selected_objects: | |
context.view_layer.objects.active = o | |
yield o | |
for o in selected_objects_as_active(): | |
print(o is context.active_object) # True |
This file contains 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
# degrees, minutes, seconds to decimal degrees | |
def dms2dd(d, m, s): | |
return d + (m / 60) + (s / 3600) | |
print([dms2dd(36, 6, 13.58925), dms2dd(140, 5, 16.27815)]) # [36.103774791666666, 140.08785504166667] |
This file contains 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 pyproj import Transformer | |
# EPSG:4326 WGS84 地理座標系(緯度経度) | |
# EPSG:6677 JGD2011 IX(9)系 | |
transformer = Transformer.from_crs(4326, 6677) | |
# 緯度経度 (十進法度単位) | |
lat = 36.103774792 # 緯度 | |
lon = 140.087855042 # 経度 |
NewerOlder