Skip to content

Instantly share code, notes, and snippets.

View fkztw's full-sized avatar
📺
Hello World!

Frank Zheng fkztw

📺
Hello World!
  • Taiwan
  • 06:32 (UTC +08:00)
View GitHub Profile
@fkztw
fkztw / 20121227-jserv-talk in NCTU
Created December 27, 2012 15:11
20121227-jserv-talk in NCTU
C 語言的末日 (UNIX 的末日?)
2038年
1970年開始 到 2038年的時候 time_t 會 overflow
Myth
NULL == 0 ?
null pointer
type is (void*)
投影片 http://j.mp/mosky-pwp (後來上課後講者有稍做修改 所以可能不太一樣)
pipy - commit your python project
project - a blog system
Dynamic typing, Static typing, Functor, Closure 我還不熟的東西
Python 2 or 3 ?
今日投影片 j.mp/mosky-python
最新版投影片 j.mp/mosky-py
print
print 'Print', 'multiple' # Print 和 multiple 中間會有空白
# 在 python2 裏面拿不掉
# 可以用 sys 裏面的 write 代替 就沒有空白
print #印一個新行
@fkztw
fkztw / asm_hw03.asm
Last active November 17, 2018 08:42
TITLE MASM Template (main.asm)
INCLUDE Irvine32.inc
.data
screenColumns DWORD 80
screenLeftBoundry BYTE 0
screenRightBoundry BYTE 79
QuitFlag BYTE 0
CaptionString BYTE "Student Name: ",0
#include <iostream>
using namespace std;
int main (void)
{
int n;
while (cin >> n)
{
if (n == 0) break;
else if (n == 1) cout << "1" << endl;
#include <iostream>
#include <cstdlib>
using namespace std;
int main(void)
{
while (true)
{
int n, x, y, z, d;
int x1 = 0, y1 = 0, z1 = 0;
#include <iostream>;
#include <cstdlib>;
using namespace std;
int f(int n)
{
int sum = 0;
while (n)
{
sum += n%10;
#include <cstdio>
#include <cstring>
int main (void)
{
char s[11];
while ( scanf("%s", s) != EOF && s[0] != '0' )
{
while ( strlen(s) != 1 )
2013.06.05 21:24
$ history | awk '{CMD[$2]++;count++;} END { for (a in CMD )print CMD[ a ]" " CMD[ a ]/count*100 "% " a}' | grep -v "./" | column -c 3 -s " " -t | sort -nr | nl | head -n 10
1 611 12.22% ls
2 585 11.7% sudo
3 519 10.38% cd
4 453 9.06% vim
5 214 4.28% ping
6 133 2.66% telnet
7 115 2.3% ip
8 100 2% rm
@fkztw
fkztw / gpa_calc.py
Last active December 29, 2015 12:39
NCTU GPA calculator written in python2 Input Example: 成績1,學分數1 成績2,學分數2 成績3,學分數3 ...
# -*-coding: utf-8-*-
def find_gpa(grade):
if 100 >= grade >= 90:
return [grade, 'A+', 4.3]
elif 89 >= grade >= 85:
return [grade, 'A', 4.0]
elif 84 >= grade >= 80:
return [grade, 'A-', 3.7]
elif 79 >= grade >= 77: