Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

5/29/2023

Bash get price cryto from binance.

All

https://api.binance.com/api/v3/ticker/price? 

Some symbol

https://api.binance.com/api/v3/ticker/price?symbol=LUNCUSDT

code

#!/usr/bin/env bash
btc=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT | jq -Mr '.price')
lunc=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=LUNCUSDT | jq -Mr '.price')
shib=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=SHIBUSDT | jq -Mr '.price')
xec=$(curl -sS https://api.binance.com/api/v3/ticker/price?symbol=XECUSDT | jq -Mr '.price')

echo "B $btc | L $lunc | S $shib | X $xec"

8/02/2021

Linux Mint : Config VPN On Linux Mint

Linux Mint : Config VPN On Linux Mint
https://support.hidemyass.com/hc/en-us/articles/202721596-OpenVPN-Setup-with-Network-manager-on-Linux-Mint-Mate

1. Load config VPN ที่เป็น Viscosity Inline Config

2. Install
Type:
  1. sudo apt-get install network-manager-openvpn network-manager-openvpn-gnome
and press Enter
Type:
y
and press Enter

3. Click on "Network Connections" and new window will appear. Then click on "Add" and then select "Import a saved VPN configuration" and click on "Create", as shown below:
4. New window will appear, here you need to go to that HMA VPN folder and to select the OpenVPN® configuration file for the location you wish to connect to and then click on "Open".
5. In this window, enter your HMA Username and Password into the appropriate fields in the "VPN" tab and make sure that "All users may connect to this network" is checked on the "General" tab and lastly press "Save"
6. Navigate to your Network Manager (located in the top right corner of your desktop). Click on VPN Connections and then click on the button next to the VPN server you configured previously. (In this example, it's USA.Kentucky.Louisville.UDP)
You will see a notification that you have established a successful VPN connection!


3/18/2021

ติดตั้ง Windows และ Linux ใน HDD ก้อนเดียว

ติดตั้ง Windows และ Linux ใน HDD ก้อนเดียว Bios ทำเป็น UEFI HDD เป็น GPT
1. ติดตั้ง Windows ทำ Data เป็น NTFS ไว้สำหรับใช้ร่วมกัน Ubuntu กับ Windows
2. ติดตั้ง Ubuntu ลง
HDD Windows 100G Ntfs
HDD DATA 350G Ntfs ใช้ร่วมกัน
HDDUbuntu 40G Ext4

ใช้ได้เลยมี Grub ของ Ubuntu ได้ให้ใช้ได้เลย เพราะ Linux, Ubuntu จะสร้าง Group ให้

หรือ ให้มี Menu ให้เลือกสวยงามให้ใช้
https://www.rodsbooks.com/refind/installing.html
วิธีติดตั้ง
sudo apt-add-repository ppa:rodsmith/refind
sudo apt-get update
sudo apt-get install refind
refind-install
reboot

เข้า bios ตั้งตัว Boot หลัก ให้เป็นตัวที่ไม่ใช่ Ubuntu หรือ Windows ก็จะเข้าหน้า Refind ได้
อันไหนไม่เอา ดูที่หน้า Refind มันจะมี Path อยู่ว่ามันเจออยู่ที่ไหน เข้า Ubuntu ไปลบทิ้ง ก็จะเหลือที่เราจะใช้เท่านั้น
Path Config อยู่ที่
/boot/efi/EFI/refind/refind.config

ใส่ Disabled ในอันที่ไม่ต้องการให้แสดง ใส่ yes ให้แสดง

3/03/2021

Ubutun : Terminal แตกไฟล์เอาเฉพาะไฟล์ที่ต้องการ

 Ubutun : Terminal แตกไฟล์เอาเฉพาะไฟล์ที่ต้องการ

วิธีนี้แตกเฉพาะไฟล์ที่ต้องการ
https://askubuntu.com/questions/168795/ ... ar-archive

เช่น ตัวอย่างไฟล์ zip ตามแนบ
คำสั่ง เช่น

tar -xf Test.tar.gz Test/123/456/ฝบง./hostneverdie.pdf
tar -xf Test.tar.gz Test/123/456/77.txt
ก็จะได้เฉพาะไฟล์ที่ต้องการ แต่ Path ที่อยู่ของไฟล์จะแตกตามเดิม จะได้รู้ว่าไฟล์อยู่ที่ไหน


6/17/2020

Linux Mint แก้ปัญหา Add Printer Auto ใน Network

Linux Mint แก้ปัญหา Add Printer Auto ใน Network
เมื่อต่อ Network แล้วเข้า printer ตัว Printer ที่อยู่ใน Network จะ Add เข้ามา Auto บางตัวไม่ได้ใช้
ลบออกแล้วก็ยัง Add เข้ามาใหม่

แก้โดย
  1. nano /etc/cups/cups-browsed.conf

Uncomment
CreateIPPPrinterQueues LocalOnly

  1. /etc/init.d/cups restart


ก็จะเหลือเฉพาะ Printer ที่เรา Add ไว้

https://forums.linuxmint.com/viewtopic.php?t=277091

6/11/2020

Linux Mint 19.3 Go Back To Old Kernel

Linux Mint 19.3 Go Back To Old Kernel And Boot to select grub menu.
1. แก้ grub
nano /etc/default/grub
เดิม
  1. GRUB_TIMEOUT_STYLE=hidden
  2. GRUB_TIMEOUT=0

ใหม่
  1. GRUB_TIMEOUT_STYLE=menu
  2. GRUB_TIMEOUT=4

เลข 4 คือเวลาต้องการให้หน่วงกี่วินาที

2. reboot แล้วเลือก grub ที่ต้องการ
3. ลบ grub ที่ปัญหาออก ใน Update Manager --> View --> Linux Kernel


https://forums.linuxmint.com/viewtopic.php?t=248892

8/23/2019

Extranet : ติดตั้ง Extranet ใน Ubuntu 18.04

Extranet : ติดตั้ง Extranet ใน Ubuntu 18.04
1. ติดตั้ง Ubuntu 18.04
Set IP
https://intranet.sci.com/blog.php?u=281&b=1716
Update Upgrade ให้เรียบร้อย

ต้องใช้ php5 เพราะมีใช้คำสั่งติดต่อกับ Axapta ใน Code ใช้ php7 ไม่ได้
2. ติดตั้ง Apache2
  1. sudo apt-get install apache2


3. ติดตั้ง php5.6
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php5.6

  1. php -v

PHP 5.6.40-10+ubuntu18.04.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

  1. sudo a2dismod mpm_event
  2. sudo a2enmod php5.6
  3. sudo service apache2 restart


4. แก้ index.php ดู php version เพิ่ม
  1. phpinfo();


5. ติดตั้ง mysql และ phpmyadmin
  1. sudo apt-get install mysql-server
  2. sudo apt-get install mysql-phpmyadmin


6. mssql สำหรับติดต่อไป axapta server
https://intranet.sci.com/blog.php?u=3&b=293
ลงไม่ได้
  1. sudo apt-get install php5-mssql

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-mssql


ต้องใช้
  1. sudo apt-get install php5.6-sybase freetds-common libsybdb5
  2. /etc/init.d/apache2 restart


https://gist.github.com/joecampo/acd1e5881aee08bd8959

7. เปลี่ยนรหัส root ที่ login เข้า phpmyadmin
https://intranet.sci.com/blog.php?u=281&b=1718

8. phpmyadmin เข้าไม่ได้ มีตัวหนังสือสีแดงลงโปรแกรมที่จะใช้ไม่ครบ
  1. apt-get install php5.6-mbstring
  2. apt-get install php5.6-mysqli
  3. /etc/init.d/apache2 restart


8. แก้ max upload php.ini upload database ไม่ผ่าน
nano /etc/php/5.6/apache2/php.ini

upload_max_filesize = 100m
memory_limit = 256m

  1. /etc/init.d/apache2 restart


10. สร้าง database sci_extranet และ import database ที่มี

11. เปลี่ยนชื่อเครื่อง ตั้งชื่อเครื่องไม่ถูก
https://linuxize.com/post/how-to-change ... ntu-18-04/

12. เปิดใช้งานแบบ https
12.1. สร้าง Cer
https://intranet.sci.com/blog.php?u=281&b=1673
https://intranet.sci.com/blog.php?u=3&b=970
12.2. แก้ไฟล์ redirect port
  1. nano /etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:80>
ServerName extranet.scivalve.com
Redirect / https://extranet.scivalve.com/
ServerAdmin suwit@scivalve.com
</VirtualHost>

<VirtualHost *:443>
ServerName extranet.scivalve.com
DocumentRoot /var/www/extranet
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/extranet.scivalve.com.pem
SSLCertificateKeyFile /etc/apache2/ssl/extranet.scivalve.com.key
ServerAdmin suwit@scivalve.com
<Directory /var/www/extranet/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName extranet.sci.com
Redirect / https://extranet.sci.com/
ServerAdmin suwit@scivalve.com
</VirtualHost>

<VirtualHost *:443>
ServerName extranet.sci.com
DocumentRoot /var/www/extranet
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/extranet.sci.com.pem
SSLCertificateKeyFile /etc/apache2/ssl/extranet.sci.com.key
ServerAdmin suwit@scivalve.com
<Directory /var/www/extranet/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>


13. exports cer
https://intranet.sci.com/blog.php?u=281&b=1060
ทำ cer ไป authen จาก server ไปเครื่องลูก
https://intranet.sci.com/blog.php?u=281&b=1061

ภาษาไทยที่ select มาจาก Axatpa ไม่แสดง ภาษาไทย อ่านไม่ออก
แสดงเป็น ???????????????????

แก้ php.ini
  1. nano /etc/php/5.6/apache2/php.ini

แก้จาก
mssql.charset = "ISO-8859-1"
แก้เป็น
mssql.charset = "tis620"

แล้ว Restart apache
  1. /etc/init.d/apache2 restart

5/29/2019

Linux :: Linux Manjaro Add Printer HP Laserjet P1606dn Shared with smb

Linux :: Linux Manjaro Add Printer HP Laserjet P1606dn Shared with smb

1. Install program by search Add/Remove Program
smb.conf

2. Edit smb.conf workgroup to SCI
3. Install python smbc for browser name computer shared on network.
python smbc

4. Install foo2zjs
foo2zjs

5. Add Printer by use PPD
https://nextcloud.sci.com/index.php/s/fYGeB6GDcYz3S4L