Hwchiu Learning Note

kubernetes, sdn, linux,devops


  • Home

  • About

  • Tags

  • Archives

  • Sitemap

Costco 紅龍去骨雞腿排

Posted on 2013-04-06 | Edited on 2018-08-01 | Comments:

今日素材:

  • 白飯 X2
  • 紅龍去骨雞腿排 X3
  • 高麗菜

##<開源節流篇>##

  1. COSTCO紅龍雞腿排
    一包16入275元
    275/16=17.2元/塊
    兩人每餐一起吃三塊 = 17.2*3 = 51.6

  2. 飯
    算一碗4元好了,兩人吃三碗 = 4*3 = 12

  3. 高麗菜
    太便宜了忽略不計XD

Total = 51.6+12 = 63.6元 = 32元/人

##<幸福瘦篇>##
總重1.5kg=1500g
1500g/16塊=93.75g/塊

100g 175大卡 => 93.75g 164大卡(實際上應該會再低一點,因為會把油脂去掉hee)
一杯米可以煮出2碗白飯,白飯一碗約200g,熱量約280大卡

Total
= 三塊雞腿排 + 飯三碗
= 1643 + 2803 = 1332大卡 = 666大卡/人

Related Posts
  • 焗烤馬鈴薯泥
  • 滑蛋洋蔥豬肉丼飯
  • 清蒸鱈魚+乾拌麵
  • 地瓜+薯條健康早餐
  • 蒜香火腿蛋炒飯

Linux-Kernel-PacketCapture

Posted on 2013-04-01 | Edited on 2018-08-01 | Comments:

最近突然對抓封包挺有興趣的,正好以前修網際網路規約時,有trace過linux中TCP/IP相關的code

所以這次就來嘗試看看自己分析封包。

第一個方式就是重編kernel,直接在kernel中寫CODE,但是這樣的缺點就是重編kernel太消耗時間了,
每次修改都要等個十多分鐘,實在不是很有效益,所以這個方案直接放棄

而我採用的方法是利用kernel module的方式,自己先在kernel中加入自定義function,接收來自上層的封包,然後再透過修改kernel module的方式來分析取得的封包,這樣的話,我只有一開始需要重編kernel,後續都直接修改kernel module,編譯速度飛快,效率就高得許多。

使用的資訊版本如下
linux:2.6.32
function name: myPacket

Read more »
Related Posts
  • TCP使用sendto
  • Linux下 pipe介紹
  • [Switchdev] How Kernel Implement SwitchDev(i)
  • [Switchdev] How Kernel Implement SwitchDev(ii)
  • mTCP 讀後筆記

TCP使用sendto

Posted on 2013-03-31 | Edited on 2018-08-01 | Comments:

OS:Linux

以前在寫Socket Programming的時候,對於TCP跟UDP在使用上會有一些區別
TCP要先建立連線,接者透過該連線把資料送出去,而UDP因為沒有連線,每次送出資料時都要指定對方的位置
寫TCP的時候,我習慣使用write跟send兩個function 來傳送資料
寫UDP的時候,我習慣使用sendto來傳送資料

1
2
3
4
5
6
ssize_t
send(int s, const void *msg, size_t len, int flags);

ssize_t
sendto(int s, const void *msg, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen);
Read more »
Related Posts
  • Linux-Kernel-PacketCapture
  • 手把手打造仿 mininet 網路
  • [Switchdev] How Kernel Implement SwitchDev(i)
  • [Switchdev] How Kernel Implement SwitchDev(ii)
  • mTCP 讀後筆記

