Skip to content

Instantly share code, notes, and snippets.

@hsinjungwu
hsinjungwu / gmail2line.js
Last active September 27, 2021 05:17
gmail to line
function run() {
var msg = queryMail();
if (msg.length > 0) {
lineMessage(msg)
}
}
var token = 'xxx'; //your token
@hsinjungwu
hsinjungwu / sol1to9.go
Last active September 17, 2021 10:06
sol 1 2 3 4 5 6 7 8 9 = 100
package main
import (
"fmt"
)
func main() {
sol()
}
@hsinjungwu
hsinjungwu / Unprotect.vba
Created August 16, 2019 02:29
Unprotect Excel by VBA
Sub Unprotect()
ActiveSheet.Protect DrawingObjects:=True, CONTENTS:=True, AllowFiltering:=True
ActiveSheet.Protect DrawingObjects:=False, CONTENTS:=True, AllowFiltering:=True
ActiveSheet.Unprotect
End Sub
@echo off
for /d %%i in (*) do @cd %cd%\%%i && @echo Pull %%i && @git pull
pause
@hsinjungwu
hsinjungwu / BatchBuild.bat
Created August 6, 2018 04:15
Batch Build C# Solutions
@title 自動建置專案
REM MsBuildPath:MSBuild的位置
SET MsBuildPath=c:\progra~2\MSBuild\14.0\Bin\
REM Sln:sln檔案的位置
SET Sln[0]=D:\a.sln
SET Sln[1]=D:\b.sln
SET Sln[2]=D:\folder1\1.sln
REM Sln 長度
SET LEN=3
@hsinjungwu
hsinjungwu / MigrationMatrixRate.cs
Created June 26, 2017 13:04
An example for migration matrix rate
using System;
using System.IO;
using System.Linq;
namespace MigrationMatrixRate
{
internal class Program
{
private enum CalcWays { PdMarginalNew, PdMarginalNewAcc, PDAcc }
@hsinjungwu
hsinjungwu / CalculatorByCodeDom.cs
Created July 14, 2016 09:22
計算機小程式
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using Microsoft.CSharp;
namespace Calculator
{
internal class Program
{
private static void Main(string[] args)
@hsinjungwu
hsinjungwu / IntToChineseNumerals_2.cs
Created June 7, 2016 08:33
新版數字轉國字
using System;
/*
INPUT : 11000904
OUTPUT : 壹仟壹佰萬零玖佰零肆圓整
*/
private static string MoneyConvert(int moneySource)
{
string[] chtInt = new string[] { "零", "壹", "貳", "參", "肆", "伍", "陸", "柒", "捌", "玖" };
string[] unit1 = new string[] { string.Empty, "拾", "佰", "仟" };
string[] unit2 = new string[] { "圓整", "萬", "億", "兆" };
@hsinjungwu
hsinjungwu / Interview_algorithm.cs
Created January 22, 2016 07:12
鴻揚科技有限公司於 104 應徵軟體開發工程師之面試題目
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
internal class Program
@hsinjungwu
hsinjungwu / fn_GetSubstringByBytes.sql
Created November 13, 2015 09:40
取得指定位元組長度字串
IF EXISTS (SELECT 1 FROM sysobjects WHERE id = OBJECT_ID('[fn_GetSubstringByBytes]') AND xtype IN ('FN','IF','TF'))
DROP FUNCTION [fn_GetSubstringByBytes];
GO
CREATE FUNCTION [fn_GetSubstringByBytes](@old_str NVARCHAR(MAX), @query_length INT)
RETURNS NVARCHAR(MAX)
BEGIN
DECLARE @result NVARCHAR(MAX) = ''
DECLARE @cur_length INT = 0;