🗨️ Have a question? Join Chat! | 🇯🇵 Learn Japanese | 📚 Resources | ❓ FAQ |
---|
#Optimally resize `img` according to the bounding boxes specified in `boxes` (which is simply the (pruned) results from `pytesseract.image_to_data()`). | |
#Tesseract performs optimally when capital letters are ~32px tall (https://groups.google.com/g/tesseract-ocr/c/Wdh_JJwnw94/m/24JHDYQbBQAJ). Smaller text obviously can't be OCR'd as accurately, but weirdly enough, larger text causes problems as well. So, this function uses the bounding boxes we've found and resizes the image so that the median line height should be ~32px. | |
def optimal_resize(img, boxes): | |
median_height = np.median(boxes["height"]) | |
target_height = 32 #See https://groups.google.com/g/tesseract-ocr/c/Wdh_JJwnw94/m/24JHDYQbBQAJ | |
scale_factor = target_height / median_height | |
print("Scale factor: " + str(scale_factor)) | |
#If the image is already within `skip_percentage` percent of the target size, just return the original image (it's better to skip resizing if we can) | |
skip_percentage = 0.07 |
import requests | |
# Define connection details | |
server_url = 'http://192.168.0.200:8096' | |
username = 'User' | |
password = 'Password' | |
# Build json payload with auth data | |
auth_data = { | |
'username': username, |
also see this guide which has better compatibility. This guide is forked from it. written by kamui-7
This guide is very close to exactly how I run vn's on my setup. I can't guarantee it'll work for everyone (in fact, i can probably guarantee it's broken for someone/some game)
sudo pacman -S wine-staging giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama ncurses lib32-ncurses libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs lib32-gst-plugins-goo
# permanent apple keyboard keyswap | |
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf | |
update-initramfs -u -k all | |
# Temporary & instant apple keyboard keyswap | |
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd | |
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super) | |
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win |
This is a quick Python script I wrote to download HumbleBundle books in batch. I bought the amazing Machine Learning by O'Reilly bundle. There were 15 books to download, with 3 different file formats per book. So I scratched a quick script to download all of them in batch.
(Final Result: books downloaded)
I've knocked up a system for managing WINE prefixes from the command-line. It's for FISH, because that's what I use, and it's reasonably versatile and maintainable.
Note 1: I'm going to use "prefix" and "bottle" interchangeably.
Note 2: This is for hardcore command-line users, and it's similar to tools like virtualenv and rbenv. Most people would probably want to use Lutris.
Anyway...
local sense=-20 | |
local speed = mp.get_property("speed") | |
local detect = false | |
function f(msg) | |
if string.find(msg.text, "silence_end") and detect then | |
mp.set_property("speed",speed) | |
endmsg=msg.text | |
detect = false | |
--print("end") | |
elseif string.find(msg.text, "silence_start") and detect==false then |
You may want a linter plugin to lint your code in Vim but you probably don't need it. At least try the built-in way before jumping on the plugin bandwagon.
autocmd FileType <filetype> setlocal makeprg=<external command>
This autocommand tells Vim to use <external command>
when invoking :make %
in a <filetype>
buffer. You can add as many similar lines as needed for other languages.