2017年11月6日 星期一

CVS安裝


apt-get install cvs

apt-get install xinetd

mkdir /cvs

cvs -d /cvs init

cd /etc/xinetd.d/

vim cvspserver

service cvspserver
 {
 port = 2401
 socket_type = stream
 protocol = tcp
 user = root
 wait = no
 type = UNLISTED
 server = /usr/bin/cvs
 server_args = -f --allow-root /cvs pserver
 disable = no
 }


/etc/init.d/xinetd restart

 netstat -tap | grep cvs

cd /cvs/CVSROOT

vim passwd

vim writer

groupadd cvs

useradd -g cvs -s /sbin/nologin cvsroot

chown -R cvsroot:cvs /cvs

chmod -R 775 /cvs

--

passwd.pl
#!/usr/bin/perl
rand (time());
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
my $plaintext = shift;
my $crypttext = crypt ($plaintext, $salt);
print "${crypttext} \n";

----
client 端抓中文檔名會炸掉

https://timyau18.blogspot.tw/2015/05/tortoisecvs.html

要把 CVSNT 換回 2.5.0.3 以前版本

https://github.com/todace/G-CVSNT/blob/master/cvsnt/tortoiseCVS/TortoiseCVS/src/CvsNt/cvsnt-2.5.03.2382.msi



2017年10月30日 星期一

oracle LOGICAL_STANDBY_DB

與 physical standby db 的差異

http://www.dba-oracle.com/t_difference_logical_physical_standby_database.htm

In  Oracle Data Guard you, Oracle transfers data from the main database to a standby database, and in case of failures, Oracle will switch over to the standby database.  We have two ways to create a standby database, logical standby and physical standby:
Physical standby differs from logical standby:
  • Physical standby schema matches exactly the source database.
  • Archived redo logs and FTP'ed directly to the standby database which is always running in "recover" mode.  Upon arrival, the archived redo logs are applied directly to the standby database.
Logical standby is different from physical standby:
  • Logical standby database does not have to match the schema structure of the source database.
     
  • Logical standby uses LogMiner techniques to transform the archived redo logs into native DML statements (insert, update, delete).  This DML is transported and applied to the standby database.
     
  • Logical standby tables can be open for SQL queries (read only), and all other standby tables can be open for updates.
     
  • Logical standby database can have additional materialized views and indexes added for faster performance.
Installing Physical standbys offers these benefits:
  • An identical physical copy of the primary database
  • Disaster recovery and high availability
  • High Data protection
  • Reduction in primary database workload
  • Performance Faster
Installing Logical standbys offer:
  • Simultaneous use for reporting, summations and queries
  • Efficient use of standby hardware resources
  • Reduction in primary database workload
  • Some limitations on the use of certain datatypes

For more complete differences between logical and physical standby databases, see the book "Oracle Data Guard", by Bipul Kumar.


Create Logical Standby DB


需要用 PK 或 unique index 識別唯一值

在 DBA_LOGSTDBY_NOT_UNIQUE 可以查到無法識別出的表


2017年10月24日 星期二

Ubuntu 16.04 LTS Template 要調整的東西

1. 打開  ipv4 DHCP

sudo nano /etc/network/interfaces

auto enp0s25
iface enp0s25 inet dhcp


要改成固定IP的話

auto enp0s25
iface enp0s25 inet static
address 192.168.0.16
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.4.4 8.8.8.8


2. disable ivp6 

/etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

allow root login

  1. sudo nano /etc/ssh/sshd_config
    1. change
      PermitRootLogin prohibit-password
    to
    PermitRootLogin yes 
    
    or sudo sed -i 's/prohibit-password/yes/' /etc/ssh/sshd_config
    1. in order to PAM authentication add
      AllowUsers root
    or sudo echo "AllowUsers root" >> /etc/ssh/sshd_config
    1. sudo service ssh restart
works fine
in order you don't know your root password set new with privileged user
sudo passwd root





“Shockwave Flash has crashed” workaround for vSphere Web (Flash) Client

https://www.virtuallyghetto.com/2017/10/shockwave-flash-has-crashed-workaround-for-vsphere-web-flash-client.html


原因可能是:
After a bit of back/fourth and a few other folks chiming in, it looks like Google actually went and published a newer version of Flash (27.0.0.170) with latest Chrome (61.0.3163.100) update. This newer Flash version is not even available for download and the current version as listed on Adobe's website should be 27.0.0.159. This issue not only affects VMware products that uses Flash but any website that has Flash content and I had also noticed few others sharing frustrations on Twitter for other flash-based websites.

解法:
UPDATE5 (10/18/2017) - Adobe has just published a new beta build of Flash which includes both the security fix as well as the fix resolving the vSphere Web Client as well as other VMware-based products that rely on Flash (e.g. vCloud Director, etc). Depending on the platform, you may need to un-install the previous version of Flash and make sure you restart your browser. I just verified on my macOS system that I can now logon to a vSphere Web (Flex) Client without issues.
For Windows, the path is %LocalAppData%\Google\Chrome\User Data\PepperFlash
For macOS, the path is ~/Library/Application\ Support/Google/Chrome/PepperFlash


2017年10月20日 星期五

用 sed 在 xml 裡新增收件者

find * -name 'resource_*.xml' -exec grep -H -i "w33" {} \;|awk -F":" '{print "sed -i.bak -e \x27\\#w33#a\\\\x9\\x9<receiver user=\x22三五\x22 >w35@mail.XXX.XXX.tw</receiver>\x27 "$1 " "}'

* 印不出來的時候用 \x 代替

"  =  \x22
'   =  \x27
\t  =  \x9


* 在 sed 要換  delimiters 的時候前面要加一個 \

# do this (ugly)...
sed '/\/a\/b\/c\//{do something;}'
# ...or these (better)
sed '\#/a/b/c/#{do something;}'
sed '\_/a/b/c/_{do something;}'
sed '\%/a/b/c/%{do something;}'
# etc.

http://backreference.org/2010/02/20/using-different-delimiters-in-sed/

* grep  可以用  -H  印出檔名

* sed 要印 兩個 tab 的時候用  \\x9\x9 ,丟到 awk 裡面的話 前面各再加一個 \

* sed 真的要跑的時候加上 -i.bak -e 'SCRIPT' 就會真的改

* sed '/PATT/aNEW' 代表在 MATCH 到 PATT 這個 pattern 的後面一行加上 NEW



*sed 把換行符號拿掉

sed ':a;N;$!ba;s/\n/ /g' file
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' file

https://stackoverflow.com/questions/1251999/how-can-i-replace-a-newline-n-using-sed


  1. Create a label via :a.
  2. Append the current and next line to the pattern space via N.
  3. If we are before the last line, branch to the created label $!ba ($! means not to do it on the last line as there should be one final newline).
  4. Finally the substitution replaces every newline with a space on the pattern space (which is the whole file).