Skip to content

Instantly share code, notes, and snippets.

@ha1t
ha1t / local_ip.vbs
Last active April 4, 2023 03:20
Stable Diffusionの run.bat に cscript local_ip.vbs を追加することで、自分のIP付きのURLを出せる
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
For Each objItem in colItems
If Not IsNull(objItem.IPAddress) Then
For Each strIPAddress in objItem.IPAddress
WScript.Echo "IP Address: http://" & strIPAddress & ":7860"
Next
End If
Next
@ha1t
ha1t / daemon.py
Last active October 20, 2021 02:29
AT command for ezDisplay
#!/usr/bin/env python
# https://qiita.com/croquisdukke/items/9c5d8933496ba6729c78
import time
import os
import sys
import serial
import datetime
@ha1t
ha1t / photo_rename.ps1
Created April 28, 2021 07:12
画像のファイル名にEXIFから取得できる撮影日時を付与する
#
# 以下のURLを参考に適当なショートカットを作成して、リンク先を powershell -NoProfile -File ファイル名(.ps1) とし
# http://misohena.jp/blog/2017-10-16-drag-and-drop-to-powershell-script.html
# 画像ファイルをドロップするとファイル名の手前に撮影日時をつけてくれる
# 例外処理はいれてないのでバックアップとった上で動かす必要がある
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
# Write-Output hoge
@ha1t
ha1t / post.gcode
Created August 31, 2020 11:10
Ender-3 GCode
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z10 ;Raise Z more
G90 ;Absolute positionning
G1 X0 Y{machine_depth} ;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
<?php
define('MIXI_EMAIL', 'xxx@example.com');
define('MIXI_PASSWORD', 'pass');
/**
* mixiの日記削除スクリプト
*
* @author Kiryu Tsukimiya <kiryu@angelicwing.net>
*/
<?php
$rows1 = [['id' => 1], ['id' => 2]];
$rows2 = [[]];
$rows3 = [];
function pattern1($rows)
{
/*
Fade
This example shows how to fade an LED on pin 9 using the analogWrite()
function.
The analogWrite() function uses PWM, so if you want to change the pin you're
using, be sure to use another PWM capable pin. On most Arduino, the PWM pins
are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11.
<?php
function hex2ascii($hex)
{
$ascii = '';
$hex = str_replace(" ", "", $hex);
for($i = 0; $i < strlen($hex); $i = $i+2)
$ascii .= chr(hexdec(substr($hex, $i, 2)));
return($ascii);
}
@ha1t
ha1t / gist:1a2fcc6255242a53216ad189b82ad179
Created March 10, 2017 07:36
Google App Engine for PHP で有効になっている extension の list
```
Array
(
[0] => Core
[1] => date
[2] => ereg
[3] => libxml
[4] => openssl
[5] => pcre
[6] => zlib
@ha1t
ha1t / readme.md
Last active March 8, 2017 08:35
highlite所感

1,2時間使ってみた結果。随時追記します。

memo

  • アカウントを作る前にどんなサービスなのかわかりそうでわからない。

    • どんな表示なのか、どんな使い方なのか気になってクリックするといちいちアカウント登録しろって言われる。
    • わからないようにしたいなら何も触れないようにすればいいしわかるようにしたいならアカウント作る前に一定の流れまで想像できる見え方にしてほしい
  • アカウントを作るコストがでかい。

    • パスワード憶えたくなくてtwitter連携でログインしたのにパスワード登録もとめられるしプロフィール画面でemailの入力をもとめられる。
  • なぜtwitter連携でemailとらないのか。OAuthのときにinclude_email足せばとれる。