Skip to content

Instantly share code, notes, and snippets.

Avatar

Hello World mcxiaoke

  • Earth
View GitHub Profile
@mcxiaoke
mcxiaoke / ecspos.py
Created Mar 2, 2020
escpos printer demo for btp-n58ii
View ecspos.py
# coding: utf-8
from escpos import printer
from PIL import Image
Epson = printer.Usb(0x154f, 0x154f, 0, out_ep=0x02)
Epson.codepage='gbk'
Epson.set(align='center')
# Print text
Epson.text(u"这是一只大熊猫")
#Epson.codepage=None
@mcxiaoke
mcxiaoke / intro.md
Created Dec 19, 2019
Phicomm N1 dtb file for Linux n1 5.3.0-aml-g12
View intro.md
View Installing_linux_on_Baytrail_tablet.md

Hardware specs

Chinese Brand "ITworks" , Model TW891, distributed in France and Belgium by Darty

  • CPU: Intel(R) Atom(TM) CPU Z3735F @ 1.33GHz
  • Video: Intel® HD Graphics for Intel Atom® Processor Z3700 Series
  • Screen: 1280x800
  • WiFi + BT: Realtek RTL8723BS_BT
  • Disks: mmcblk1: mmc1:0001 DF4032 29.1 GiB
  • RAM: 2GB DDR3 @ 1333 MHz
@mcxiaoke
mcxiaoke / arduino-esp8266-esp32-wifi.json
Last active Dec 2, 2019
arduino esp8266 esp32 setup wifi code snippet
View arduino-esp8266-esp32-wifi.json
"espwifi": {
"scope": "cpp",
"prefix": "espwifi",
"body": [
"#include <Arduino.h>",
"#if defined(ESP8266)",
"#include <ESP8266WiFi.h>",
"#elif defined(ESP32)",
"#include <WiFi.h>",
"#endif",
View make_vector.hpp
// make_vector.hpp
//
// Copyright (c) 2019 Tristan Brindle (tcbrindle at gmail dot com)
// Distributed under the Boost Software License, Version 1.0. (See
// http://www.boost.org/LICENSE_1_0.txt)
#include <type_traits>
#include <vector>
namespace tcb {
@mcxiaoke
mcxiaoke / monitor.py
Created Nov 22, 2019
pump mqtt monitor
View monitor.py
from datetime import datetime
import time
import logging
import requests
import re
import paho.mqtt.client as mqtt
from config import *
MSG_LIMIT_PER_MIN = 20
MSG_LIMIT_PER_HOUR = 40
@mcxiaoke
mcxiaoke / networkmanager-wifi-powersave.md
Created Nov 20, 2019 — forked from jcberthon/networkmanager-wifi-powersave.md
NetworkManager Wi-Fi powersaving configuration
View networkmanager-wifi-powersave.md

NetworkManager WiFi Power Saving

NetworkManager supports WiFi powersaving but the function is rather undocumented.

From the source code: wifi.powersave can have the following value:

  • NM_SETTING_WIRELESS_POWERSAVE_DEFAULT (0): use the default value
  • NM_SETTING_WIRELESS_POWERSAVE_IGNORE (1): don't touch existing setting
  • NM_SETTING_WIRELESS_POWERSAVE_DISABLE (2): disable powersave
View Orange Pi Zero - WiFi setup
sudo cp /etc/network/interfaces /etc/network/interfacesoriginal
sudp rm /etc/network/interfaces
sudo nano /etc/network/interfaces
----------------------------------
COPY
----------------------------------
auto lo
iface lo inet loopback
auto eth0
@mcxiaoke
mcxiaoke / cli.md
Created Oct 28, 2019 — forked from phrawzty/2serv.py
simple http server to dump request headers
View cli.md
$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python serv.py
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah
@mcxiaoke
mcxiaoke / terminal-git-branch-name.md
Created Oct 18, 2019 — forked from joseluisq/terminal-git-branch-name.md
Add Git Branch Name to Terminal Prompt (Mac)
View terminal-git-branch-name.md

Add Git Branch Name to Terminal Prompt (Mac)

image

Open ~/.bash_profile in your favorite editor and add the following content to the bottom.

# Git branch in prompt.

parse_git_branch() {
You can’t perform that action at this time.