Skip to content

Instantly share code, notes, and snippets.

@the-takeo
the-takeo / EventPractice.cs
Last active August 29, 2015 14:02
Event自前実装の練習
using System;
namespace EventPractice
{
class TestEventArgs : System.EventArgs
{
public int Num;
public TestEventArgs(int num)
{
@the-takeo
the-takeo / PrimeDecomposition.cs
Last active August 29, 2015 14:02
素因数分解(PrimeDecomposition)
using System;
using System.Collections.Generic;
namespace PrimeDecomposition
{
public static class PrimeDecomposition
{
public static List<int> DoPrimeDecomposition(int num)
{
List<int> primaryFactors = new List<int>();
@the-takeo
the-takeo / Start_Advanced_Command_Prompt.bat
Last active August 29, 2015 14:03
マクロや初期ディレクトリを定義した状態でコマンドプロンプトを起動するパッチファイル
REM ##=============================================================##
REM ## ここに起動時のディレクトリを記述
REM ##=============================================================##
cd %homepath%
REM ##=============================================================##
REM ## ここに起動時に処理したいコマンドを記述
REM ##=============================================================##
C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\WDExpress.exe
@the-takeo
the-takeo / Backup_Files.sh
Last active August 29, 2015 14:16
Backup_Files
#!/bin/bash
fromHDD="/Volumes/バックアップ元HDD名/"
backupHDD="/Volumes/バックアップ先HDD名/"
logFile="/ログ出力先ディレクトリ/SyncLog"`date +%Y%m%d`".log"
if [ ! -e $fromHDD]; then
echo "No FromHDD $FromHDD" >> $logFile
echo "HDD Sync Error" | mail -s "HDD Sync Error" Address@gmail.com
return
fi
@the-takeo
the-takeo / SyncFiles.plist
Last active August 29, 2015 14:20
SyncFiles.appを毎日00:30に実行するLauchスクリプト
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>SyncFiles</string>
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>/Users/UserName/DailyTasks/SyncFiles.app</string>
@the-takeo
the-takeo / ClassExtension.cs
Created February 8, 2016 07:06
ClassExtension
using System;
using System.Collections.Generic;
using System.Text;
namespace ClassExtension
{
public static class StringBuilderExtension
{
public static StringBuilder AppendFormatLoop(this StringBuilder instance,
string format, IEnumerable<Object> objects)
@the-takeo
the-takeo / Hyper-V_Server_Setting.bat
Last active June 17, 2016 12:10
Hyper-V_Server_Setting.bat
rem ### 変数設定
set ServerName="ServerName"
set RemoteUserName="Administrator"
set IP="192.168.0.100"
set SubnetMask="255.255.255.0"
set GateWay="192.168.0.1"
rem ### Hyper-V Serverインストール後に行うべき作業
rem ### 参考:http://ascii.jp/elem/000/000/850/850959/
rem ### 管理者として実行することが必要
@the-takeo
the-takeo / FormMover.cs
Last active June 24, 2016 04:52
FormMover
static class FormMover
{
static double Max = 8;
static double MaxExp = Math.Exp(Max);
static public void WipeUp(Form Frm, int MovingTime, int WaitTimeForMoving, bool Fade)
{
System.Threading.Thread.Sleep(WaitTimeForMoving);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>SyncMyDNS</string>
<key>ProgramArguments</key>
<array>
<string>curl</string>
<string>-l</string>
@the-takeo
the-takeo / IISRESET.bat
Created February 15, 2017 00:49
IISRESET.bat
IISRESET