RSS

Cài đặt transmission cho NAS LS-XHL


1. Copy 2 file 2_trans_auto.sh và S88transmission vào thư mục /mnt/disk1
Download
2. Chmod +x cho 2 file trên để có quyền excute
3. Chạy file ./2_trans_auto.sh
Để cài đặt bản 2.94 cần cài đặt bản ipkg mới nhất. Xem hướng dẫn cài đặt ở đây
Cài đặt rtorrent cho NAS LS-XHL

4. Sửa các cấu hình trong file /root/.config/transmission-daemon/settings.json
192.168.1.123 –> Là địa chỉ IP trong mạng LAN

{
"alt-speed-down": 0,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 0,
"bind-address-ipv4": "192.168.1.123",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"blocklist-url": "http://www.example.com/blocklist",
"cache-size-mb": 4,
"dht-enabled": true,
"download-dir": "/mnt/disk1/Torrents",
"download-queue-enabled": true,
"download-queue-size": 0,
"encryption": 1,
"idle-seeding-limit": 30,
"idle-seeding-limit-enabled": false,
"incomplete-dir": "/mnt/disk1/Torrents",
"incomplete-dir-enabled": false,
"lpd-enabled": false,
"message-level": 2,
"peer-congestion-algorithm": "",
"peer-id-ttl-hours": 6,
"peer-limit-global": 200,
"peer-limit-per-torrent": 200,
"peer-port": 8889,
"peer-port-random-high": 8889,
"peer-port-random-low": 8889,
"peer-port-random-on-start": false,
"peer-socket-tos": "default",
"pex-enabled": true,
"port-forwarding-enabled": true,
"preallocation": 1,
"prefetch-enabled": true,
"queue-stalled-enabled": true,
"queue-stalled-minutes": 30,
"ratio-limit": 2,
"ratio-limit-enabled": false,
"rename-partial-files": true,
"rpc-authentication-required": false,
"rpc-bind-address": "192.168.1.123",
"rpc-enabled": true,
"rpc-host-whitelist": "",
"rpc-host-whitelist-enabled": true,
"rpc-password": "password",
"rpc-port": 8888,
"rpc-url": "/transmission/",
"rpc-username": "username",
"rpc-whitelist": "*.*.*.*",
"rpc-whitelist-enabled": true,
"scrape-paused-torrents-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"seed-queue-enabled": false,
"seed-queue-size": 0,
"speed-limit-down": 0,
"speed-limit-down-enabled": false,
"speed-limit-up": 0,
"speed-limit-up-enabled": false,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 0,
"upload-slots-per-torrent": 200,
"utp-enabled": true
}

5. Nếu transmission không tự start sau khi reboot thì tạo crontab để check sống chết.
Tạo file check_transmission
#!/bin/bash
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin
logfile="/var/log/rtorrentInit.log"
echo `date` `ps |grep "transmission-daemon" |grep -v grep` >> $logfile
RESULT=$(ps |grep "transmission-daemon" |grep -v "grep"|wc -l)
echo "`date` count ${RESULT}" >> $logfile
if [ "${RESULT}" -eq "0" ]; then
echo "`date` transmission is not running--> start" >> $logfile
`/mnt/disk1/script/S88transmission`
else
echo "`date` transmission is running" >> $logfile
fi

Add quyền thực thi
chmod +x check_transmission

Thêm vào crontab

*/5 * * * * /mnt/disk1/script/check_transmission

Xong.

 
Leave a comment

Posted by on July 25, 2020 in Other, Uncategorized

 

Cấu hình flexget download từ RSS theo regex và size


1. Sửa file config.yml

tasks:
task1:
rss:
url: http://xxxx/torrentrss.php
all_entries: no
regexp:
accept:
– .*(720p|1080p).*
from: title
download: /media/deluge/watch/

tasks:

task2:

rss:

url: http://xxxx

all_entries: no

content_size:

min: 40000

max: 500000

accept_all: yes

download: /torrents/watch

2. Cấu hình crontab
*/1 * * * * ~/pip/bin/flexget –cron execute

*/1: Là chạy 1 phút 1 lần

 
Leave a comment

Posted by on July 25, 2020 in Uncategorized

 

Cài đặt rtorrent cho NAS LS-XHL


Nếu cài lại từ đầu thì cần google các bước theo thứ tự như dưới
– Cài đặt firmware (version mới nhất hiện tại là 1.74)
– Enable SSH
Download firmware tại đây : https://www.buffalotech.com/products/linkstation-mini

B1. Cài đặt IPKG
Xem chi tiết ở đây https://github.com/Optware/Optware-ng#news

– Kiểm tra xem NAS đang chạy version nào.

root@LS-XHLA66:/mnt/disk1/Torrents# uname -a
Linux LS-XHLA66 3.3.4-88f6281 #1 Thu Jun 22 15:47:23 JST 2017 armv5tel GNU/Linux

– Download bootstrap tương ứng với version OS

