Skip to main content

Posts

Showing posts from February, 2024

Post-install setup on OpenBSD 7.4

After installing OpenBSD 7.4, here are customizations to make it more usable. $ uname -a OpenBSD obsd.dev.obsd 7.4 GENERIC.MP#2 amd Install wireless driver Run ifconfig and see interface names. $ ifconfig | grep flags | grep -o .*: lo0: re0: iwx0: enc0: pflog0: In this case, the interface named iwx0 . Find details about it in dmesg : $ dmesg | grep iwx0 iwx0: could not read firmware iwx-cc-a0-77 (error 2) Download the driver from http://firmware.openbsd.org/firmware/ , choose the version you using, in this case is 7.4: http://firmware.openbsd.org/firmware/7.4/iwx-firmware-20230629.tgz copy the file to an USB formatted as vfat filesystem so all OSes can read from it. Mount USB Find the partition to mount: run as root If the device is sd1 , use sd1c as man disklabel explained: disklabel supports 15 configurable partitions, a through p excluding c. The c partition describes the entire physical disk, is automatically created by the kernel, and cannot be modified or delet...

Vẽ hình vuông hình tròn: bánh chưng và mặt trời

HTML5 xuất hiện từ 2008, đến nay sau 16 năm đã được phổ cập trên mọi trình duyệt. Điển hình nhất là ngày nay xem video trên Youtube không còn phải cài Adobe Flash nữa mà cứ bấm là xem. HTML5 có thể làm rất nhiều việc mà trước đây cần phần mềm khác/JavaScript: xem video nghe nhạc vẽ hình 2D 3D tạo hình động ... vậy nên người ta có thể làm game với HTML5 + JavaScript Bài này khám phá thẻ canvas trong HTML5 và vẽ bánh chưng mừng tuổi mọi người, hello 2024! Xem kết quả tại https://hvnsweeting.github.io/js-toys/draw-basic.html Canvas - vẽ hình Thẻ canvas chỉ có 2 thuộc tính width (default: 300px) và height (150px), việc vẽ hình được thực hiện bằng JavaScript. Tạo cặp thẻ HTML canvas rồi lấy object "context" 2D để vẽ hình 2D. <canvas id="banh" width=300 height=300></canvas> <script> canvas = document.getElementById("banh"); ctx = canvas.getContext("2d"); //... </script> Vẽ hình chữ nhật với fillRect (re...

Làm website đọc chữ phát ra loa với 10 dòng code (no lib, no install)

Sau khi có thể đọc text bằng 5 dòng code , làm luôn trang web. Tạo site HTML Tạo 1 ô nhập text (textarea) và 1 nút bấm (button) <html> <body> <textarea id="text" rows="24" cols="100"> In my younger and more vulnerable years my father gave me some advice that I’ve been turning over in my mind ever since. “Whenever you feel like criticizing anyone,” he told me, “just remember that all the people in this world haven’t had the advantages that you’ve </textarea> <br> <button id="speak">Speak</button> <body> </html> Đọc text khi click chuột button = document.getElementById("speak"); function speak() { synth = window.speechSynthesis; text = document.getElementById("text").value; utter = new SpeechSynthesisUtterance(text); voices = synth.getVoices(); utter.rate = 0.9; // speed - tốc độ synth.speak(utter); } button.addEventListener(...

Đọc chữ phát ra loa với 5 dòng code (no lib, no install)

Nếu bạn từng có nhu cầu nghe thay vì đọc (tiếng Anh), 5 dòng code JavaScript ngay trên trình duyệt có thể làm điều đó! Bật Web developer console Bấm Ctrl-Shift-K https://firefox-source-docs.mozilla.org/devtools-user/web_console/index.html synth = window.speechSynthesis text = ` In my younger and more vulnerable years my father gave me some advice that I’ve been turning over in my mind ever since. “Whenever you feel like criticizing anyone,” he told me, “just remember that all the people in this world haven’t had the advantages that you’ve ` utter = new SpeechSynthesisUtterance(text) utter.voice = synth.getVoices()[-1] // change to any number to change voice - giọng đọc, thay -1 bằng số khác để đổi giọng utter.rate = 0.9 // speed - tốc độ synth.speak(utter) Text from The Great Gatsby by F. Scott Fitzgerald Speech Synthesis Speech synthesis (aka text-to-speech, or TTS) involves receiving synthesizing text contained within an app to speech, and playing it out of a device's ...

Popular posts from this blog

Tài liệu và hướng dẫn học Python

Để tiết kiệm thời gian, tốt nhất là đi học PyMI Updated: 130617 Sau đây là các tài liệu khuyên dùng: Vì nhiều lý do, nên học python2.7 tại thời điểm hiện tại (giờ là tháng 6/2013 - muốn biết tại sao thì tự tìm hiểu) python 3.5+ (giờ là tháng 2/2017) Chuẩn bị: 1. biết bật tắt máy 2. biết cài python 3. tập gõ 10 ngón - gõ 2 ngón hay 1 ngón cũng không sao, nhưng 10 ngón là cách dễ nhất để gõ nhanh nhất. Tài liệu - Nên dùng tài liệu tại trang chủ của Python làm chính, tham khảo thêm các tài liệu khác tại http://www.familug.org/2016/12/free-ebook.html Căn bản, mới học 1.1 Python PyMI.vn https://pymi.vn/tutorial/ 1.2. Python offical tutorial kết hợp làm bài tập trên HackerRank  (đề bài bằng tiếng Anh, nhưng Google translate 1 lúc cũng ra vì có nhiều ví dụ mẫu đi kèm). Học viên của Pymi.vn có rất nhiều học viên đã tự học với Learn Python the hard way nhưng chưa thấy ai thành công cả. Hai link dưới nên đọc sau khi đã nắm được những phần cơ bản của ngôn ngữ pytho...

The PyMiers

New FAMILUG