Using List Comprehension and Dictionary Comprehension
>>> rs = [{'ABC': '123', 'DEF': '456'}]
>>> ret = [{k.lower():v for k,v in i.items()} for i in rs]
>>> ret
>>> [{'abc': '123', 'def': '456'}]
Using Lambda Function
>>> rs = list(map((lambda i: { k.lower(): v for k,v in i.items()}), rs))
Sunday, December 1, 2019
Friday, November 22, 2019
How to set TimeZone in Linux Docker Container
#How to set TimeZone in Linux Docker Container
```
apk add tzdata
```
ex:
Dockerfile
```
from python:3.7-alpine
RUN apk add tzdata
ENV TZ=Asia/Bangkok
CMD xxxx
```
#TimeZone in slim and Ubuntu Linux Docker Container
ex:
Dockerfile
```
from python
ENV TZ=Asia/Bangkok
CMD xxxx
```
ex:
Run Container (slim or full linux images)
```
docker run --name container-name -e 'TZ=Asia/Bangkok' python
```
```
apk add tzdata
```
ex:
Dockerfile
```
from python:3.7-alpine
RUN apk add tzdata
ENV TZ=Asia/Bangkok
CMD xxxx
```
#TimeZone in slim and Ubuntu Linux Docker Container
ex:
Dockerfile
```
from python
ENV TZ=Asia/Bangkok
CMD xxxx
```
ex:
Run Container (slim or full linux images)
```
docker run --name container-name -e 'TZ=Asia/Bangkok' python
```
Wednesday, November 20, 2019
SET TimeZone on Ubuntu19 with Command Line
:Find Current TimeZone
$ timedatectl list-timezones | grep -i [zone]
ex:
$ timedatectl list-timezones | grep -i europe
:Remove link
$ sudo unlink /etc/localtime
:Set new TimeZone
sudo ln -s /usr/share/zoneinfo/[Zone/TimeZone] /etc/localtime
ex:
sudo ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
$ timedatectl list-timezones | grep -i [zone]
ex:
$ timedatectl list-timezones | grep -i europe
:Remove link
$ sudo unlink /etc/localtime
:Set new TimeZone
sudo ln -s /usr/share/zoneinfo/[Zone/TimeZone] /etc/localtime
ex:
sudo ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
Monday, November 18, 2019
"tail -f" in Windows PowerShell
"tail -f" in Windows PowerShell
Get-Content .\file_name -wait | Where {$_ -match "search_name"}
Get-Content .\file_name -wait -tail 30 | Where {$_ -match "search_name"}
Get-Content .\file_name -wait | Where {$_ -match "search_name-1" -and $_ -match "search_name-2}
Get-Content .\file_name -wait | Where {$_ -match "search_name"}
Get-Content .\file_name -wait -tail 30 | Where {$_ -match "search_name"}
Get-Content .\file_name -wait | Where {$_ -match "search_name-1" -and $_ -match "search_name-2}
Friday, November 8, 2019
GGATE Error 'OCI Error ORA-01407: cannot update ("HRIS"."SYS_CLIENTIDENTIFIER"."SYS_USER_ID") to NULL (status = 1407)'
Transaction can't update table column to NULL
ex:
table name: "HRIS"."SYS_CLIENTIDENTIFIER"
column name: "SYS_USER_ID"
check constraint in "DBA_CONS_COLUMNS" or "ALL_CONS_COLUMNS"
SELECT
CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME
FROM
DBA_CONS_COLUMNS
WHERE
OWNER LIKE 'HRIS'
AND
TABLE_NAME LIKE 'SYS_CLIENTIDENTIFIER'
CONSTRAINT_NAME TABLE_NAME COLUMN_NAME
------------------------------ ------------------------------ --------------------
FK_SYS_CLIENTIDENTIFIER_USER SYS_CLIENTIDENTIFIER SYS_USER_ID <--------------
PK_SYS_CLIENTIDENTIFIER SYS_CLIENTIDENTIFIER ID
SYS_C0024107 SYS_CLIENTIDENTIFIER TERMINALIP
SYS_C0024106 SYS_CLIENTIDENTIFIER CREATEBY
SYS_C0024105 SYS_CLIENTIDENTIFIER CREATEDATETIME
SYS_C0024104 SYS_CLIENTIDENTIFIER GUID
SYS_C0024103 SYS_CLIENTIDENTIFIER ID
SYS_C00241XXX SYS_CLIENTIDENTIFIER SYS_USER_ID <--------------
DROP CONFLICT CONSTRAINT
ALTER TABLE "HRIS"."SYS_CLIENTIDENTIFIER" DROP CONSTRAINT SYS_C00241XXX;
and restart GGATE replicat
ex:
table name: "HRIS"."SYS_CLIENTIDENTIFIER"
column name: "SYS_USER_ID"
check constraint in "DBA_CONS_COLUMNS" or "ALL_CONS_COLUMNS"
SELECT
CONSTRAINT_NAME, TABLE_NAME, COLUMN_NAME
FROM
DBA_CONS_COLUMNS
WHERE
OWNER LIKE 'HRIS'
AND
TABLE_NAME LIKE 'SYS_CLIENTIDENTIFIER'
CONSTRAINT_NAME TABLE_NAME COLUMN_NAME
------------------------------ ------------------------------ --------------------
FK_SYS_CLIENTIDENTIFIER_USER SYS_CLIENTIDENTIFIER SYS_USER_ID <--------------
PK_SYS_CLIENTIDENTIFIER SYS_CLIENTIDENTIFIER ID
SYS_C0024107 SYS_CLIENTIDENTIFIER TERMINALIP
SYS_C0024106 SYS_CLIENTIDENTIFIER CREATEBY
SYS_C0024105 SYS_CLIENTIDENTIFIER CREATEDATETIME
SYS_C0024104 SYS_CLIENTIDENTIFIER GUID
SYS_C0024103 SYS_CLIENTIDENTIFIER ID
SYS_C00241XXX SYS_CLIENTIDENTIFIER SYS_USER_ID <--------------
DROP CONFLICT CONSTRAINT
ALTER TABLE "HRIS"."SYS_CLIENTIDENTIFIER" DROP CONSTRAINT SYS_C00241XXX;
and restart GGATE replicat
Thursday, October 31, 2019
Backup Docker container
Convert Container to Docker images:
docker commit container_name name/tag
Save docker images to files:
docker save name/tag > backupfile.tar
Import docker images from Files
docker load -i backupfile.tar
docker commit container_name name/tag
Save docker images to files:
docker save name/tag > backupfile.tar
Import docker images from Files
docker load -i backupfile.tar
Wednesday, October 30, 2019
Fix iSCSI DataStore is Connected But inaccessible
Remount a iSCSI datastore in ESXI host after network failure or
iSCSI DataStore is Connected But inaccessible
:Scan volume
esxcfg-volume -l
[root@esxi-11:/vmfs/volumes] esxcfg-volume -l
Scanning for VMFS-6 host activity (4096 bytes/HB, 1024 HBs).
VMFS UUID/label: 5b9279dd-659af4f5-9f6c-1866daf4b576/QNAP-01:GRAYLOG
Can mount: Yes
Can resignature: Yes
Extent name: naa.6e843b61b1c7f97dd817d4d65d8bddd7:1 range: 0 - 8388351 (MB)
Extent name: naa.6e843b6ab3d267ad2373d43a8d9645da:1 range: 8388352 - 16776703 (MB)
Scanning for VMFS-6 host activity (4096 bytes/HB, 1024 HBs).
VMFS UUID/label: 5b91fa1a-8d4ad5f5-8747-1866daf3466e/QNAP-01:DS-01
Can mount: Yes
Can resignature: Yes
Extent name: naa.6e843b69306f933db3d1d4045da669da:1 range: 0 - 4194047 (MB)
:Mount Volume
esxcfg-volume -m QNAP-01:DS-01
esxcfg-volume -m QNAP-01:GRAYLOG
iSCSI DataStore is Connected But inaccessible
:Scan volume
esxcfg-volume -l
[root@esxi-11:/vmfs/volumes] esxcfg-volume -l
Scanning for VMFS-6 host activity (4096 bytes/HB, 1024 HBs).
VMFS UUID/label: 5b9279dd-659af4f5-9f6c-1866daf4b576/QNAP-01:GRAYLOG
Can mount: Yes
Can resignature: Yes
Extent name: naa.6e843b61b1c7f97dd817d4d65d8bddd7:1 range: 0 - 8388351 (MB)
Extent name: naa.6e843b6ab3d267ad2373d43a8d9645da:1 range: 8388352 - 16776703 (MB)
Scanning for VMFS-6 host activity (4096 bytes/HB, 1024 HBs).
VMFS UUID/label: 5b91fa1a-8d4ad5f5-8747-1866daf3466e/QNAP-01:DS-01
Can mount: Yes
Can resignature: Yes
Extent name: naa.6e843b69306f933db3d1d4045da669da:1 range: 0 - 4194047 (MB)
:Mount Volume
esxcfg-volume -m QNAP-01:DS-01
esxcfg-volume -m QNAP-01:GRAYLOG
Subscribe to:
Posts (Atom)
ALCATEL 6900
write memory copy running certified reload from working no rollback-timeout
-
SET LLDP System NAME: system name ALL-Uplink system location SIAM-FL11 SHOW LLDP Configure: show lldp config or show lldp local-syste...
-
grant execute on utl_http to wc grant execute on dbms_lock to wc; BEGIN DBMS_NETWORK_ACL_ADMIN.create_acl ( acl => ...
-
:system view system-view or sys :show all config dis current-configuration :create vlan vlan vlan_number :show ip interface ...