Skip to content

Instantly share code, notes, and snippets.

View jianingy's full-sized avatar
💭
Restoring

Jianing Yang jianingy

💭
Restoring
View GitHub Profile
@jianingy
jianingy / falconkit.py
Last active November 13, 2018 05:44
some handy tools for writing python falcon app
# -*- coding: UTF-8 -*-
# author: jianingy.yang@gmail.com
""" Example:
# -*- coding: UTF-8 -*-
from ..common import patch_io # noqa
from ..common import idol
from ..common.falconkit import create_app
from ..model import database
from . import view
@jianingy
jianingy / bitcoin.md
Created February 11, 2018 03:25
目前的理解

区块链产生的动机

互联网的发展促使人们需要一种电子货币。且电子货币能解决如下问题:

  • 交易安全可靠
  • 有强大的信用背书
  • 不受第三方约束

交易安全可靠

#include <M5Stack.h>
const int PIN_EA = 1;
const int PIN_I1 = 16;
const int PIN_I2 = 17;
const int CHANNEL_EA = 3;
const int PIN_EB = 3;
const int PIN_I3 = 21;
const int PIN_I4 = 22;
@jianingy
jianingy / uuid.php
Created September 3, 2017 08:50
simple 96 bits uuid
<?php
function uuid32() {
return sprintf("%08X", rand(0, pow(2, 32)));
}
function uuid96() {
$uuid = uuid32() . uuid32() . uuid32();
$serial = "";
# client
conn %default
keyexchange=ikev2
authby=secret
conn roadwarrior
type=tunnel
left=192.168.224.186
leftsubnet=192.168.224.186/32[icmp],192.168.224.186/32[gre]
@jianingy
jianingy / remote.yaml
Created June 12, 2017 03:38
A yaml sample for test purpose
---
dependencies:
- hostname && uptime
@jianingy
jianingy / device.rs
Created February 21, 2017 02:01
Read PM5003 PM2.5 Sensor
// Jianing Yang @ 19 Feb, 2017
use chrono::offset::local::Local;
use errors::*;
use errors::ErrorKind::*;
use models::AirQualityRecord;
use serial;
use serial::prelude::*;
use std::io::prelude::*;
use std::time::Duration;
(setq package-archives '(("gnu" . "http://elpa.emacs-china.org/gnu/")
("melpa" . "http://elpa.emacs-china.org/melpa/")))
/*
* filename : background.cpp
* created at : 2016-10-21 11:28:31
* author : Jianing Yang <jianingy.yang@gmail.com>
*/
#include "background.h"
task_t TASKS[10] = {NULL};
@jianingy
jianingy / docker-py-test.py
Created November 24, 2016 06:37
docker-py-test.py
from __future__ import absolute_import, unicode_literals
from docker import Client as DockerClient
from time import sleep
def run_and_output(cli, c, cmd):
exe = cli.exec_create(c['Id'], cmd=cmd, tty=True)
stream = cli.exec_start(exec_id=exe['Id'], stream=True)
i = 0