Skip to content

Instantly share code, notes, and snippets.

View SAW4's full-sized avatar

Sawa SAW4

  • Hong Kong
View GitHub Profile
@SAW4
SAW4 / STM32-C.sublime-build
Created December 20, 2017 11:41
SublimeText Build system for KEIL uVision
{
"cmd": ["UV4", "-b", "-j0", "${file}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.uvprojx",
"variants":
[
{
"name": "Flash",
"shell":true,
@SAW4
SAW4 / subl_imfix_tips.md
Last active December 4, 2017 07:46
Sublime Text 3 imfix ( Fictix IM ) with SAKURA Terminal

Sublime Text 3 imfix & fix with Terminal plugin problem

How to apply imfix?

Get the source from here, it should be the most complete one (with cursor follow fix): https://github.com/lyfeyaj/sublime-text-imfix , then just follow the guide to install (no need to compile)

If you want to DO IT BY YOURSELF, then follow the instructions below:

  1. COPY the src code from the link above (the sublime-imfix.c file), save as sublime-imfix.c, whatever.
  2. Install the gtk2 build tools.
  3. Compile the code :
@SAW4
SAW4 / fix.md
Last active April 20, 2023 23:24
Fix: kde plasma external monitor low resolution problem

Fix: kde plasma external monitor low resolution problem

Find you modeLine

cvt 1920 1080
# you will get something like this:
# 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz
Modeline "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
@SAW4
SAW4 / README.md
Last active March 6, 2024 11:58
C++ Project, with CLion + CMake + Pkg-config. Use simple gtk application as example.

How to create a C++ GTK project with Cmake + Pkg-config

  1. Create a project with CLion (Click C++ Executable)
  2. Create your source code directory src
  3. Create main.cpp and CMakeLists.txt in src

Content of src/main.cpp:

#include <gtkmm.h>
@SAW4
SAW4 / Linix_Trivia.md
Last active August 21, 2017 21:30
Trivia collection about linux (help you setup/config linux)

Linux Trivia

  • 開機時,在bootloader加載後螢幕有一下「閃動」,個人猜想其實是backlight被快速地調至最亮然後又調回先前亮度所產生的一種「錯覺」。
    • 這有可能是late KMS start + framebuffer(vesafb)的副作用,解決方案有兩個:
      1. 放棄grub2 framebuffer,意味著色彩,主題,都不能使用;可以在kernel param上加上GRUB_TERMINAL_OUTPUT=console
      2. 啟用early KMS start,在/etc/mkinitcpio.conf作以下修改:
        ...
        MODULES="crc32 i915 libcrc32c crc32c_generic ..." #加入i915到MODULES
        ...
        

Customize Chart.js Radar Chart

In dataset, you can see:

backgroundColor: "rgba(128,128,128,0.2)",   /** bgcolor inside the grid */
borderColor: "#4099FF",                     /** color of the link */
pointBackgroundColor: "#4099FF",            /** color of circle point */
pointBorderColor: "#fff",                   /** color of circle's border */
pointHoverBackgroundColor: "#4099FF"
pointHoverBorderColor: "#4099FF"
@SAW4
SAW4 / README.md
Created August 4, 2017 21:12
How to change disqus link color?

Tips: How to change disqus link color?

Add the following style to your head tag

<head>
...
...
  <style> 
 #disqus_thread a { 
@SAW4
SAW4 / README.md
Last active July 27, 2017 15:31
Aria2c WebUI tips, work around with DirectURL setting.

Aria2c WebUI - How to make DirectURL permanent

As mention by author, DircetURL's setting should be set in the file configuration.js
But after many times I tried, its not worked as expected.
So, just have a look to the code ... to see what's happening during WebUI initialization?
Finally I found a temporary solution. In the file js/services/rpc/rpc.js :

...
...
  if (['http', 'https'].indexOf(uri.protocol()) != -1 && uri.host() != 'localhost') {
 configurations.push({
@SAW4
SAW4 / README.md
Last active July 25, 2017 22:20
Tips for KDE Plasma Application Menu

Tips: How to start Anaconda Natvigator - Plasma Application Menu

Plasma Application Menu provide flexible, user-friendly interface for modifing apps menu, user can run shell script, python script, lua script, binary by one click.
However Plasma Applicaiton Menu do not pass any environment variable by default, you need to do if by yourself :(
Here is a example for launching Anaconda Natvigator.

source /home/user/.zshrc && zsh -c "/home/user/anaconda3/bin/anaconda-navigator"    
@SAW4
SAW4 / howto.md
Last active August 18, 2017 18:01
Linux connect to Windows Printer through Samba

Linux connect to Windows Printer through Samba

The first thing: Install and launch service

Install stuffs
sudo pacman -S samba smbclient cups
Launch required services
sudo systemctl enable smbd nmbd winbindd //nmbd may not required, it used to resolve netbios name
sudo systemctl start smbd nmbd winbindd

Config your printer in CUPS

Go to localhost:631, enter remote printer the address