Skip to content

Instantly share code, notes, and snippets.

View eduardoaugustojulio's full-sized avatar
🏗️
building

Eduardo Augusto eduardoaugustojulio

🏗️
building
View GitHub Profile
@eduardoaugustojulio
eduardoaugustojulio / binaryserach.c
Last active November 8, 2016 04:20
binary search c
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void * a, const void * b)
{
return (*(int*)a - *(int*)b);
}
int var_list[] = { 50, 20, 60, 40, 10, 30 };
#include <stdio.h>
#include <stdlib.h>
int compare_int(const void * a, const void *b)
{
return ( *(int*)a - *(int*)b );
}
int var_list[] = {3,8,1,4,6,0,88};
@eduardoaugustojulio
eduardoaugustojulio / max6675.c
Last active November 17, 2016 22:03
c lib for max6675 circuit
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "max6675.h"
max6675 device;
void iniciaMAX6675(volatile unsigned char *port, const char so_mask, const char sck_mask, const char cs_mask)
{
@eduardoaugustojulio
eduardoaugustojulio / mcp3201.c
Created November 17, 2016 16:10
c lib for mcp3201 circuit
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mcp3201.h"
mcp3201 device;
void iniciaMCP2301 (volatile unsigned char* port, const char dout_mask, const char clk_mask, const char cs_mask)
{
@eduardoaugustojulio
eduardoaugustojulio / apache_creator.sh
Created November 28, 2016 12:55
apache virtual host creator
#!/bin/bash
# Este programa cria uma virtual host e sua pagina de apresentação
# OBS: OS HOSTS CRIADOS TERAO NOME FINAL .COM.BR
# Utilizicao
# sudo ./apache_creator.sh app porta 8383
# ou
# sudo ./apache_creator.sh
www=/var/www/html/
@eduardoaugustojulio
eduardoaugustojulio / apache_creator.py
Created November 28, 2016 13:38
apache virtual host creator
#!/usr/bin/python
# Este programa cria uma virtual host e sua pagina de apresentação
# OBS: OS HOSTS CRIADOS TERAO NOME FINAL .COM.BR
# Utilizacao
# python create_virtual_host.py app_name porta 8080
# ou
# python create_virtual_host.py
import sys
@eduardoaugustojulio
eduardoaugustojulio / fusiontables.py
Created April 10, 2017 10:17
Makes a google api connection using oauth2 and query select from fusiontables
import simplejson as json
import webbrowser
import httplib2
from apiclient import discovery
from oauth2client import client
from apiclient.discovery import build
from apiclient.discovery import build
@eduardoaugustojulio
eduardoaugustojulio / main.cpp
Last active February 6, 2020 14:18
Comparison of implementation of get timestamp in microsecond C between C ++11.
/*This gist only compare C way to get a timestamp clock_monotonic against C++11 way.*/
#include <iostream>
#include <time.h>
#include <chrono>
#include <ctime>
void get_clock_time_us_time_h(unsigned long &val){
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
@eduardoaugustojulio
eduardoaugustojulio / CMakeLists.txt
Created August 1, 2017 01:13
cmake template with c++11 and boost support
cmake_minimum_required(VERSION 2.8)
project(project CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(Boost 1.40.0 COMPONENTS filesystem system REQUIRED)
file(GLOB SOURCE_FILES src/*.cpp)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
@eduardoaugustojulio
eduardoaugustojulio / main.cpp
Last active April 14, 2021 20:46
C++ class that publish a service with message in the network using avahi msdn library.
#include <iostream>
#include <vector>
#include "publisher.h"
int main(const int argc, const char **argv)
{
std::vector<std::string> message;
for(auto i = 0; i < 10; i++)
message.push_back("test message " + std::to_string(i));