Skip to content

Instantly share code, notes, and snippets.

View lopesivan's full-sized avatar
🚧
Working from home

Mr. Ivan lopesivan

🚧
Working from home
View GitHub Profile
@lopesivan
lopesivan / uart.cpp
Created October 16, 2017 13:26 — forked from tokolist/uart.cpp
Simple AVR UART library
#include "uart.h"
#include <avr/io.h>
unsigned int uart_calc_ubrr(unsigned long fosc, unsigned long baud)
{
unsigned int ubrr;
unsigned long div, rem;
div = 16 * baud;
rem = fosc / div;
@lopesivan
lopesivan / gist:0416d5df687e084fdc9a1b9ec84c4fb8
Created October 16, 2017 13:25 — forked from tokolist/gist:ad8e00d3b65e6c978b01
Hardware Interrupt and Seven-segment LED Digit Display Controlling Using an AVR Microcontroller http://youtu.be/XkO-7eyUWf8
#define F_CPU 16000000 //16MHz
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdlib.h>
typedef struct {
volatile uint8_t *port;
@lopesivan
lopesivan / gist:6b26412f0c674ca029cf469aff577a75
Created October 16, 2017 13:22 — forked from tokolist/gist:8319281
Use an AVR Microcontroller and Potentiometer to Control a Servo (ADC and PWM) http://youtu.be/vNwx_W2daJs
#define F_CPU 16000000 //16MHz
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h>
#include <stdlib.h>
//#include <stdio.h>
//#include "uart/uart.h"
@lopesivan
lopesivan / adc_example.c
Created October 16, 2017 13:17 — forked from Wollw/adc_example.c
ATmega328P ADC conversion example
/* A simple ADC example that checks the analog reading on ADC0 and turns
* an LED on if the reading is higher than a threshold value and turns if
* off if it is under that value. */
#include <avr/io.h>
#include <stdint.h>
/* Which analog pin we want to read from. The pins are labeled "ADC0"
* "ADC1" etc on the pinout in the data sheet. In this case ADC_PIN
* being 0 means we want to use ADC0. On the ATmega328P this is also
* the same as pin PC0 */
#include <iostream>
#include <iomanip>
#include <random>
int main(int argc, char* argv[])
{
const double REAL_PI = 3.14159265359;
std::random_device device;
std::mt19937 gen(device());
@lopesivan
lopesivan / AndroidManifext.xml
Created May 27, 2017 16:39 — forked from komamitsu/AndroidManifext.xml
Android Simple web server using NanoHTTPD (http://elonen.iki.fi/code/nanohttpd)
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
@lopesivan
lopesivan / build_curl.md
Created May 12, 2017 23:39 — forked from bertrandmartel/build_curl.md
Build Curl for Android NDK

Build libcurl for android NDK

Libcurl requires openssl and zlib to be fully operationnal

  • Step 1 : cross compile zlib
  • Step 2 : cross compile openssl
  • Step 3 : cross compile curl with zlib/openssl external link

Prerequisites :

@lopesivan
lopesivan / openssl.ssh
Created May 2, 2017 23:00 — forked from mbejda/openssl.ssh
Installing OpenSSL 1.0.2 on Ubuntu 14
openssl version -a
sudo add-apt-repository ppa:0k53d-karl-f830m/openssl
sudo apt-get update
sudo apt-get install openssl
openssl version -a
chef-server-ctl stop
chef-server-ctl kill
chef-server-ctl cleanse
chef-server-ctl uninstall
pkill -9 -u opscode
pkill -9 -f postgres
pkill -9 -f beam
pkill -9 -f /opt/chef
rm -rf /etc/opscode /etc/chef /opt/opscode /opt/chef /var/chef
rm -rf /etc/chef-server /etc/chef /opt/chef-server /opt/chef /root/.chef /var/opt/chef-server

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname