This commit is contained in:
louiscklaw
2025-01-31 21:05:22 +08:00
parent e08987a3b3
commit 7e9b533da2
61 changed files with 3781 additions and 0 deletions

1
siutinchu/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
**/*.png

View File

@@ -0,0 +1,3 @@
copy .\src\lv1\lv1.py delivery
copy .\src\lv2\lv2.py delivery
copy .\src\lv3\lv3.py delivery

View File

@@ -0,0 +1,3 @@
# \siutinchu
HKD150

View File

@@ -0,0 +1,13 @@
A LRU cache is a special kind of cache that defines the way of evicting item from the cache when it is full. Its policy is to evict the least recently used item.
For example,
- a cache having capacity of 4 and is currently storing
`[[1, '101'], [2, '102'], [3, '103'], [4, '104']]`,
- where the 1st (leftmost) item [1, '101'] is the least recently used and
- the last (rightmost) item [4, '104'] is the most recently used.
- When the item [2, '102'] is accessed,
- the cache becomes [[1, '101'], [3, '103'], [4, '104'], [2, '102']] as the item [2, '102'] becomes the most recently used.
- When another item [10, '110'] is pushed into the cache,
- the cache cannot hold all of the items and
- must evict the least recently used item which is [1, '101'] and
- the cache becomes [[3, '103'], [4, '104'], [2, '102'], [10, '110']].

View File

@@ -0,0 +1,3 @@
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110

View File

@@ -0,0 +1,3 @@
3
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110

View File

@@ -0,0 +1,3 @@
6
9,10
101,102,103,104,105,106,107,108,109,110

View File

@@ -0,0 +1,3 @@
6
9,10
109,110

View File

@@ -0,0 +1,72 @@
cache = []
IDX_KEY=0
IDX_VALUE=1
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
### Assumptions:s
# - 1 ≤ C ≤ 1000 or C = 1
# - 1 ≤ Nk,Nv ≤ 1000
# - Input keys can be converted to integers
# - Input keys are unique, no duplicates
# - Input values are non-null string
def negative(num):
return 0 - num
# 1st input, Input keys can be converted to integers
LRU_CACHE_LEN = int(input())
# 2nd input, keys
KEYS = input()
# 3rd input, values
VALUES = input()
def convert_to_int(input_list):
output = []
for i in range(0,len(input_list)):
output.append(int(input_list[i]))
return output
def create_cache_element(list_keys, list_values):
output = []
for i in range(0,len(list_keys)):
output.append([list_keys[i], list_values[i]])
return output
# REQUIREMENTS: Keys must be stored as integers.
# ASSUMPTIONS: Input keys are unique, no duplicates
# ASSUMPTIONS: Input keys can be converted to integers
list_keys = convert_to_int(KEYS.split(','))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
# ASSUMPTIONS: Input values are non-null string
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# HANDLE: If the numbers of keys and values are different,
# prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# HANDLE: If the cache capacity is infinity
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
cache = create_cache_element(list_keys, list_values)
# HANDLE: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
cache = create_cache_element(list_keys, list_values)
# HANDLE:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
temp = create_cache_element(list_keys, list_values)
slice_start = negative(LRU_CACHE_LEN)
cache = temp[slice_start:]
else:
pass
print(cache)

View File

@@ -0,0 +1,63 @@
import os,sys
from pprint import pprint
cache = []
IDX_KEY=0
IDX_VALUE=1
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
### Assumptions:
# - 1 ≤ C ≤ 1000 or C = 1
# - 1 ≤ Nk,Nv ≤ 1000
# - Input keys can be converted to integers
# - Input keys are unique, no duplicates
# - Input values are non-null string
def negative(num):
return 0 - num
# 1st input, Input keys can be converted to integers
LRU_CACHE_LEN = int(input())
# 2nd input, keys
KEYS = input()
# 3rd input, values
VALUES = input()
# REQUIREMENTS: Keys must be stored as integers.
# ASSUMPTIONS: Input keys are unique, no duplicates
# ASSUMPTIONS: Input keys can be converted to integers
list_keys = list(map(lambda x: int(x), KEYS.split(',')))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
# ASSUMPTIONS: Input values are non-null string
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# HANDLE: If the numbers of keys and values are different,
# prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# HANDLE: If the cache capacity is infinity
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
cache = list(map(lambda x: [x[IDX_KEY],x[IDX_VALUE]], zip(list_keys, list_values)))
# HANDLE: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
cache = list(map(lambda x: [x[IDX_KEY],x[IDX_VALUE]], zip(list_keys, list_values)))
# HANDLE:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
temp = list(map(lambda x: [x[IDX_KEY],x[IDX_VALUE]], zip(list_keys, list_values)))
slice_start = negative(LRU_CACHE_LEN)
cache = temp[slice_start:]
else:
pass
print(cache)

View File

@@ -0,0 +1,93 @@
# ENGG1330-Computer-Programming-I
## Level 1 (25%)
Your program will receive
the capacity of the cache,
a list of keys and
a list of values as the inputs.
You are then required to combine the keys and values to initialize a cache as a list of key-value pairs as follows and each key-value pair is stored as a sub-list of length 2.
![𝐾1, 𝑉1], [𝐾2, 𝑉2], … [𝐾𝑛, 𝑉𝑛],, 𝑤𝑒𝑟𝑒 𝑛 𝑖𝑠 𝑡𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑑𝑎𝑡𝑎 𝑖𝑡𝑒𝑚𝑠
## Requirements:
1. Keys must be stored as integers.
1. Values must be stored as strings.
1. If the numbers of keys and values are different, prints "Warning: number of keys and values are not the same" and outputs an empty cache.
1. If the cache capacity is larger than or equal to the number of data items, stores all the data items in the cache. The order of data items stored in the cache must be the same as the order of the input key-value pairs.
1. If the cache capacity is smaller than the number of data items, keeps only those that are near the end of the inputs (right) up to the capacity. For example, if capacity is 3, keys = [1,2,3,4,5] and values = [-1,-2,-3,-4,-5], cache = [[3, '-3'], [4, '-4'], [5, '-5']].
### Inputs:
1. Capacity of the cache <20> (integer). <20> = -1 means that the cache has unlimited capacity.
1. A string of integral keys K1, K2, …, KNk separated by "," where <20>! is number of keys.
1. A string of values V1, V2, …, VNv separated by "," where <20>" is number of values.
### Outputs:
1. Warning message if `Nk != Nv`.
1. Cache as a list with format ![𝐾1, 𝑉1], [𝐾2, 𝑉2], … [𝐾𝑛, 𝑉𝑛],.
### Assumptions:
- 1 ≤ <20> ≤ 1000 <20><> <20> = 1
- 1 ≤ <20>!, <20>" ≤ 1000
- Input keys can be converted to integers
- Input keys are unique, no duplicates
- Input values are non-null string
### Hints:
- You can use "A_STRING".split(",") to split a string separated by a comma "," into a
list of strings, e.g., "1,2,3".split(",") à ["1", "2", "3"]
https://docs.python.org/3/library/stdtypes.html#str.split
### Examples:
Case Sample input Sample output
- case 1
- input
```
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
```
- output
```
[[1,'101'],[2,'102'],[3,'103'],[4,'104'],[5,'105'],[6,'106'],[7,'107'],[8,'108'],[9,'109'],[10,'110']]
```
- case 2
- input
```
3
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
```
- output
```
[[8, '108'], [9, '109'], [10, '110']]
```
- case 3
- input
```
6
9,10
101,102,103,104,105,106,107,108,109,110
```
- output
```
Warning: number of keys and values are not the same
[]
```
- case 4
- input
```
6
9,10
109,110
```
- output
```
[[9, '109'], [10, '110']]
```

View File

@@ -0,0 +1,15 @@
python lv1_lambda.py < input1.txt
python lv1.py < input1.txt
@REM echo "[[1, '101'], [2, '102'], [3, '103'], [4, '104'], [5, '105'], [6, '106'], [7, '107'], [8, '108'], [9, '109'], [10, '110']]"
python lv1_lambda.py < input2.txt
python lv1.py < input2.txt
@REM [[8, '108'], [9, '109'], [10, '110']]
python lv1_lambda.py < input3.txt
python lv1.py < input3.txt
@REM echo "[]"
python lv1_lambda.py < input4.txt
python lv1.py < input4.txt
@REM echo "[[9, '109'], [10, '110']]"

View File

@@ -0,0 +1 @@
nodemon --ext "py, bat" --exec run.bat

View File

@@ -0,0 +1,9 @@
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,3
get,6
get,1
get,100
get,5
end

View File

@@ -0,0 +1,9 @@
3
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,1
get,2
get,3
get,10
get,9
end

View File

@@ -0,0 +1,17 @@
6
9,10
101,102,103,104,105,106,107,108,109,110
get,9
put,1,100
put,2,200
put,3,300
get,10
get,2
put,4,400
put,5,500
put,6,600
put,1,10000
put,7,700
get,3
get,2
end

View File

@@ -0,0 +1,8 @@
1
9,10
109,110
get,1
put,1,6
put,3,5
get,1
end

View File

@@ -0,0 +1,13 @@
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,3
get,6
get,1
get,100
get,5
put,100,1000
put,200,2000
put,300,3000
get,2
end

View File

@@ -0,0 +1,128 @@
# Assumptions:
# - 1 ≤ C ≤ 1000 or C = 1
# - 1 ≤ Nk, Nv ≤ 1000
# - Input keys can be converted to integers
# - Input keys are unique, no duplicates
# - Input values are non-null string
# - None of the values will be equal to “NULL”
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
NULL = None
cache = []
IDX_KEY=0
IDX_VALUE=1
def GETCommand(cache, key):
# ASSUMPTIONS: Input keys are unique, no duplicates
# For every get operation,
# print the value of the key-value pair if the key exists,
# otherwise print “NULL”
key_found = False
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
print(cache[i][IDX_VALUE])
cache.append(cache.pop(i))
key_found=True
break
if not(key_found):
print("NULL")
pass
def PUTCommand(key, value):
# ASSUMPTION: Input keys can be converted to integers
if LRU_CACHE_LEN != CACHE_LEN_UNLIMITED:
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([int(key), value])
return cache
def EndCommand():
print(cache)
def ConvertToInt(input_list):
output = []
for i in range(0,len(input_list)):
output.append(int(input_list[i]))
return output
# 1st input, Input keys can be converted to integers
LRU_CACHE_LEN = int(input())
# 2nd input, keys
KEYS = input()
# 3rd input, values
VALUES = input()
# REQUIREMENTS: Keys must be stored as integers.
# ASSUMPTIONS: Input keys are unique, no duplicates
# ASSUMPTIONS: Input keys can be converted to integers
list_keys = ConvertToInt(KEYS.split(','))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
# ASSUMPTIONS: Input values are non-null string
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# setup cache
# REQUIREMENTS: If the numbers of keys and values are different, prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
cache.append([key, value])
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value])
# REQUIREMENTS:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value])
else:
pass
loop_exit = False
while not(loop_exit):
command = input()
command_splitted = command.split(',')
command_with_para = len(command_splitted) > 1
if (command_splitted[0] == 'get'):
cache_pos = command_splitted[1]
GETCommand(cache, cache_pos)
elif (command_splitted[0] == 'put'):
[put_key, put_value] = command_splitted[1:3]
cache = PUTCommand(put_key, put_value)
elif command == 'end':
EndCommand()
loop_exit = True
else:
pass

View File

@@ -0,0 +1,114 @@
import os,sys
from pprint import pprint
# Assumptions:
# - 1 ≤ C ≤ 1000 or C = 1
# - 1 ≤ Nk, Nv ≤ 1000
# - Input keys can be converted to integers
# - Input keys are unique, no duplicates
# - Input values are non-null string
# - None of the values will be equal to “NULL”
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
NULL = None
cache = []
IDX_KEY=0
IDX_VALUE=1
def GETCommand(cache, key):
# ASSUMPTIONS: Input keys are unique, no duplicates
# For every get operation,
# print the value of the key-value pair if the key exists,
# otherwise print “NULL”
key_found = False
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
print(cache[i][IDX_VALUE])
cache.append(cache.pop(i))
key_found=True
break
if not(key_found):
print("NULL")
pass
def PUTCommand(key, value):
# ASSUMPTION: Input keys can be converted to integers
if LRU_CACHE_LEN != CACHE_LEN_UNLIMITED:
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([int(key), value])
return cache
def EndCommand():
print(cache)
sys.exit()
# 1st input, Input keys can be converted to integers
LRU_CACHE_LEN = int(input())
# 2nd input, keys
KEYS = input()
# 3rd input, values
VALUES = input()
# REQUIREMENTS: Keys must be stored as integers.
# ASSUMPTIONS: Input keys are unique, no duplicates
# ASSUMPTIONS: Input keys can be converted to integers
list_keys = list(map(lambda x: int(x), KEYS.split(',')))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
# ASSUMPTIONS: Input values are non-null string
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# setup cache
# REQUIREMENTS: If the numbers of keys and values are different, prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
for key, value in zip(list_keys, list_values):
cache.append([key, value])
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
for key, value in zip(list_keys, list_values):
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value])
# REQUIREMENTS:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
for key, value in zip(list_keys, list_values):
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value])
else:
pass
while True:
command = input()
command_splitted = command.split(',')
command_with_para = len(command_splitted) > 1
if (command_splitted[0] == 'get'):
cache_pos = command_splitted[1]
GETCommand(cache, cache_pos)
elif (command_splitted[0] == 'put'):
[put_key, put_value] = command_splitted[1:3]
cache = PUTCommand(put_key, put_value)
elif command == 'end':
EndCommand()
else:
pass

View File

@@ -0,0 +1,125 @@
# ENGG1330-Computer-Programming-I
## Level 2 (45%)
Next, you are going to implement two main functions, get(key) and put(key, value) to access a data item in the cache. The get(key) function retrieves the value of the data item given by the key parameter if the key exists in the cache. The put(key, value) function modifies the value of the data item, if the key exists, or inserts a new data item, if the key does not exist.
The ordering of data items in the cache must conform to the description in the Introduction, i.e., the 1st (leftmost) item is the least recently used while the last (rightmost) item is the most recently used. Every time a data item is accessed, whether using get or put,
the data item has to be moved to the end (rightmost) of the cache to become the most recently used item. When a new data item is inserted to a full cache, the least recently used (leftmost) item needs to be evicted.
For example, given a cache of capacity 5:
`[[1,'100'], [2,'200'], [3,'300'], [4,'400']]`
, the cache contents will be updated as follows.
1. get(3) -> [[1,'100'], [2,'200'], [4,'400'], [3,'300']]
1. put(2,6) -> [[1,'100'], [4,'400'], [3,'300'], [2,'6']]
1. put(10,-1) -> [[1,'100'], [4,'400'], [3,'300'], [2,'6'], [10,'-1']]
1. put(100,-5) -> [[4,'400'], [3,'300'], [2,'6'], [10,'-1'], [100,'-5']]
In addition to the inputs you received from Level 1, you will also receive a list of commands. "get,KEY" denotes the get operation with key KEY and "put,KEY,VALUE" denotes the put operation with key KEY and value VALUE. Get operation prints the value of the keyvalue pair if the key exists, otherwise prints "NULL". Put operation does not need to print anything. The command "end" denotes the end of the inputs and you should then print the final contents of the cache.
### Inputs:
1. Capacity of the cache `C` (integer). `C` = -1 means that the cache has unlimited capacity.
1. A string of integral keys K1, K2, …, KNk separated by "," where Nk is number of keys.
1. A string of values V1, V2, …, VNv separated by "," where Nv is number of values.
1. A series of commands consisting of either "get,KEY" or "put,KEY,VALUE" separated by a newline character.
1. The input must be ended with "end".
### Outputs:
1. Warning message if <20>! ¹ <20>".
2. For every get operation, print the value of the key-value pair if the key exists,
otherwise print "NULL".
3. Cache as a list with format ![<5B>1, <20>1],[<5B>2, <20>2], … [<5B><>, <20><>], with the 1st (leftmost)
item being the least recently used while the last (rightmost) item being the most
recently used.
### Assumptions:
- 1 ≤ <20> ≤ 1000 <20><> <20> = 1
- 1 ≤ <20>!, <20>" ≤ 1000
- Input keys can be converted to integers
- Input keys are unique, no duplicates
- Input values are non-null string
- None of the values will be equal to "NULL"
### Examples:
- Case
- Sample input
- Sample output
- Case 1
- Sample input
```
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,3
get,6
get,1
get,100
get,5
end
```
- Sample output
```
103
106
101
NULL
105
[[2, '102'], [4, '104'], [7, '107'], [8,'108'], [9, '109'], [10, '110'], [3,'103'], [6, '106'], [1, '101'], [5,'105']]
```
- Case 2
- Sample input
```
3
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,1
get,2
get,3
get,10
get,9
end
```
- Sample output
```
NULL
NULL
NULL
110
109
[[8, '108'], [10, '110'], [9, '109']]
```
- Case 3
- Sample input
```
6
9,10
101,102,103,104,105,106,107,108,109,110
get,9
put,1,100
put,2,200
put,3,300
get,10
get,2
put,4,400
put,5,500
put,6,600
put,1,10000
put,7,700
get,3
get,2
end
```
- Sample output
```
Warning: number of keys and values are not the same
NULL <- get,9
NULL <- get,10
200 <- get,2
NULL <- get,3
200 <- get,2
[[4, '400'], [5, '500'], [6, '600'], [1, '10000'], [7, '700'], [2, '200']]
```

View File

@@ -0,0 +1,44 @@
python lv2.py < input1.txt
python lv2_lambda.py < input1.txt
@REM 103
@REM 106
@REM 101
@REM NULL
@REM 105
@REM [[2, '102'], [4, '104'], [7, '107'], [8, '108'], [9, '109'], [10, '110'], [3, '103'], [6, '106'], [1, '101'], [5, '105']]
python lv2.py < input2.txt
python lv2_lambda.py < input2.txt
@REM NULL
@REM NULL
@REM NULL
@REM 110
@REM 109
@REM [[8, '108'], [10, '110'], [9, '109']]
python lv2.py < input3.txt
python lv2_lambda.py < input3.txt
@REM Warning: number of keys and values are not the same
@REM NULL
@REM NULL
@REM 200
@REM NULL
@REM 200
@REM [[4, '400'], [5, '500'], [6, '600'], [1, '10000'], [7, '700'], [2, '200']]
python lv2.py < input4.txt
python lv2_lambda.py < input4.txt
@REM NULL
@REM NULL
@REM [[3, '5']]
python lv2.py < input5.txt
python lv2_lambda.py < input5.txt
@REM 103
@REM 106
@REM 101
@REM NULL
@REM 105
@REM 102
@REM [[4, '104'], [7, '107'], [8, '108'], [9, '109'], [10, '110'], [3, '103'], [6, '106'], [1, '101'], [5, '105'], [100, '1000'], [200, '2000'], [300, '3000'], [2, '102']]

View File

@@ -0,0 +1 @@
nodemon --ext "py, bat" --exec run.bat

View File

@@ -0,0 +1,9 @@
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,3
get,6
get,1
get,100
get,5
end

View File

@@ -0,0 +1,9 @@
3
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,1
get,2
get,3
get,10
get,9
end

View File

@@ -0,0 +1,17 @@
6
9,10
101,102,103,104,105,106,107,108,109,110
get,9
put,1,100
put,2,200
put,3,300
get,10
get,2
put,4,400
put,5,500
put,6,600
put,1,10000
put,7,700
get,3
get,2
end

View File

@@ -0,0 +1,18 @@
6
1,2,3,4,5
101,102,103,104,105
get,9
get,5
get,3
put,1,10000
put,6,600
put,7,700
get,10
get,7
get,6
get,5
get,4
get,3
get,2
get,1
end

View File

@@ -0,0 +1,8 @@
1
9,10
109,110
get,1
put,1,6
put,3,5
get,1
end

View File

@@ -0,0 +1,13 @@
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,3
get,6
get,1
get,100
get,5
put,100,1000
put,200,2000
put,300,3000
get,2
end

View File

@@ -0,0 +1,193 @@
# Assumptions:
# • 1 ≤ C ≤ 10000 or C = 1
# • 1 ≤ Nk, Nv ≤ 10000
# • Input keys can be converted to integers
# • Input keys are unique, no duplicates
# • Input values are non-null string
# • None of the values will be equal to “NULL”
# • Time constraint will be imposed on VPL and timeout is possible
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
NULL = None
MAX_OPER=1
cache = []
IDX_KEY=0
IDX_VALUE=1
IDX_OPER=2
def GetOperFromList(list_cache):
output = []
for i in range(0,len(list_cache)):
output.append(list_cache[i][IDX_OPER])
return output
def PrintKeyAndValueOnly(cache):
output = []
for i in range(0,len(cache)):
output.append([cache[i][IDX_KEY], cache[i][IDX_VALUE]])
return output
def GETCommand(cache, key):
global MAX_OPER
# pos in cache = textual pos - 1
# can key found ?
# FROM ASSUMPTIONS: Input keys are unique, no duplicates
key_found = False
for i in range(0,len(cache)):
if (cache[i][0] == int(key)):
MAX_OPER+=1
cache[i][IDX_OPER] = MAX_OPER
print(cache[i][IDX_VALUE])
key_found=True
break
if not(key_found):
print("NULL")
pass
def PUTCommand(key, value):
global MAX_OPER
# FROM ASSUMPTION: Input keys can be converted to integers
if LRU_CACHE_LEN == CACHE_LEN_UNLIMITED:
# try find key in cache, if found replace it
# if not append into cache
found = False
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
cache[i][IDX_VALUE] = value
cache[i][IDX_OPER] = MAX_OPER
MAX_OPER+=1
found = True
break
if not(found):
cache.append([int(key), value, MAX_OPER])
else:
# check if cache length already reach the max one
if (len(cache) < LRU_CACHE_LEN):
# try find key in cache, if found replace it
# if not append at the end of list
found = False
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
cache[i][IDX_VALUE] = value
cache[i][IDX_OPER] = MAX_OPER
MAX_OPER+=1
found = True
break
if not(found):
cache.append([int(key), value, MAX_OPER])
else:
# try find key in cache, if found replace it
# if not replace the lowest oper one
found = False
min_oper = min(GetOperFromList(cache))
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
cache[i][IDX_VALUE] = value
cache[i][IDX_OPER] = MAX_OPER
MAX_OPER+=1
found = True
break
if not(found):
for i in range(0,len(cache)):
if (cache[i][IDX_OPER] == min_oper):
MAX_OPER+=1
cache[i] = [int(key), value, MAX_OPER]
MAX_OPER+=1
return cache
def EndCommand():
# reformat for print
cache_temp = PrintKeyAndValueOnly(cache)
print(cache_temp)
def ConvertToInt(input_list):
output = []
for i in range(0,len(input_list)):
output.append(int(input_list[i]))
return output
# first one = cache_len
LRU_CACHE_LEN = int(input())
KEYS = input()
VALUES = input()
# REQUIREMENTS: Keys must be stored as integers.
list_keys = ConvertToInt(KEYS.split(','))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# setup cache
# REQUIREMENTS: If the numbers of keys and values are different, prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
cache.append([key, value, MAX_OPER])
MAX_OPER+=1
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value, MAX_OPER])
MAX_OPER+=1
# REQUIREMENTS:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value, MAX_OPER])
MAX_OPER+=1
else:
pass
loop_exit = False
while not(loop_exit):
command = input()
command_splitted = command.split(',')
command_with_para = len(command_splitted) > 1
if (command_splitted[0] == 'get'):
cache_pos = command_splitted[1]
GETCommand(cache, cache_pos)
elif (command_splitted[0] == 'put'):
[put_key, put_value] = command_splitted[1:3]
cache = PUTCommand(put_key, put_value)
elif command == 'end':
EndCommand()
loop_exit = True
else:
pass

View File

@@ -0,0 +1,174 @@
import os,sys
from pprint import pprint
# Assumptions:
# • 1 ≤ C ≤ 10000 or C = 1
# • 1 ≤ Nk, Nv ≤ 10000
# • Input keys can be converted to integers
# • Input keys are unique, no duplicates
# • Input values are non-null string
# • None of the values will be equal to “NULL”
# • Time constraint will be imposed on VPL and timeout is possible
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
NULL = None
MAX_OPER=1
cache = []
IDX_KEY=0
IDX_VALUE=1
IDX_OPER=2
def GETCommand(cache, key):
global MAX_OPER
# pos in cache = textual pos - 1
# can key found ?
# FROM ASSUMPTIONS: Input keys are unique, no duplicates
key_found = False
for i in range(0,len(cache)):
if (cache[i][0] == int(key)):
MAX_OPER+=1
cache[i][IDX_OPER] = MAX_OPER
print(cache[i][IDX_VALUE])
key_found=True
break
if not(key_found):
print("NULL")
pass
def PUTCommand(key, value):
global MAX_OPER
# FROM ASSUMPTION: Input keys can be converted to integers
if LRU_CACHE_LEN == CACHE_LEN_UNLIMITED:
# try find key in cache, if found replace it
# if not append into cache
found = False
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
cache[i][IDX_VALUE] = value
cache[i][IDX_OPER] = MAX_OPER
MAX_OPER+=1
found = True
break
if not(found):
cache.append([int(key), value, MAX_OPER])
else:
# check if cache length already reach the max one
if (len(cache) < LRU_CACHE_LEN):
# try find key in cache, if found replace it
# if not append at the end of list
found = False
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
cache[i][IDX_VALUE] = value
cache[i][IDX_OPER] = MAX_OPER
MAX_OPER+=1
found = True
break
if not(found):
cache.append([int(key), value, MAX_OPER])
else:
# try find key in cache, if found replace it
# if not replace the lowest oper one
found = False
min_oper = min(map(lambda x: x[IDX_OPER], cache))
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
cache[i][IDX_VALUE] = value
cache[i][IDX_OPER] = MAX_OPER
MAX_OPER+=1
found = True
break
if not(found):
for i in range(0,len(cache)):
if (cache[i][IDX_OPER] == min_oper):
MAX_OPER+=1
cache[i] = [int(key), value, MAX_OPER]
MAX_OPER+=1
return cache
def EndCommand():
# reformat for print
cache_temp = list(map(lambda x: [x[IDX_KEY],x[IDX_VALUE]], cache))
print(cache_temp)
sys.exit()
# first one = cache_len
LRU_CACHE_LEN = int(input())
KEYS = input()
VALUES = input()
# REQUIREMENTS: Keys must be stored as integers.
list_keys = list(map(lambda x: int(x), KEYS.split(',')))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# setup cache
# REQUIREMENTS: If the numbers of keys and values are different, prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
for key, value in zip(list_keys, list_values):
cache.append([key, value, MAX_OPER])
MAX_OPER+=1
# cache = list(map(lambda x: [x[0],x[1]], zip(list_keys, list_values)))
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
for key, value in zip(list_keys, list_values):
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value, MAX_OPER])
MAX_OPER+=1
# cache = list(map(lambda x: [x[0],x[1]], zip(list_keys, list_values)))
# REQUIREMENTS:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
for key, value in zip(list_keys, list_values):
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value, MAX_OPER])
MAX_OPER+=1
else:
pass
while True:
command = input()
command_splitted = command.split(',')
command_with_para = len(command_splitted) > 1
if (command_splitted[0] == 'get'):
cache_pos = command_splitted[1]
GETCommand(cache, cache_pos)
elif (command_splitted[0] == 'put'):
[put_key, put_value] = command_splitted[1:3]
cache = PUTCommand(put_key, put_value)
elif command == 'end':
EndCommand()
else:
pass

View File

@@ -0,0 +1,129 @@
# ENGG1330-Computer-Programming-I
## Level 3
After passing all the tests in Level 2, the interviewers proceed to ask a follow-up question to truly test your ability in programming and problem solving. They tell you that it is computationally expensive to move the most recently used item to the end of the list in order to conform to the description in the Introduction, i.e., the 1st (leftmost) item is the least recently used while the last (rightmost) item is the most recently used. It is because all the subsequent items need to be moved to the left by 1. For example, the steps of moving 2 in [1,2,3,4] to the end of the list is [1,2,3,4] à [1,3,3,4] à [1,3,4,4] à [1,3,4,2]. As a result, moving item to the end of a list should be avoided if possible. The follow-up question is whether you can implement a solution without the need of moving items in the cache once they are inserted. Specifically, when accessing an item, NO movement should be made to any item but you are allowed to modify the item. When adding a new item to the list, it should be added to the end of the list if the cache is not full. Otherwise, the least recently used item is REPLACED by the new item and NO movement of other items are allowed. For example, given a cache of capacity 4: `[[1,100], [2,200], [3,300]]`, the cache
contents will be updated as follows.
1. get(2) -> `[[1,100], [2,200], [3,300]]`
1. put(4,400) -> `[[1,100], [2,200], [3,300], [4,400]]`
1. get(1) -> `[[1,100], [2,200], [3,300], [4,400]]`
1. put(5,500) -> `[[1,100], [2,200], [5,500], [4,400]]`
As a result, there is NO limitation on how you are going to store the data. However, ONLY one list can be created and used for the cache and no other auxiliary list is allowed.
### Note:
The test cases on VPL will be time limited. If you see timeout on VPL, it means your program is too slow and need further optimization. Nested loops are usually the most expensive operations and it is a good starting point for optimization.
### Inputs:
1. Capacity of the cache <20> (integer). <20> = -1 means that the cache has unlimited capacity.
2. A string of integral keys K1, K2, …, KNk separated by “,” where <20>! is number of keys.
3. A string of values V1, V2, …, VNv separated by “,” where <20>" is number of values.
4. A series of commands consisting of either “get,KEY” or “put,KEY,VALUE” separated by
a newline character.
5. The input must be ended with “end”.
### Outputs:
1. Warning message if <20>! ¹ <20>".
2. For every get operation, print the value of the key-value pair if the key exists,
otherwise print “NULL”.
3. Cache as a list with format ![<5B>1, <20>1],[<5B>2, <20>2], … [<5B><>, <20><>], where the ordering is no
longer based on recent usage but follows the specs listed in the question.
### Assumptions:
- 1 ≤ <20> ≤ 10000 <20><> <20> = 1
- 1 ≤ <20>!, <20>" ≤ 10000
- Input keys can be converted to integers
- Input keys are unique, no duplicates
- Input values are non-null string
- None of the values will be equal to “NULL”
- Time constraint will be imposed on VPL and timeout is possible
### Hints:
- You may want to change the structure of how you keep the data. For example, you can store extra information alongside with each data item if you find it useful.
- It is acceptable if put and/or other operations take more time to run as long as the total time is within the time constraint. Your program should be well within the time constraint unless it has multiple layers of loop
### Examples:
- Case
- Sample input
- Sample output
- Case 1
- Sample input
```
-1
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,3
get,6
get,1
get,100
get,5
end
```
- Sample output
```
103
106
101
NULL
105
[[1, '101'], [2, '102'], [3, '103'], [4, '104'], [5, '105'], [6, '106'], [7, '107'], [8, '108'], [9, '109'], [10, '110']]
```
- Case 2
- Sample input
```
3
1,2,3,4,5,6,7,8,9,10
101,102,103,104,105,106,107,108,109,110
get,1
get,2
get,3
get,10
get,9
end
```
- Sample output
```
NULL
NULL
NULL
110
109
[[8, '108'], [9, '109'], [10, '110']]
```
- Case 3
- Sample input
```
6
9,10
101,102,103,104,105,106,107,108,109,110
get,9
put,1,100
put,2,200
put,3,300
get,10
get,2
put,4,400
put,5,500
put,6,600
put,1,10000
put,7,700
get,3
get,2
end
```
- Sample output
```
Warning: number of keys and values are not the same
NULL
NULL
200
NULL
200
[[1, '10000'], [2, '200'], [7, '700'], [4, '400'], [5, '500'], [6, '600']]
```

View File

@@ -0,0 +1,17 @@
python lv3.py < input1.txt
python lv3_lambda.py < input1.txt
python lv3.py < input2.txt
python lv3_lambda.py < input2.txt
python lv3.py < input3.txt
python lv3_lambda.py < input3.txt
python lv3.py < input4.txt
python lv3_lambda.py < input4.txt
python lv3.py < input5.txt
python lv3_lambda.py < input5.txt
python lv3.py < input6.txt
python lv3_lambda.py < input6.txt

View File

@@ -0,0 +1 @@
nodemon --ext "py, bat" --exec run.bat

View File

@@ -0,0 +1,12 @@
{
"name": "src",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}

View File

@@ -0,0 +1,72 @@
cache = []
IDX_KEY=0
IDX_VALUE=1
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
### Assumptions:s
# - 1 ≤ C ≤ 1000 or C = 1
# - 1 ≤ Nk,Nv ≤ 1000
# - Input keys can be converted to integers
# - Input keys are unique, no duplicates
# - Input values are non-null string
def negative(num):
return 0 - num
# 1st input, Input keys can be converted to integers
LRU_CACHE_LEN = int(input())
# 2nd input, keys
KEYS = input()
# 3rd input, values
VALUES = input()
def convert_to_int(input_list):
output = []
for i in range(0,len(input_list)):
output.append(int(input_list[i]))
return output
def create_cache_element(list_keys, list_values):
output = []
for i in range(0,len(list_keys)):
output.append([list_keys[i], list_values[i]])
return output
# REQUIREMENTS: Keys must be stored as integers.
# ASSUMPTIONS: Input keys are unique, no duplicates
# ASSUMPTIONS: Input keys can be converted to integers
list_keys = convert_to_int(KEYS.split(','))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
# ASSUMPTIONS: Input values are non-null string
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# HANDLE: If the numbers of keys and values are different,
# prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# HANDLE: If the cache capacity is infinity
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
cache = create_cache_element(list_keys, list_values)
# HANDLE: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
cache = create_cache_element(list_keys, list_values)
# HANDLE:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
temp = create_cache_element(list_keys, list_values)
slice_start = negative(LRU_CACHE_LEN)
cache = temp[slice_start:]
else:
pass
print(cache)

View File

@@ -0,0 +1,128 @@
# Assumptions:
# - 1 ≤ C ≤ 1000 or C = 1
# - 1 ≤ Nk, Nv ≤ 1000
# - Input keys can be converted to integers
# - Input keys are unique, no duplicates
# - Input values are non-null string
# - None of the values will be equal to “NULL”
CACHE_LEN_UNLIMITED=-1
KEY_VALUE_DIFFERENT_ERROR='Warning: number of keys and values are not the same'
NULL = None
cache = []
IDX_KEY=0
IDX_VALUE=1
def GETCommand(cache, key):
# ASSUMPTIONS: Input keys are unique, no duplicates
# For every get operation,
# print the value of the key-value pair if the key exists,
# otherwise print “NULL”
key_found = False
for i in range(0,len(cache)):
if (cache[i][IDX_KEY] == int(key)):
print(cache[i][IDX_VALUE])
cache.append(cache.pop(i))
key_found=True
break
if not(key_found):
print("NULL")
pass
def PUTCommand(key, value):
# ASSUMPTION: Input keys can be converted to integers
if LRU_CACHE_LEN != CACHE_LEN_UNLIMITED:
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([int(key), value])
return cache
def EndCommand():
print(cache)
def ConvertToInt(input_list):
output = []
for i in range(0,len(input_list)):
output.append(int(input_list[i]))
return output
# 1st input, Input keys can be converted to integers
LRU_CACHE_LEN = int(input())
# 2nd input, keys
KEYS = input()
# 3rd input, values
VALUES = input()
# REQUIREMENTS: Keys must be stored as integers.
# ASSUMPTIONS: Input keys are unique, no duplicates
# ASSUMPTIONS: Input keys can be converted to integers
list_keys = ConvertToInt(KEYS.split(','))
len_list_keys = len(list_keys)
# REQUIREMENTS: Values must be stored as strings.
# ASSUMPTIONS: Input values are non-null string
list_values = list(VALUES.split(','))
len_list_values = len(list_values)
# setup cache
# REQUIREMENTS: If the numbers of keys and values are different, prints "Warning: number of keys and values are not the same" and outputs an empty cache.
if (len_list_keys != len_list_values):
print(KEY_VALUE_DIFFERENT_ERROR)
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN == CACHE_LEN_UNLIMITED):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
cache.append([key, value])
# REQUIREMENTS: If the cache capacity is larger than or equal to the number of data items
elif (LRU_CACHE_LEN >= len_list_keys):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value])
# REQUIREMENTS:
# If the cache capacity is smaller than the number of data items,
# keeps only those that are near the end of the inputs (right) up to the capacity
elif (LRU_CACHE_LEN < len_list_keys):
for i in range(0, len(list_keys)):
key = list_keys[i]
value = list_values[i]
if (len(cache) >= LRU_CACHE_LEN):
cache.pop(0)
cache.append([key,value])
else:
pass
loop_exit = False
while not(loop_exit):
command = input()
command_splitted = command.split(',')
command_with_para = len(command_splitted) > 1
if (command_splitted[0] == 'get'):
cache_pos = command_splitted[1]
GETCommand(cache, cache_pos)
elif (command_splitted[0] == 'put'):
[put_key, put_value] = command_splitted[1:3]
cache = PUTCommand(put_key, put_value)
elif command == 'end':
EndCommand()
loop_exit = True
else:
pass

View File

@@ -0,0 +1,9 @@
# CREDIT: https://github.com/shren207/nextjs-docker-compose
# Dockerfile
FROM node:18-buster
RUN mkdir -p /app/node_modules
RUN chown 1000:1000 -R /app
WORKDIR /app
USER 1000:1000

View File

@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -ex
npm i
npm run start

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "http-server --cors ./public"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"http-server": "^14.1.1",
"serve": "^14.2.0"
}
}

View File

@@ -0,0 +1 @@
helloworld siutinchu

View File

@@ -0,0 +1,32 @@
# CREDIT: https://github.com/shren207/nextjs-docker-compose
# CREATED: 03-15-2023
services:
siutinchu_share:
container_name: siutinchu_share
build: .
restart: always
volumes:
- $PWD/app:/app
- siutinchu_node_modules:/app/node_modules
working_dir: /app
# command: sleep infinity
command: bash entry.sh
labels:
- "traefik.enable=true"
- "traefik.http.routers.siutinchu-http.rule=Host(`siutinchu.louislabs.com`)"
- "traefik.http.routers.siutinchu-http.entrypoints=web"
- "traefik.http.routers.siutinchu-http.middlewares=siutinchu-https"
- "traefik.http.middlewares.siutinchu-https.redirectscheme.scheme=https"
- "traefik.http.routers.siutinchu.rule=Host(`siutinchu.louislabs.com`)"
- "traefik.http.routers.siutinchu.entrypoints=websecure"
- "traefik.http.routers.siutinchu.tls.certresolver=myresolver"
- "traefik.http.services.siutinchu.loadbalancer.server.port=8080"
networks:
default:
external:
name: traefik-proxy-network
volumes:
siutinchu_node_modules:

View File

@@ -0,0 +1,13 @@
{
"name": "docker-helloworld",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"into_docker": "docker compose exec -it test bash"
},
"keywords": [],
"author": "",
"license": "ISC"
}

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
git pull
docker compose pull
docker compose build
docker compose kill
docker compose down
docker compose up -d

7
siutinchu/gitUpdate.bat Normal file
View File

@@ -0,0 +1,7 @@
git status .
@pause
git add .
git commit -m"update siutinchu,"
start git push

5
siutinchu/meta.md Normal file
View File

@@ -0,0 +1,5 @@
---
tags: "python","ENGG1330"
---
# README.md

22
siutinchu/package.json Normal file
View File

@@ -0,0 +1,22 @@
{
"name": "daniel_jo_assignment_student",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"doc": "docs"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"gitUpdate": "git add . && git commit -m\"update siutinchu,\" && git push"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"bootstrap": "^5.2.3",
"react-bootstrap": "^2.6.0"
}
}