Skip to content

Instantly share code, notes, and snippets.

@JiapengLi
JiapengLi / test_jekyll.md
Created July 4, 2013 15:37
Test jekyll gist tag

Title

Content.

@JiapengLi
JiapengLi / tmq.c
Created December 24, 2013 04:49 — forked from tanmaykm/tmq.c
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
/**
* related blogpost at: http://sidekick.windforwings.com/2012/05/inter-thread-communication-socketpairs.html
[Dialer Defaults]
Modem = /dev/ttyUSB2
Init1 = ATZ
Init3 = ATE0V1
Init5 = ATS0=0
Init6 = AT+CGDCONT=1,"IP","3gnet"
Init7 = AT+CFUN=1
Modem Type = USB Modem
Baud = 460800
@JiapengLi
JiapengLi / stm32l051-lpwr-test.c
Last active February 10, 2020 00:32
STM32L051C8 Current Consumption Test
#include "stm32l0xx.h"
/*
* Stop mode/LSE/RTC: 1.28uA
* Stop mode without RTC: 0.4uA
**/
//#define RTC_ENABLE
int main(void)
{
31 8D 1A 0B 00 52 75 80 00 FF 09 2B 20 00 00 00
00 3F 00 6F 00 01 00 00 24 21 6D 33 40 72 87 FF
00 32 28 FF 00 00 04 00 02 6C 60 00 0F 50 14 40
00 03 05 27 1C 0A 03 0A 42 12 52 1D 00 AF 00 00
00 00 11 24 2D 00 03 00 04 23 00 09 05 87 32 2B
14 00 00 0F 00 00 00 0F E0 00 0C F9 06 00 5C 78
00 19 0C 4B CC 0D C1 20 04 47 AF 00 1B 00 49 0B
D0 01 16 00 00 00 00 00 00 00 00 00 00 00 00 00

Version

Enjoy OpenWrt Cocktail. Openwrt Histroy

DESIGNATED DRIVER

 _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|

|__| W I R E L E S S F R E E D O M

@JiapengLi
JiapengLi / rtt-kernel-modificaiton-2016-2017.patch
Last active December 13, 2018 09:57
RT-Thread kernel modification from 2016 to 2017 (2015-11-23 ~ 2017-08-25)
diff --git a/include/components.h b/include/components.h
index 4113a869..57c0c026 100644
--- a/include/components.h
+++ b/include/components.h
@@ -63,8 +63,8 @@
#ifdef RT_USING_DFS_YAFFS2
#include <dfs_yaffs2.h>
#endif
-#ifdef RT_USING_DFS_ROMFS
-#include <dfs_romfs.h>
// https://tools.ietf.org/html/rfc4648
// https://en.wikipedia.org/wiki/Base32
const char base32_tab[32] = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
int bin2base32hex(uint8_t *buf, int len, char *base32, bool pad)
{
int i, j, k, cnt = 0;
uint8_t val = 0;
int padnum;
padnum = 8-((len*8+4)/5)%8;
# ubuntu 14.04
sudo apt install -y build-essential libssl-dev zlib1g-dev libpam0g-dev
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-pam
make
sudo make install

Note: don't worry, configuration files under /etc/ssh will not be overwritten .

@JiapengLi
JiapengLi / certbot-systemd-ubuntu.md
Created August 24, 2020 07:35 — forked from dbirks/certbot-systemd-ubuntu.md
Certbot renew with a systemd timer on Ubuntu

Ubuntu 16.04

/etc/systemd/system/certbot.service

[Unit]
Description=Let's Encrypt renewal

[Service]
Type=oneshot
ExecStart=/usr/bin/certbot renew --quiet --agree-tos