ARMv5 EABI (use this if running a more recent linux, 2.6.36.4 or newer):
wget -O – http://ipkg.nslu2-linux.org/optware-ng/bootstrap/buildroot-armv5eabi-ng-bootstrap.sh | sh

– Add /opt/bin vào PATH

export PATH=$PATH:/opt/bin:/opt/sbin

Hoặc sửa file ~/.bashrc add thêm dòng trên vào cuối file
Chạy lệnh dưới để apply
source ~/.bashrc

B2. Cài đặt rtorrent và rutorrent
Xem hướng dẫn tại đây:
https://forum.xtdv.group/thread_6__huong_dan_cai_rtorrent_va_rutorrent_phien_ban_2_0
https://forum.synology.com/enu/viewtopic.php?f=38&t=22656

B3. Cài đặt password cho rutorrent
Xem hướng dẫn tại đây
https://wiki.archlinux.org/index.php/RTorrent/RuTorrent#User_authentication

+Trường hợp rtorrent không tự start khi reboot thì viết tạm cái script auto start

#!/bin/bash
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/bin
logfile=”/var/log/rtorrentInit.log”
echo `date` `screen -list` >> $logfile
RESULT=$(screen -list | grep “rtorrent”| wc -l)
echo “`date` count ${RESULT}” >> $logfile
if [ “${RESULT}” -eq “0” ]; then
echo “`date` rtorrent is not running–> start” >> $logfile
`/mnt/disk1/script/S99rtorrent start`
`screen -wipe`
else
echo “`date` rtorrent is running” >> $logfile
`screen -wipe`
fi

Add quyền excute

chmod +x check_rtorrent

Sau đó add vào crontab
*/2 * * * * /mnt/disk1/script/check_rtorrent

 
Leave a comment

Posted by on June 16, 2020 in Software

 

Cấu hình read timeout cho hibernate.cfg.xml


Sử dụng socket timeout oracle jdbc

 <property name="hibernate.connection.oracle.jdbc.ReadTimeou">60000</property>
 <property name="hibernate.connection.oracle.net.READ_TIMEOUT">60000</property>
 <property name="hibernate.connection.oracle.net.CONNECT_TIMEOUT">10000</property>

Note:
oracle.net.READ_TIMEOUT for jdbc versions < 10.1.0.5 
oracle.jdbc.ReadTimeout for jdbc versions >=10.1.0.5
 
Leave a comment

Posted by on February 28, 2018 in Java

 
Image

xkcn


 
Leave a comment

Posted by on March 4, 2016 in Girl xinh

 

7 stick notes – Phần mềm tạo ghi chú trên desktop Free


http://www.7stickynotes.com/

 
Leave a comment

Posted by on December 18, 2014 in Software

 

Mã hóa AES với 256bit key


B1: Sử dụng keyTool của java để sinh file key

keytool -genseckey -keystore myaeskeystore.jceks -storetype jceks -storepass 123456 -keyalg AES -keysize 256 -alias myalias -keypass 123456a@
Trong đó:
myaeskeystore.jceks : File keyStore được sinh ra
storepass 123456 : Pass để đọc file keyStore
myalias : Alias của key file
123456a@: Password của keyFile


import java.io.FileInputStream;
import java.io.InputStream;
import java.security.Key;
import java.security.KeyStore;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;

public class Test1 {
public static void main(String[] args) {
try {

// init cipher
Cipher encoder = Cipher.getInstance("AES");
Cipher decoder = Cipher.getInstance("AES");
String myalias = "myalias";
String mypass = "123456a@";

String keystorePass = "123456";
String keystoreLocation = "myaeskeystore.jceks";

InputStream keystoreStream = new FileInputStream(keystoreLocation);
KeyStore keystore = KeyStore.getInstance("JCEKS");
keystore.load(keystoreStream, keystorePass.toCharArray());

if (!keystore.containsAlias(myalias)) {
throw new RuntimeException("Alias for key not found");
}
Key key = keystore.getKey(myalias, mypass.toCharArray());

byte[] raw = key.getEncoded();
System.out.println("raw size:" + raw.length);
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");

encoder.init(Cipher.ENCRYPT_MODE, skeySpec);
decoder.init(Cipher.DECRYPT_MODE, skeySpec);

String ussdString = "hello world";
byte[] encrypt = encoder.doFinal(ussdString.getBytes("UTF-16BE"));

// convert byte to hexa String and sent to CP
StringBuilder buffer = new StringBuilder();
for (int i = 0; i > 4) & 0xF, 16));
buffer.append(Character.forDigit((encrypt[i] & 0xF), 16));
}

String encryptText = buffer.toString();
System.out.println("encryptText:" + encryptText);

} catch (Exception e) {
e.printStackTrace();
}
}

public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i+1), 16));
}
return data;
}
}

 
Leave a comment

Posted by on September 6, 2014 in Java

 

Hello world!


Welcome to WordPress.com! This is your very first post. Click the Edit link to modify or delete it, or start a new post. If you like, use this post to tell readers why you started this blog and what you plan to do with it.

Happy blogging!

 
1 Comment

Posted by on December 3, 2012 in Uncategorized