Skip to content

Instantly share code, notes, and snippets.

@simonliu009
simonliu009 / gist:86f863fcd775b6e78cd0c07ecd3cec8a
Last active January 7, 2019 14:01
debug: debug output macro, STM, debug宏定义,可以一次性开启或者关闭DEBUG信息 #STM #debug
#define __DEBUG__
#ifdef __DEBUG__
#define DEBUG(format,...) printf("File: "__FILE__", Line: %05d: "format"/n", __LINE__, ##__VA_ARGS__)
#else
#define DEBUG(format,...)
#endif
以上在STM32 System Workbench 编译通过,但是在Xcode 9.3 (Apple LLVM version 9.1.0 (clang-902.0.39.1))编译会提示错误:
Invalid suffix on literal; C++11 requires a space between literal and identifier
Fix insert" "
@simonliu009
simonliu009 / xcode key bindings
Last active January 7, 2019 14:02
xcode: key bindings #xcode
ctrl+i 格式化代码 format the code
@simonliu009
simonliu009 / emacs org-mode
Last active January 7, 2019 14:03
emacs: org-mode #emacs
* ** *** 星星数量代表标题级别,最多10级
- 列表,在同一个子标题下,你还可以将内容划分的更细致。
方法是使用这些符号: ‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’。
把光标移动到 ‘1.’ ‘2.’ 或 ‘3.’ 所在的行上,然后按 shift 加左右方向键可以切换风格。
Tab 折叠该级标题
M-<RET> 创建同级标题星号
M-箭头 改变标题顺序
C-x n s 隐藏其它内容,只显示当前标题内容
C-x n w 展开其它内容
C-c C-n 移动到下一个标题
@simonliu009
simonliu009 / string to char
Created January 10, 2019 03:24
[string to char *] convert string to char * #c #string #char
String.c_str()
@simonliu009
simonliu009 / vistual studio code short cuts
Last active February 20, 2019 14:47
vsc: vistual studio code 快捷键 #vscode
多光标编辑 Multi cursor selection
基本: Alt+Click 即,按住 Alt 键,依次单击(或者选择)需要编辑的位置,可以依次添加光标。 Alt 键可以在设置中更改。
一列多光标: Shift+Alt+Down 或者 Shift+Alt+Up 可以在上下位置添加光标。
依次选中相同单词: 选中一个单词,按 Ctrl+D ,可以依次选中下一个相同单词。
选中所有相同单词: 选中一个单词,按 Shift+Ctrl+L (shift+cmd+L),可以一次性选中文本中 所有相同单词 。
矩形选择: 按住 Shift+Alt ,再进行选择,则选择区域是一个矩形。
括号选择: Shift+Alt+Right ,会选中匹配括号中的内容,并可以扩大选中区域。
选择相同实例:
@simonliu009
simonliu009 / kodi.tv
Created February 24, 2019 13:08
[kodi]热门插件 #kodi
除了exodus magic dragon 还有哪些热门的插件
目前我知道的三个热门插件 exodus 魔龙 看门狗
yoda
watch dogs
supremacy
5ivdo
youkuTV
Grindhouse Beauty
Exodus redux
13Clowns Video/b
@simonliu009
simonliu009 / cleanMac
Last active March 2, 2019 10:53
[cleanMac]temporary and cached files that can be deleted from macOS #macOS
~/library/Logs
~/library/Android/sdk
~/library/caches/Images
~/library/caches/Videos
~/library/caches/Firefox
~/library/caches/Avatar Adobe AndroidStudio2.2
~/Library/Application Support/Telegram\ Desktop
~/Library/Application Support/Kodi
@simonliu009
simonliu009 / file header snippets
Last active March 2, 2019 11:18
[file header snippets]file header snippet for .h file #vscode
{
"#ifndef … #define … #endif":{
"prefix": "def",
"body": "#ifndef ${1:${TM_FILENAME_BASE/(.*)/_${1:/upcase}_H/i}} \n#define $1 \n#ifdef __cplusplus\nextern \"C\" {\n#endif\n${2:}\n\n\n#ifdef __cplusplus\n}\n#endif\n#endif\t// $1"
}
@simonliu009
simonliu009 / main.py
Created July 20, 2019 13:11 — forked from cloverstd/main.py
Handle file upload by Tornado and Nginx Upload Module
#!/usr/bin/env python
# encoding: utf-8
import tornado.ioloop
import tornado.web
import tornado.log
import tornado.httpserver
from tornado.options import define, options
import logging
import tornado.gen
@simonliu009
simonliu009 / ESP32_wifi_dns.c
Created July 28, 2019 06:45 — forked from MakerAsia/ESP32_wifi_dns.c
ESP32 (ESP-IDF) WiFi connect and resolve DNS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "lwip/inet.h"
#include "lwip/ip4_addr.h"
#include "lwip/dns.h"