This is a guide that I put together which is primarily aimed at Steam Deck enthusiasts and developers. I will be updating this over time as I think of more things to put in here.
Discover gists
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
fmt.Println("Hello, What's your favorite number?") | |
var i int | |
fmt.Scanf("%d\n", &i) |
# pip install hidapi | |
import hid | |
import time | |
# Define the vendor ID and product ID for the PlayStation 1 controller | |
VENDOR_ID = 0x054C | |
PRODUCT_ID = 0x05C4 | |
# Define the bit masks for each button |
<?php | |
/* | |
* Plugin Name: Paulund WP List Table Example | |
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area | |
* Plugin URI: http://www.paulund.co.uk | |
* Author: Paul Underwood | |
* Author URI: http://www.paulund.co.uk | |
* Version: 1.0 | |
* License: GPL2 | |
*/ |
const BUTTONS = { | |
'TRIANGLE': 0x1000, | |
'CIRCLE': 0x2000, | |
'CROSS': 0x4000, | |
'SQUARE': 0x8000 | |
}; | |
function isButtonPressed(state, button) { | |
return (state.buttons & button) === 0; | |
} |
try { | |
let src = cv.imread('canvasInput') | |
let imgHLS = new cv.Mat() | |
cv.cvtColor(src, imgHLS, cv.COLOR_BGR2HLS) | |
// 画像の中心点 | |
const cx = Math.floor(src.cols / 2) | |
const cy = Math.floor(src.rows / 2) |
// sudo apt-get install libhidapi-dev | |
// On macOS: bash brew install hidapi | |
// Compile: g++ -o ps1_controller ps1_controller.cpp -lhidapi-hidraw | |
#include <iostream> | |
#include <hidapi/hidapi.h> | |
#define VENDOR_ID 0x054C // Replace with your controller's vendor ID | |
#define PRODUCT_ID 0x05C4 // Replace with your controller's product ID |
import hid | |
# Replace these with your controller's vendor ID and product ID | |
VENDOR_ID = 0x054C # Example: Sony vendor ID | |
PRODUCT_ID = 0x05C4 # Example: PlayStation controller product ID | |
def is_button_pressed(data, button_mask): | |
# Data is typically an array of bytes. The exact format depends on your device. | |
# Here, we assume data[5:7] contains the 16-bit button state. | |
button_state = (data[5] << 8) | data[6] |
Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.
Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.
Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.
The book is build around 34 chapters organised in chapters.
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
- Follow standard conventions.
- Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
- Boy scout rule. Leave the campground cleaner than you found it.
- Always find root cause. Always look for the root cause of a problem.