Skip to content

Instantly share code, notes, and snippets.

View baoson2211's full-sized avatar

Bao Son Le baoson2211

  • Hanoi, Vietnam
View GitHub Profile
@baoson2211
baoson2211 / keychron_linux.md
Created October 11, 2023 03:12 — forked from andrebrait/keychron_linux.md
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work

Keychron Keyboards on Linux use the hid_apple driver (even in Windows/Android mode), both in Bluetooth and Wired modes. By default, this driver uses the F-keys as multimedia shortcuts and you have to press Fn + the key to get the usual F1 through F12 keys.

@baoson2211
baoson2211 / uart.c
Created September 3, 2021 10:03 — forked from glegrain/uart.c
STM32 printf retarget to UART
/*# 1- Identify the UART interface, GPIO pins and Alternate Function #########*/
/* For example:
* B-L475E-IOT01A:
* PB6 ------> USART1_TX
* PB7 ------> USART1_RX
*
* NUCLEO-L476RG:
* PA2 ------> USART2_TX
* PA3 ------> USART2_RX
*
@baoson2211
baoson2211 / README.md
Last active July 28, 2021 20:12
Sample 3 leds misc device

Description:

  • Write 1 to character device files to enable blinky
  • Write 0 to character device files to disable blinky
  • Read from character device files to get status led ON or OFF
  • Using led_config to setup and collect time inteval on each led

Sample is tested on:

  • OpenSTLinux Development package, kernel version 5.10.10
  • STM32MP157C-DK2 board
  • Using 2 built-in leds LD6 (GPIOA13) + LD7 (GPIOH7) and an external led connected to GPIOF3
@baoson2211
baoson2211 / how-to-install-latest-gcc-on-ubuntu-lts.txt
Created September 9, 2017 10:39 — forked from application2000/how-to-install-latest-gcc-on-ubuntu-lts.txt
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@baoson2211
baoson2211 / pyusb_mouse_read.py
Created May 17, 2017 16:06 — forked from jonasas/pyusb_mouse_read.py
Python code for mouse reading under PyUSB.
import array
import sys
import usb.core
import usb.util
VID = 0x046d
PID = 0xc05a
DATA_SIZE = 4
@baoson2211
baoson2211 / List of the SDCC library
Last active December 10, 2016 16:34
STM8s - SDCC patch
Not finished - 20 Jan 2002 - checkpoint (Steve Kenton)
This is a sorted (ignoring leading '_') list of the SDCC library.
Sources are in ~sdcc/device/lib/*.c and ~sdcc/device/include/*.h.
Except where denoted with MACRO these are implemented as functions.
Internal function calls are generated by the compiler to implement
IEEE floating point, etc. They are not normally called directly.
isalnum - character classification - #include <ctype.h> - all ports
char isalnum (unsigned char c); MACRO
@baoson2211
baoson2211 / app.js
Created August 25, 2016 16:57 — forked from arvis/app.js
Basic express and mongoose CRUD application
/**
* Module dependencies.
*/
var express = require('express')
, routes = require('./routes')
, http = require('http')
, mongoose = require('mongoose')
, path = require('path');
@baoson2211
baoson2211 / thingspeak-install.sh
Last active July 21, 2019 10:05 — forked from abythell/thingspeak-install.sh
Bash script to install a Thingspeak server on Ubuntu Server 14.04.
#!/bin/bash
# Automatic install of Thingspeak server on Ubuntu 14.04 / Raspbmc / Debian (?)
# Updated to use ruby 2.1.4
## Install required packages
sudo apt-get update
sudo apt-get -y install build-essential git mysql-server mysql-client libmysqlclient-dev libxml2-dev libxslt1-dev libssl-dev libsqlite3-dev curl rubygems-integration
## rbenv
git clone git://github.com/sstephenson/rbenv.git .rbenv
@baoson2211
baoson2211 / etc_apache2_sites-enabled_git
Created January 16, 2016 16:54
Gitolite v3 gitweb.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName git.wrow.net
ServerAlias git.wrow.net
Alias / /usr/share/gitweb/
<Directory /usr/share/gitweb>
Order allow,deny
Allow from all