Skip to content

Instantly share code, notes, and snippets.

@paulocanedo
paulocanedo / .config
Created November 12, 2021 12:29
MY custom config for openwrt with nanopi r4s
#
# MY custom config for openwrt with nanopi r4s
# Automatically generated file; DO NOT EDIT.
# OpenWrt Configuration
#
CONFIG_MODULES=y
CONFIG_HAVE_DOT_CONFIG=y
CONFIG_HOST_OS_LINUX=y
# CONFIG_HOST_OS_MACOS is not set
# CONFIG_TARGET_sunxi is not set
#!/bin/sh
#script para testar conectividade com internet, caso não tenha internet reinicia o sistema
tempo_timeout=3
tempo_espera_entre_ping=3
ip_avaliacao=8.8.8.200
while :
do
@paulocanedo
paulocanedo / update_date_time_onvif_cam.js
Created May 23, 2020 01:37
update date and time of a onvif cam
// update date and time of a onvif cam
const onvif = require('onvif');
const Cam = onvif.Cam;
onvif.Discovery.on('device', (cam) => {
new Cam(cam, function (err) {
if (err) {
console.error('Connection Failed for ', err);
return;
<?php
echo '<pre>';
var_dump(getallheaders());
@paulocanedo
paulocanedo / temperatura_humidade_hora-ntp.ino
Created September 11, 2019 00:43
Projeto Arduino: Temperatura, humidade (DHT22), horario NTP, LED 7SEG TM1637
# O que fazer para melhorar a eficiência energética?
# projeto: https://ibb.co/D9sMqyf
#include <NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <Arduino.h>
#include <TM1637Display.h>
#include "app.hpp"
#include "include/mapbox/earcut.hpp"
#include "include/delfrrr/delaunator.hpp"
#include "engine/text/Glyph.hpp"
GLenum glCheckError_(const char *file, int line)
{
GLenum errorCode;
while ((errorCode = glGetError()) != GL_NO_ERROR)
{
@paulocanedo
paulocanedo / freetype_test.cpp
Created April 12, 2019 21:13
freetype opengl
#include "app.hpp"
#include "include/mapbox/earcut.hpp"
#define BEZIER_STEP 0.01f
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
void processInput(GLFWwindow *window);
// settings
const unsigned int SCR_WIDTH = 800;
@paulocanedo
paulocanedo / reinterpret_cast.cpp
Created April 11, 2019 13:34
reinterpret_cast.cpp
using Point = std::array<float, 2>;
int main()
{
Point a = {1.1f, 2.1f};
Point b = {1.5f, 2.5f};
Point c = {5.5f, 3.5f};
Point d = {4.5f, 1.5f};
std::vector<Point> polygon;
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
export PATH=$PATH:/home/paulocanedo/apps/jdk-8u201-linux-x64/jdk1.8.0_201/bin
export PATH=$PATH:/home/paulocanedo/apps/gradle-5.1.1-bin/gradle-5.1.1/bin
export JAVA_HOME=/home/paulocanedo/apps/jdk-8u201-linux-x64/jdk1.8.0_201
export ANDROID_HOME=/home/paulocanedo/Android/Sdk
@paulocanedo
paulocanedo / validar_cpf.js
Last active March 22, 2019 12:15
função em JS para validar CPF
function calcularDigitoVerificador(numero) {
const mod11 = (value) => `${value}`
.split('')
.map(elem => Number.parseInt(elem))
.reduce((sum, elem, index) => sum + elem * (index + 1)) % 11;
let dv1 = mod11(numero.substring(0, 9));
dv1 = dv1 >= 10 ? 0 : dv1;
let dv2 = mod11(`${numero.substring(1, 9)}${dv1}`)
dv2 = dv2 >= 10 ? 0 : dv2;