Skip to content

Instantly share code, notes, and snippets.

View tuo's full-sized avatar
💭
not coding...

Huang Tuo tuo

💭
not coding...
View GitHub Profile
@tuo
tuo / sim800_http.lua
Last active December 25, 2021 04:02
sim800_http test
---- Create new software UART with baudrate of 9600, D2 as Tx pin and D3 as Rx pin
function writeCMD(s, cmd)
print("\n"..tostring(tmr.now())..": send cmd", cmd);
s:write(cmd.."\n");
end
function sim_setup()
if not s then
print("\n"..tostring(tmr.now())..": initilized su\n");
s = softuart.setup(9600, 2, 3)
@tuo
tuo / MPU6050_angle_calibrate.c
Created October 28, 2021 06:42
MPU6050_angle_calibrate
// source: http://www.brokking.net/imu.html MPU-6050 6dof IMU for auto-leveling multicopters
//Gyro angle calculations
//0.0000611 = 1 / (250Hz / 65.5)
angle_pitch += gyro_x * 0.0000611; //Calculate the traveled pitch angle and add this to the angle_pitch variable
angle_roll += gyro_y * 0.0000611; //Calculate the traveled roll angle and add this to the angle_roll variable
//0.000001066 = 0.0000611 * (3.142(PI) / 180degr) The Arduino sin function is in radians
angle_pitch += angle_roll * sin(gyro_z * 0.000001066); //If the IMU has yawed transfer the roll angle to the pitch angel
angle_roll -= angle_pitch * sin(gyro_z * 0.000001066); //If the IMU has yawed transfer the pitch angle to the roll angel
@tuo
tuo / nodemcu_math.lua
Last active October 28, 2021 06:40
NodeMCU implementation of Math library
-- refer to https://www.esp8266.com/viewtopic.php?p=87536
PI = math.pi;
r360 = 2*PI; -- 2*PI radians equal 360 degrees
r180 = PI;
r90 = PI/2;
function sin(x) -- x in radians
local sign = 1;
if x < 0 then x = -x + r180 end
@tuo
tuo / mpu6050_lua.lua
Last active October 28, 2021 06:40
mpu6050_lua
-- https://invensense.tdk.com/wp-content/uploads/2015/02/MPU-6000-Register-Map1.pdf
id = 0
scl = 7
sda = 6
MPU6050SlaveAddress = 0x68
AccelScaleFactor = 4096; --8g/s
GyroScaleFactor = 65.5; -- ± 500 °/s
@tuo
tuo / PermissionHelper.java
Last active May 6, 2016 12:38
Permission Helper android
package com.reigndesign.falabella_seguros.library;
import android.Manifest;
import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
@tuo
tuo / javascript_resources.md
Created January 21, 2014 02:49 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@tuo
tuo / css_resources.md
Created January 21, 2014 02:49 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@tuo
tuo / python_resources.md
Last active July 19, 2019 09:48 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides