Skip to content

Instantly share code, notes, and snippets.

View jueti's full-sized avatar
🏠
Working from home

Jason Yang jueti

🏠
Working from home
View GitHub Profile
@jueti
jueti / docs.rst
Last active March 23, 2019 11:05
Django config (last update 2018-5-21)
@jueti
jueti / serial_tools.py
Created May 25, 2018 11:42
Tool class to operate serial
import json
from serial.tools.list_ports import comports
class SerialTools:
def __init__(self):
self.info = []
def info(self):
@jueti
jueti / blink.ino
Created May 31, 2018 08:43
Arduino
@jueti
jueti / dec2int.ino
Created May 31, 2018 08:57
Arduino: type convertion, convert a DEC to int
int incomingByte = 0; // for incoming serial data
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
@jueti
jueti / list_subtraction.py
Last active September 16, 2018 08:44
[Snippet - useful class]
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class MyList(list):
def __init__(self, *args):
super(MyList, self).__init__(args)
def __sub__(self, other):
return self.__class__(*[item for item in self if item not in other])
@jueti
jueti / device.py
Last active September 22, 2018 15:57
[Snippet - tool class]
#!/usr/bin/python 3
# -*- coding: utf-8 -*-
"""
`Device` is a tool class to operate serial ports.
"""
import json
import logging
import time
from typing import List, Dict, Tuple
@jueti
jueti / example.bat
Last active December 3, 2018 08:32
[bat get parent folder name] #bat #cmd
@echo off
set "cd_=%cd%"
:loop
set "cd_=%cd_:*\=%"
set "cd_tmp=%cd_:\=%"
if not "%cd_tmp%"=="%cd_%" goto loop
echo "cd_"
@jueti
jueti / default.conf
Created December 4, 2018 01:10
[Docker for Nginx] #docker #nginx
server {
listen 80;
server_name www.jasonyang.xin jasonyang.xin;
return 301 https://www.jasonyang.xin$request_uri;
}
server {
listen 443 ssl http2;
server_name www.jasonyang.xin jasonyang.xin;
@jueti
jueti / default.conf
Last active December 4, 2018 01:54
[Nginx & FRP 共用80端口] 方案一:主域名的站点位于服务器,三级泛域名位于本地 #nginx #frp
server {
listen 80;
server_name www.jasonyang.xin jasonyang.xin;
return 301 https://www.jasonyang.xin$request_uri;
}
server {
listen 443 ssl http2;
server_name www.jasonyang.xin jasonyang.xin;
@jueti
jueti / default.conf
Last active December 4, 2018 02:40
[Nginx & FRP共用80端口] 方案二:主域名和三级泛主域名都位于本地 #nginx #frp
server {
listen 80;
server_name *.frp.jasonyang.xin;
location / {
resolver 114.114.114.114 8.8.8.8;
proxy_pass $scheme://$host:7000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;