Skip to content

Instantly share code, notes, and snippets.

View lixingcong's full-sized avatar
😂
Face With Tears of Joy...

Lixingcong lixingcong

😂
Face With Tears of Joy...
View GitHub Profile
@lixingcong
lixingcong / demo_2.1.py
Last active November 19, 2016 06:09
《统计学习方法》例2.1
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Time-stamp: < 1.py 2016-11-19 14:09:19 >
"""
对应《统计学习方法》李航课本的第2章“感知机”的例题2.1
"""
import os
# An example in that book, the training set and parameters' sizes are fixed
@lixingcong
lixingcong / AndroidManifest.xml
Last active December 3, 2016 09:08
Android M ask for permission
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="li.grain2">
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
@lixingcong
lixingcong / 000-patch.diff
Created March 1, 2017 06:50
gcc-arm-none-eabi on windows
diff --git a/Makefile b/Makefile
index cd97f5b..128ed69 100644
--- a/Makefile
+++ b/Makefile
@@ -3,22 +3,22 @@
include Makefile.common
LDFLAGS=$(COMMONFLAGS) -fno-exceptions -ffunction-sections -fdata-sections -L$(LIBDIR) -nostartfiles -Wl,--gc-sections,-Tlinker.ld
LDFLAGS_USE_NEWLIB=--specs=nano.specs -lc -lnosys
-LDLIBS+=-lstm32
+LDLIBS+="libs\libstm32.a"
@lixingcong
lixingcong / 1.txt
Created March 5, 2017 09:34
一加3:实体返回键互换
vi /system/usr/keylayout/synaptics.kl
CM14.0 中默认的值为
key 580 APP_SWITCH VIRTUAL
key 158 BACK VIRTUAL
以上即为默认值,Back---Home---App布局
@lixingcong
lixingcong / README.md
Last active March 5, 2017 09:49
Twidere_twitter_api

How to use

  1. Copy one of the consumer key pairs to Twidere - Settings - Network - Advanced - Default API Settings
  2. Remove account from Twidere (or just skip this step)
  3. Re-login. It's OK to see "You've already logged in" message.
@lixingcong
lixingcong / 1.js
Created March 8, 2017 05:55
html续秒js脚本
var _click_count=0;
$("body").bind("click",function(e){
//var n=Math.round(Math.random()*100);//随机数
var $i=$("<b>").text("+"+(++_click_count));
var x=e.pageX,y=e.pageY;
$i.css({
"z-index":99999,
"top":y-15,
"left":x,
@lixingcong
lixingcong / demo.c
Last active March 23, 2017 02:58
读取结构体C
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#define is_char_num(c) ((c>='0')&&(c<='9'))
/*
* brief: 从字符串取出数字
* 注意str字符串结束符要有NULL否则指针越界
* param: str 字符串指针
@lixingcong
lixingcong / quote.py
Created April 18, 2017 17:07
将当前文件名转义空格或者中文
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
usage:
find /var/www/downloads > /tmp/1.txt
python this_script.py /tmp/1.txt
"""
import urllib
import sys
@lixingcong
lixingcong / color_bash_demo.sh
Last active April 18, 2017 17:12
color_bash_"PS1"
#!/bin/bash
useage() {
printf "\n\e[1;4mAscii Escape Code Helper Utility\e[m\n\n"
printf " \e[1mUseage:\e[m colors.sh [-|-b|-f|-bq|-fq|-?|?] [start] [end] [step]\n\n"
printf "The values for the first parameter may be one of the following:\n\n"
printf " \e[1m-\e[m Will result in the default output.\n"
printf " \e[1m-b\e[m This will display the 8 color version of this chart.\n"
printf " \e[1m-f\e[m This will display the 256 color version of this chart using foreground colors.\n"
printf " \e[1m-q\e[m This will display the 256 color version of this chart without the extra text.\n"
@lixingcong
lixingcong / style_c.conf
Last active August 9, 2017 09:49
Artistic Style config files
# Usage:
# AStyle.exe --options=style.conf demo.cpp
# Language: C/C++
# base style
--style=k&r
#--style=allman
# max length of a line