OCRmyPDF

เครื่องมือที่สามารถเปลี่ยนไฟล์ PDF ให้กลายเป็นเอกสารที่สามารถค้นหาได้ โดยใช้เครื่องมือ Tesseract OCR เพื่อจดจำเนื้อหาของ PDF เป็นข้อความ แล้วเพิ่มเลเยอร์ข้อความ OCR ลงในไฟล์ PDF ซึ่งช่วยให้สามารถค้นหาและคัดลอกเนื้อหา PDF ได้รองรับกว่า 100 ภาษา
# ติดตั้ง
# Debian, Ubuntu
apt install ocrmypdf
# Windows Subsystem for Linux
apt install ocrmypdf
#Fedora
dnf install ocrmypdf
#macOS
brew install ocrmypdf
#LinuxBrew
brew install ocrmypdf
#FreeBSD
pkg install textproc/py-ocrmypdf
#Conda (WSL, macOS, Linux)
conda install ocrmypdf
#Snap (snapcraft packaging)
snap install ocrmypdf
ติดตั้งบน windows :
Installing OCRmyPDF — ocrmypdf 13.7.1.dev62+g7bd0e432 documentation
การใช้งาน :
ocrmypdf input.pdf output.pdf
วิดีโอตัวอย่างการใช้งาน :
OCRmyPDF throws WinError -The system cannot find the file specified - YouTube
สนใจสามารถเข้าไปดูรายละเอียดได้ที่:
https://github.com/ocrmypdf/OCRmyPDF
django-silk

