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
// 管理者として実行する必要がある。 gsudo インストール済みなら sudo ./Pause_Ethernet.ps1 | |
param( | |
[int]$seconds = 3 | |
) | |
Disable-NetAdapter -Name "イーサネット" -Confirm:$false | |
Write-Host 切断しました。 | |
Write-Host ${seconds}秒後に再接続します。 | |
Start-Sleep -Seconds $seconds | |
Enable-NetAdapter -Name "イーサネット" -Confirm:$false | |
Write-Host 接続しました。 |
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
// ゲームポッドのマイページのゲーム一覧ページを表示して使う。 | |
// https://www.gamepod.jp/mypage | |
// 開発者モードのコンソールに次のソースコードをペーストする | |
// リストにチェックリスト付きのゲームタイトル一覧が出てくるのでコピーしてNotionなどで対応すると良い | |
let text = ""; | |
Array.from(document.querySelectorAll("li.game")).forEach((e) => { | |
text += `- [ ] ${e.querySelector(".game-title div:nth-child(1)").textContent.replace(/[\n\s]/g, "")}`; | |
text += `(${e.querySelector(".game-title div:nth-child(2)").textContent.replace(/[\n\s]/g, "")})`; | |
text += `[リンク](${e.querySelector("a").href})`; |
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 xmltodict | |
import requests | |
# デバッグ用 | |
def print_keys(obj, prefix=''): | |
if isinstance(obj, dict): | |
for k, v in obj.items(): | |
print_keys(v, prefix + k + '.') | |
elif isinstance(obj, list): | |
for i, item in enumerate(obj): | |
print_keys(item, prefix + str(i) + '.') |
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
t = """ | |
12:05~12:59 | |
13:01~13:25 | |
14:32~15:22 | |
""" | |
times = t.strip().split("\n") | |
for time in times: | |
s = list(map(lambda x: x.split(":"), time.split("~"))) | |
start = int(s[0][0]) * 60 + int(s[0][1]) | |
length = int(s[1][0]) * 60 + int(s[1][1]) - start |
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
## Cut and output video files. | |
## $range Specify the range to output. Specify as "Start:Length". | |
## $source The name of the file to read. This parameter is required. | |
## $outfile The name of the file to output. When not specified, it is output to the desktop folder with the file name "outfile.mp4". | |
## ex. movcut "30:10" [filename] | |
function movcut ( | |
[Parameter(mandatory=$true)][ValidatePattern('^[\d\.]+:[\d\.]+$')][String] $range, | |
[Parameter(mandatory=$true)] $source, | |
[Parameter(mandatory=$false)] $outfile="" | |
) { |
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
/** | |
フローエディタで開発者コンソールを開き以下のコードを貼り付ける。 | |
するとコントロール部分がすべて削除されるので、ScreenPressoなどでページ全体のスクリーンショットを撮ればOK | |
*/ | |
document.querySelector("header").remove() | |
document.querySelector("react-action-heading").remove() | |
document.querySelector(".ba-Sidebar").remove() | |
document.querySelector(".fl-chatbot-button").remove() | |
document.querySelector(".manage-flow-section").style.display = "block"; |
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
/** | |
強引にスクレイピングしているので動かなくなるときもあるかも。 | |
ひとまず以下のコードをGoogle Podcastの登録済みポッドキャスト(https://podcasts.google.com/subscriptions)で開発者コンソールを開いて実行する。 | |
警告は表示されるものの、以下に外部へのデータ送信を行なうコードは一切含まれていないので問題はない。 | |
動かなくなったときのために簡単に解説。まず「ページ先頭のscrolling-carousel要素」を取得する。これが今聞いているポッドキャストの一覧(一番上に出ているやつ)である。 | |
その中のspan配下にそれぞれdivに囲まれたかたちで、各ポッドキャストのサムネイルがある。 | |
このためポッドキャストのサムネイルの中から、ポッドキャストのタイトルだけを抜き取ってテキスト化する。 | |
一つ一つconsole.logで出力すると、全部が別の出力になってしまって面倒くさいので、一旦配列に取り込んで最後にjoinするようにしている。 | |
*/ |
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
# 開発向け | |
winget install Microsoft.VisualStudioCode | |
winget install OpenJS.NodeJS | |
winget install Git.Git | |
winget install Microsoft.PowerShell | |
# 書籍向け(スクリーンショット撮影) | |
winget install BrianApps.Sizer | |
# 日本語設定 |
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
# 動画の再生速度を変更する。 ex). movspeed file.mp4 2 -> file.mp4を2倍速再生にしたoutfile.mp4というファイルが出力される | |
# ffmpegのインストールが必要 | |
# ref: http://tecsingularity.com/ffmpeg/speedchange/ | |
# | |
# $infile 処理対象となる動画ファイル | |
# $speed 速度変更させる値。2倍速にしたい場合2 | |
# $outfile 出力するファイル。省略時は入力ファイルと同じフォルダにoutfile.mp4という名前で出力される | |
function movspeed ( | |
[parameter(mandatory=$true)][String] $infile, | |
[parameter(mandatory=$true)][float] $speed, |
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
# $dstfile 静止画ファイル | |
# $dstfile2 音声ファイル(静止画ファイルと順序を入れ替えても問題ない) | |
# $output 出力するファイル。省略時はデスクトップ上にoutput.mp4というファイル名で出力される | |
function voice2movie ([parameter(mandatory=$true)][String] $dstfile, | |
[parameter(mandatory=$true)][String] $dstfile2, | |
[parameter(mandatory=$false)][String] $output="${env:UserProfile}\Desktop\output.mp4") { | |
ffmpeg -loop 1 -r 30000/1001 -i $dstfile -i $dstfile2 ` | |
-vcodec libx264 -acodec aac -strict experimental ` | |
-ab 320k -ac 2 -ar 48000 -pix_fmt yuv420p ` | |
-shortest $output |
NewerOlder