XML in C-Sharp(C#)

Posted on 2013-03-30 | Edited on 2018-09-23 | Comments:
這篇文章用來介紹在 C# 中如果想要針對 xml 的種格式的資料進行處理的話,可以使用那些函式庫來幫忙處理。同時也針對不同種的使用方法給予相對應的範例程式碼,讓大家可以更快速且方便地用 C# 來操作 xml 的格式資料。
Read more »
Related Posts
  • Json in C-Sharp(C#)

Linux下 pipe介紹

Posted on 2013-03-29 | Edited on 2018-08-01 | Comments:

#[User]

不論是bash,tcsh,又或者是windows的cmd,都有一種叫做PIPE的功能

能夠將兩個獨立的程式給串接起來,把前面程式的輸出當作下一個程式的輸入

擁有這個指令,就能將本來當一功能的程式給組合起來變成複雜的工具了

Read more »
Related Posts
  • Linux-Kernel-PacketCapture
  • TCP使用sendto
  • SA - Shell Script(2)
  • Config Qos on Ovs with Floodlight
  • [Switchdev] Introduuction To Switchdev

Matlab 簡單練習

Posted on 2013-03-29 | Edited on 2018-08-01 | Comments:

應朋友的要求,用matlab幫忙寫了一個簡單的腳本

需要能夠ˋ彈出對話框選擇一個資料夾,讀取資料夾底下的影像檔,然後與某個特定的影像檔做相減,並命名輸出

這部分用到了一些指令,在這邊紀錄下來

1
2
3
4
5
6
7
8
9
10
11
12
13
14
%choose directory
target_path = uigetdir();
file_path = [target_path '/C00*.tif'];
background = [target_path '/REF.tif'];
file_struct = dir(file_path);
back_struct = dir(background);

%load background image
back = imread([target_path '/' back_struct.name]);
for i=1:length(file_struct)
temp_image = imread([target_path '/' file_struct(i).name]);
result_image = imsubtract(temp_image,back);
imwrite(result_image,[target_path '/new' file_struct(i).name]);
end

====END=======

Read more »

windows_vpn

Posted on 2013-03-29 | Edited on 2018-08-01 | Comments:

最近因為某個教授的要求,希望windows開機就可以自動vpn連線,所以這部份花了一些時間去研究,雖然我認為每次開機自己動手點兩下好像也沒有多困難阿~冏

Read more »
Related Posts
  • 檢查port使用情況
  • Sublime Text 3 + cscope (windows)
  • Install DRBD v9.0 on Ubuntu 16.04
  • Config Qos on Ovs with Floodlight
  • [Switchdev] Introduuction To Switchdev

淺談auto_ptr

Posted on 2013-03-29 | Edited on 2018-08-01 | Comments:

在寫C++的時候,常常會使用new來獲取heap的空間,來取得heap的空間,如下。

1
2
3
4
5
6
7
8
9
void Test1(){
char* name = new char(100);
//process something
delete name;
}
char* GetHeap(char* name){
char* name = new char(100);
return name;
}

然而對程式設計師來說,最麻煩的過於一旦new出空間後,一定要執行delete把空間回收,以免發生memory leak的行為

Read more »
Related Posts
  • explicit修飾
  • Linux-Kernel-PacketCapture
  • C-new
  • Linux下 pipe介紹
  • TCP使用sendto

explicit修飾

Posted on 2013-03-29 | Edited on 2018-08-01 | Comments:

C++中,有所謂的顯性轉換跟隱性轉換

在宣告時,加入explicit 這個關鍵字,可以禁止使用顯性轉換,以下為例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
using namespace std;
class Stack {
public:
Stack(int a){};
};
void Test(Stack b){
}
int main()
{
Stack s1 = 1; //ok
Stack s2 = Stack(12); //ok
Stack s3(s1); //ok
Test(123); //ok
return 0;
}

Read more »
Related Posts
  • 淺談auto_ptr
  • Linux-Kernel-PacketCapture
  • C-new
  • Linux下 pipe介紹
  • TCP使用sendto

檢查port使用情況

Posted on 2013-03-29 | Edited on 2018-08-01 | Comments:

有時候根據應用需求,會需要針對去檢查目前系統上有哪些port正在被使用

#[FreeBSD]

可以使用 sockstat 這個command 來檢查系統上port的使用。

USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS

root cron 93468 4 udp4 :638 :*

在預設的情況下,會輸出

使用者名稱,執行的程序,該程序的pid,在該程序中使用該port的file descriptor是多少 使用何種協定,以及address

如果使用 sockstat -4lP tcp 就可以找出 使用tcp & ipv4 ,並且正在listen的port

這對於要尋找是否有人在寫Socket programming來說是很方便的。

詳細的可以man sockstat


Read more »
Related Posts
  • [Switchdev] How Kernel Implement SwitchDev(i)
  • [Switchdev] How Kernel Implement SwitchDev(ii)
  • mpd5 on FreeBSD 10.0
  • [Switchdev] Introduuction To Switchdev
  • TCP使用sendto
1…1819
Hwchiu

Hwchiu

kubernetes/SDN/DevOps
190 posts
103 tags
RSS
Github Linkedin E-Mail Twitter FB Page Instagram
Recent Posts
  • Kubernetes Container Security 探討
  • Service Catalog
  • Kubernetes - Operator Pattern 介紹
  • Kubernetes - Device Plugin - SRIOV
  • Kubernetes - Device Plugin - RDMA
Friends
  • KKDAI 大大
  • 凱仁大大
  • 小飛機
  • CNTUG
  • SDNDS-TW
© 2019 Hwchiu
Powered by Hexo v3.7.1
|
Theme – NexT.Pisces v7.0.1