Skip to content

Instantly share code, notes, and snippets.

@Ovis
Ovis / softether-vpnserver.service
Last active January 8, 2020 05:13
TAPデバイス有効化
[Unit]
Description=SoftEther VPN Server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/vpnserver/vpnserver_start
ExecStop=/usr/local/vpnserver/vpnserver stop
KillMode=process
Restart=on-failure
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2019-02-05T13:11:41.883+09:00</Date>
<Description>Title=林原めぐみのTokyo Boogie Night,Service=radiko,StationId=CRK,StationName=ラジオ関西,Starttime=20190209230000,Endtime=20190209233000,StartMargin=15,TimeFree,GetTitle,CopyPath=C:\Users\Ovis\Radio,CopyFormat=.mp3</Description>
<URI>\DogaRadi\RadioRecorder\radiko_CRK_林原めぐみのTokyoBoogieNight_201902092300_201902092330</URI>
</RegistrationInfo>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-〇〇〇〇〇〇〇〇〇〇〇〇〇〇</UserId>
$XmlinPath = "D:\TaskScheduler\Task\DogaRadi\WakeUp\"
$TaskinPath = "\DogaRadi\WakeUp\"
$tasks = Get-ChildItem "$XmlinPath\*.xml" -name
foreach ($i in $tasks)
{
schtasks /create /XML $XmlinPath$i /TN "$TaskinPath$i".Replace(".xml","")
}
@Ovis
Ovis / DogaRadiTaskExport.ps1
Created June 30, 2019 12:26
どがらじの録音予約エクスポート
$taskBasePath = "\DogaRadi\*"
$taskSaveDir = "D:\TaskScheduler\Task"
Get-ScheduledTask -TaskPath $taskBasePath | foreach {
$taskDir = Join-Path $taskSaveDir $_.TaskPath
if( -not (Test-Path -Path $taskDir)) {
mkdir -Path $taskDir
}
$path = (Join-Path $taskDir "$($_.TaskName).xml")
Export-ScheduledTask -TaskName $_.TaskName -TaskPath $_.TaskPath | Out-File $path # -WhatIf
@Ovis
Ovis / .NET Core Publish
Last active January 28, 2019 10:29
.NET Core Publish
PS D:\Documents\GitHub\PostDietProgress\PostDietProgress> dotnet publish --configuration Release
.NET Core 向け Microsoft (R) Build Engine バージョン 15.9.20+g88f5fadfbe
Copyright (C) Microsoft Corporation.All rights reserved.
D:\Documents\GitHub\PostDietProgress\PostDietProgress\PostDietProgress.csproj のパッケージを復元しています...
MSBuild ファイル D:\Documents\GitHub\PostDietProgress\PostDietProgress\obj\PostDietProgress.csproj.nuget.g.props を生成しています。
MSBuild ファイル D:\Documents\GitHub\PostDietProgress\PostDietProgress\obj\PostDietProgress.csproj.nuget.g.targets を生成しています。
D:\Documents\GitHub\PostDietProgress\PostDietProgress\PostDietProgress.csproj の復元が 782.4 ms で完了しました。
PostDietProgress -> D:\Documents\GitHub\PostDietProgress\PostDietProgress\bin\Release\netcoreapp2.2\PostDietProgress.dll
PostDietProgress -> D:\Documents\GitHub\PostDietProgress\PostDietProgress\bin\Release\netcoreapp2.2\publish\
@Ovis
Ovis / GetLocalTime_LinuxOK.cs
Created January 28, 2019 09:23
日本標準時をLinuxでも取得
var jst = TZConvert.GetTimeZoneInfo("Tokyo Standard Time");
var localTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, jst);
@Ovis
Ovis / gist:acb014b4536fe60978b000906b0d0ee5
Created January 28, 2019 09:16
Linux上のタイムゾーン
gceuser@free-instance:~/PostDietProgress$ dir /usr/share/zoneinfo
Africa Asia CET Cuba Egypt Factory GMT+0 HST Iran Kwajalein MST7MDT Navajo Poland Singapore US WET localtime zone.tab
America Atlantic CST6CDT EET Eire GB GMT-0 Hongkong Israel Libya Mexico PRC Portugal SystemV UTC Zulu posix zone1970.tab
Antarctica Australia Canada EST Etc GB-Eire GMT0 Iceland Jamaica MET NZ PST8PDT ROC Turkey Universal iso3166.tab posixrules
Arctic Brazil Chile EST5EDT Europe GMT Greenwich Indian Japan MST NZ-CHAT Pacific ROK UCT W-SU leap-seconds.list right
@Ovis
Ovis / GetLocalTime.cs
Created January 28, 2019 09:14
日本標準時取得(Windows、C#)
var jst = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time");
var localTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, jst);
@Ovis
Ovis / gist:fe76308522e4649fd6cb50b0bc4dddbf
Created January 28, 2019 09:12
Linux上でTimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time")を用いた場合のエラーメッセージ
Unhandled Exception: System.AggregateException: One or more errors occurred. (The time zone ID 'Tokyo Standard Time' was not found on the local computer.) ---> System.TimeZoneNotFoundException: The time zone ID 'Tokyo Standard Time' was not found on the local computer. ---> System.IO.FileNotFoundException: Could not find file '/usr/share/zoneinfo/Tokyo Standard Time'.
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at Internal.IO.File.ReadAllBytes(String path)
at System.TimeZoneInfo.TryGetTimeZoneFromLocalMachine(String id, TimeZoneInfo& value, Exception& e)
--- End of inner exception stack trace ---
at System.TimeZoneInfo.FindSystemTimeZoneById(String id)
(後略)
gceuser@free-instance:~$ wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
gceuser@free-instance:~$ sudo dpkg -i packages-microsoft-prod.deb
Selecting previously unselected package packages-microsoft-prod.
(Reading database ... 60730 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb ...
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.2) ...
Setting up packages-microsoft-prod (1.0-ubuntu18.04.2) ...
gceuser@free-instance:~$ sudo add-apt-repository universe
'universe' distribution component is already enabled for all sources.
gceuser@free-instance:~$ sudo apt-get install apt-transport-https