เครื่องมือใช้ในการวิเคราะห์ประสิทธิภาพสำหรับ Django ซึ่งสามารถแสดงข้อมูล เช่น ใช้เวลานานโดยเฉลี่ย และจำนวน request แถมทีเวลาที่ใช้ในการ query SQL และการวิเคราะห์ประสิทธิภาพโค้ด Django ในหน้าเดียวได้ และด้วยข้อมูลนี้เอง นักพัฒนาสามารถค้นหาปัญหาคอขวดด้านประสิทธิภาพของการให้บริการ Django ได้และสามารถดูสาเหตุของการตอบสนองที่ช้าได้อย่างรวดเร็ว
สิ่งที่ต้องการ :
- Django: 3.2, 4.0, 4.1
- Python: 3.7, 3.8, 3.9, 3.10
การติดตั้ง :
# ติดตั้ง
pip install django-silk
ในsettings.py
การเพิ่มสิ่งต่อไปนี้ลงไป :
MIDDLEWARE = [
...
'silk.middleware.SilkyMiddleware',
...
]
INSTALLED_APPS = (
...
'silk'
)
ในการเปิดใช้งานการเข้าถึงอินเทอร์เฟซผู้ใช้ ให้เพิ่มสิ่งต่อไปนี้ในurls.py
:
urlpatterns += [path('silk/', include('silk.urls', namespace='silk'))]
ก่อนรันทำการ migrate ก่อน :
python manage.py migrate
python manage.py collectstatic
สนใจสามารถเข้าไปดูรายละเอียดได้ที่:
GitHub - jazzband/django-silk: Silky smooth profiling for Django
Games
โปรเจ็กต์นี้เป็นตัวอย่างเกมสนุกๆ มากกว่า 20 เกม ซึ่งทั้งหมดได้รับการพัฒนาและทำงานบน Python และใช้ไลบรารี ได้แก่ cocos2d, pygame, PyQt เป็นต้น แม้ว่าเกมเหล่านี้จะดูไม่ได้ใหญ่โตมาก แต่ก็เหมาะที่จะเป็นโปรเจ็กต์ง่ายๆ ที่เหมาะมากสำหรับผู้ที่จะเริ่มต้นเรียนรู้
การติดตั้ง :
pip install cpgames
เริ่มต้นใช้งานอย่างรวดเร็ว :
import random
from cpgames import cpgames
game_client = cpgames.CPGames()
all_supports = game_client.getallsupported()
game_client.execute(random.choice(list(all_supports.values())))
เกมทั้งหมดที่มีในนี้ :
ID | ชื่อเกม | ซอร์สโค้ด | การแนะนำ |
---|---|---|---|
Game1 | bunnybadger | คลิก | คลิก |
Game2 | voicecontrolpikachu | คลิก | คลิก |
Game3 | puzzlepieces | คลิก | คลิก |
Game4 | ski | คลิก | คลิก |
Game5 | tankwar | คลิก | คลิก |
Game6 | flappybird | คลิก | คลิก |
Game7 | trexrush | คลิก | คลิก |
Game8 | towerdefense | คลิก | คลิก |
Game9 | catchcoins | คลิก | คลิก |
Game10 | aircraftwar | คลิก | คลิก |
Game11 | tetris | คลิก | คลิก |
Game12 | sokoban | คลิก | คลิก |
Game13 | alieninvasion | คลิก | คลิก |
Game14 | pacman | คลิก | คลิก |
Game15 | gemgem | คลิก | คลิก |
Game16 | twentyfourpoint | คลิก | คลิก |
Game17 | pingpong | คลิก | คลิก |
Game18 | breakoutclone | คลิก | คลิก |
Game19 | bomberman | คลิก | คลิก |
Game20 | maze | คลิก | คลิก |
Game21 | whacamole | คลิก | คลิก |
Game22 | gobang | คลิก | คลิก |
Game23 | twozerofoureight | คลิก | คลิก |
Game24 | greedysnake | คลิก | คลิก |
Game25 | minesweeper | คลิก | คลิก |
Game26 | angrybirds | คลิก | คลิก |
Game27 | flipcardbymemory | คลิก | คลิก |
Game28 | magictower | คลิก | คลิก |
Game29 | bloodfootball | คลิก | คลิก |
สนใจสามารถเข้าไปดูรายละเอียดได้ที่ :
GitHub - CharlesPikachu/Games: Games: Create interesting games by pure python.
pg_activity
เครื่องมือ Command line ตรวจสอบฐานข้อมูล PostgreSQL สามารถดูสถานะของฐานข้อมูล PostgreSQL แบบเรียลไทม์และรายละเอียดการเรียกใช้คำสั่ง SQL ต่างๆในแต่ละรายการ ใช้เวลานานเท่าไหร่ หรือใช้ทรัพยากรเท่าไหร่ ความเร็วในการอ่าน/เขียน และข้อมูลอื่นๆ ด้วยคำสั่งเดียวได้
สิ่งที่ต้องการ :
pip บน python 3.7 หรือใหม่กว่า
การติดตั้ง :
# บน Ubuntu
$ sudo apt install pg-activity
# บน Centos
$ sudo yum install pg_activity
# ติดตั้งด้วย pip
pip install pg_activity psycopg2-binary
การใช้งาน :
postgres pg_activity -U postgres
ตัวเลือกอื่นๆ :
pg_activity [options] [connection string]
Options:
--blocksize BLOCKSIZE
Filesystem blocksize (default: 4096).
--rds Enable support for AWS RDS (implies --no-tempfiles and filters out the rdsadmin database from space calculation).
--output FILEPATH Store running queries as CSV.
--no-db-size Skip total size of DB.
--no-tempfiles Skip tempfile count and size.
--no-walreceiver Skip walreceiver checks.
-w, --wrap-query Wrap query column instead of truncating.
--duration-mode DURATION_MODE
Duration mode. Values: 1-QUERY(default), 2-TRANSACTION, 3-BACKEND.
--min-duration SECONDS
Don't display queries with smaller than specified duration (in seconds).
--filter FIELD:REGEX Filter activities with a (case insensitive) regular expression applied on selected fields. Known fields are: dbname.
--debug-file DEBUG_FILE
Enable debug and write it to DEBUG_FILE.
--version show program's version number and exit.
--help Show this help message and exit.
Connection Options:
connection string A valid connection string to the database, e.g.: 'host=HOSTNAME port=PORT user=USER dbname=DBNAME'.
-h HOSTNAME, --host HOSTNAME
Database server host or socket directory.
-p PORT, --port PORT Database server port.
-U USERNAME, --username USERNAME
Database user name.
-d DBNAME, --dbname DBNAME
Database name to connect to.
Process table display options:
These options may be used hide some columns from the processes table.
--no-pid Disable PID.
--no-database Disable DATABASE.
--no-user Disable USER.
--no-client Disable CLIENT.
--no-cpu Disable CPU%.
--no-mem Disable MEM%.
--no-read Disable READ/s.
--no-write Disable WRITE/s.
--no-time Disable TIME+.
--no-wait Disable W.
--no-app-name Disable App.
Other display options:
--hide-queries-in-logs
Disable log_min_duration_statements and log_min_duration_sample for pg_activity.
--no-inst-info Display instance information in header.
--no-sys-info Display system information in header.
--no-proc-info Display workers process information in header.
--refresh REFRESH Refresh rate. Values: 0.5, 1, 2, 3, 4, 5 (default: 2).
สนใจสามารถเข้าไปดูรายละเอียดได้ที่ :
Pendulum
ไลบรารี่เพื่อทำให้การเรียกใช้เวลาบน Python นั้นง่ายขึ้น โปรเจ็กต์นี้ไม่เพียงแต่มี API ที่ใช้งานง่ายขึ้นเท่านั้น แต่ยังเข้ากันได้กับไลบรารีมาตรฐานของ datetime อีกด้วย ซึ่งสามารถแทนที่อ็อบเจ็กต์ datetime ในโค้ดได้โดยตรง มีวิธีการประมวลผลเวลาแบบ humanized มากมาย เช่น การบวกและการลบเวลา หรือการจัดการเขตเวลา และอื่นๆอีกมากมาย รองรับ Python 2.7 และ Python 3.4+
การติดตั้ง :
pip install pendulum
การใช้งาน :
>>> import pendulum
>>> now_in_paris = pendulum.now('Europe/Paris')
>>> now_in_paris
'2016-07-04T00:49:58.502116+02:00'
>>> tomorrow = pendulum.now().add(days=1)
>>> past = pendulum.now().subtract(minutes=2)
>>> past.diff_for_humans()
'2 minutes ago'
>>> delta = past - last_week
>>> delta.hours
23
>>> delta.in_words(locale='en')
'6 days 23 hours 58 minutes'
สนใจสามารถเข้าไปดูรายละเอียดได้ที่ :
ที่มา : HelloGitHub 第 78 期