Skip to content

Instantly share code, notes, and snippets.

View doggy8088's full-sized avatar
🙂
Giving is a reward in itself

Will 保哥 doggy8088

🙂
Giving is a reward in itself
View GitHub Profile
public enum Order
{
Ascending,
Descending
}
@doggy8088
doggy8088 / Program.cs
Created October 20, 2015 14:14
使用動態型別取得特定實體的內容
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
@doggy8088
doggy8088 / Serialize_Deserialize_Test.cs
Created June 13, 2013 11:40
當試圖序列化系統內建的型別之後,若試圖反序列化為 object 型別一定會引發錯誤,請問在 Main() 方法不修改的情況下,如何讓這段程式正常運作?
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
@doggy8088
doggy8088 / web.config
Created January 17, 2017 15:39
將 Angular 2 含有路由機制的 SPA 網頁應用程式部署到 IIS 網站伺服器
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="SPA" stopProcessing="true">
<match url=".*" />
<action type="Rewrite" url="/" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
@doggy8088
doggy8088 / .gitconfig
Last active September 1, 2017 17:44
常用的 Git Alias 定義
[alias]
st = status
sts = status -s
co = checkout
ci = commit
br = branch -a
re = remote
di = diff
dump = cat-file -p
type = cat-file -t
@ECHO OFF
SET DIFFTOOL="C:\Program Files (x86)\WinMerge\WinMergeU.exe -s -e -x -ul -ur -wl -dl %%bname -dr %%yname %%base %%mine"
SET MERGETOOL="C:\Program Files (x86)\WinMerge\WinMergeU.exe %%theirs %%mine %%merged"
REG ADD HKEY_CURRENT_USER\Software\TortoiseGit /v Diff /t REG_SZ /d %DIFFTOOL% /f
REG ADD HKEY_CURRENT_USER\Software\TortoiseGit /v DiffViewer /t REG_SZ /d %DIFFTOOL% /f
REG ADD HKEY_CURRENT_USER\Software\TortoiseGit /v Merge /t REG_SZ /d %MERGETOOL% /f
@doggy8088
doggy8088 / Pipe in Inline Code within Table in the Markdown.md
Last active August 2, 2018 05:30
在 Markdown 文件中顯示一段包含 Pipe 字元程式碼的解決方案

Table 1: There is a pipe ( | ) character inside Table Cell. It can't display properly.

Alias Command What to Type
git cleanup `git branch --merged grep -v '*'

Table 2: There is a pipe ( | ) character that escape with a HTML Entity ( &#124; ). Within ` sign, all HTML Entities will output ASIS which is not what I want.

| Alias | Command | What to Type |

將 kubectl 改成 k 並同時擁有 bash completion 的設定方法

自動修改

kubectl completion bash | sudo tee /etc/bash_completion.d/k > /dev/null
sudo sed -e 's/local commands=("kubectl")/local commands=("k")/g' /etc/bash_completion.d/k -i
sudo sed -e 's/__start_kubectl kubectl/__start_kubectl k/g' /etc/bash_completion.d/k -i
echo 'alias k=kubectl' | tee -a ~/.profile > /dev/null
. ~/.profile
@doggy8088
doggy8088 / ResponseBuffering.cs
Created January 22, 2019 15:33 — forked from Dkowald/ResponseBuffering.cs
ResponseBuffering for Asp.Net core
using System;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
// ReSharper disable once CheckNamespace
namespace kwd.gist
{
/// <summary>
FROM ubuntu as buildenv
WORKDIR /
RUN sed -e 's/http:\/\/archive.ubuntu.com\/ubuntu\//http:\/\/ftp.cse.yzu.edu.tw\/ubuntu\//g' -i /etc/apt/sources.list
RUN apt-get update && apt-get install build-essential git -y
RUN git clone https://github.com/bartobri/no-more-secrets.git
WORKDIR /no-more-secrets
RUN make nms