Skip to content

Instantly share code, notes, and snippets.

@larryli
larryli / ntc.h
Created March 26, 2024 01:33
NTC 100K
#include <math.h>
/**
* 3v3 --- [10K] -+- [NTC] --- GND
* |
* +-- ADC
*/
#define NTC_V 3300
#define NTC_R_PULLUP 10000
#define NTC_R(v) (NTC_R_PULLUP * (v) / (NTC_V - (v)))
@larryli
larryli / Vagrantfile
Last active April 28, 2019 09:36
ESP-IDF Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
class VagrantPlugins::ProviderVirtualBox::Config < Vagrant.plugin("2", :config)
def update_customizations(customizations)
@customizations = customizations
end
end
class VagrantPlugins::ProviderVirtualBox::Action::Customize
@larryli
larryli / .profile
Created December 27, 2018 03:13
set zh LANG for ssh
#!/bin/bash
if tty | fgrep -q pts ; then
export LANG=zh_CN.UTF-8
fi
@larryli
larryli / openpgp.txt
Created September 7, 2018 10:01
OpenKeychain 关联用户标识
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:b4448800f2129cd9e136bfffb64fdf3b2d8b022c]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@larryli
larryli / .gitlab-ci.yml
Created May 17, 2018 09:39
Gitlab CI build for go project
stages:
- build
compile:
stage: build
script:
- go build -ldflags "-s -w -X main.Version=$CI_COMMIT_TAG"
artifacts:
name: "$CI_PROJECT_NAME-$CI_COMMIT_TAG"
paths:
@larryli
larryli / buttons.go
Last active August 16, 2017 08:53
Orange Pi Zero TTP224
package main
import (
"fmt"
"github.com/davecheney/gpio"
"os"
"os/signal"
"time"
)
@larryli
larryli / trans_china_districts.php
Last active December 8, 2016 10:48
转换 http://www.mca.gov.cn/article/sj/tjbz/a/ 的文本数据为 PHP 数据和 SQL
<?php
$directly = ['11', '12', '31', '50', '81', '82'];
$names = [
'拉祜族佤族布朗族傣族自治县', '保安族东乡族撒拉族自治县', '彝族哈尼族拉祜族自治县', '傣族拉祜族佤族自治县',
'哈尼族彝族傣族自治县', '彝族回族苗族自治县', '布依族苗族自治县', '布依族苗族自治州', '白族普米族自治县',
'苗族瑶族傣族自治县', '傣族景颇族自治州', '独龙族怒族自治县', '哈尼族彝族自治县', '哈尼族彝族自治县', '哈尼族彝族自治州',
'满族蒙古族自治县', '蒙古族藏族自治州', '苗族布依族自治县', '苗族土家族自治县', '土家族苗族自治县', '壮族苗族自治州',
'土家族苗族自治州', '仡佬族苗族自治县', '藏族羌族自治州', '傣族佤族自治县', '傣族彝族自治县', '哈萨克族自治县',
'回族土族自治县', '回族彝族自治县', '柯尔克孜自治州', '黎族苗族自治县', '苗族侗族自治县', '苗族侗族自治州',
@larryli
larryli / GIT_SSH_COMMAND.sh
Last active January 21, 2021 20:35
Git ssh socks proxy
#!/bin/sh
export GIT_SSH_COMMAND='ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
git config --global core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
git clone -c=core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"' git@github.com:larryli/ipv4.git
git config core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
@larryli
larryli / dnsmasq-gfwlist.py
Created April 23, 2016 08:23
自动更新 dnsmasq gfwlist 规则
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq rules with ipset for gfwlist
#
# Copyright (C) 2014 http://www.shuyz.com
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
import urllib2
import re