Skip to content

Instantly share code, notes, and snippets.

@fernandoc1
fernandoc1 / get_file.php
Last active July 3, 2018 13:38
A way to load files using PHP
<?php
$filepath = $_GET["path"];
$type = mime_content_type($filepath);
header('Content-Type: ' . $type);
echo file_get_contents($filepath);
@fernandoc1
fernandoc1 / CMakeLists.txt
Created July 16, 2018 17:11
Compiling Flir GEV Demo in Ubuntu 16.04. The demo can be found at: http://support.flir.com/SwDownload/app/RssSWDownload.aspx?ID=1250
cmake_minimum_required(VERSION 3.1)
project(GEVDemo)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -g3")
@fernandoc1
fernandoc1 / compile.txt
Created July 17, 2018 21:29
Testing QString::asprintf
g++ test.cpp -I /usr/include/x86_64-linux-gnu/qt5/ -fPIC -lQt5Core
@fernandoc1
fernandoc1 / CMakeLists.txt
Created September 11, 2018 14:10
This is a Baumer API test code.
cmake_minimum_required(VERSION 2.8.3)
include_directories(/usr/local/src/baumer/inc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNULINUX")
link_directories(/usr/local/lib/baumer/)
link_libraries(
bgapi2_genicam
boost_system
@fernandoc1
fernandoc1 / CMakeLists.txt
Created September 12, 2018 18:08
Save JPG image from baumer camera
cmake_minimum_required(VERSION 2.8.3)
include_directories(/usr/local/src/baumer/inc)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNULINUX -g3")
link_directories(
/usr/local/lib/baumer/
${CMAKE_CURRENT_SOURCE_DIR}/src/
)
@fernandoc1
fernandoc1 / anagram.cpp
Created September 29, 2018 14:54
Print all anagrams of a word
#include "iostream"
void printAnagram(std::string str, std::string aux)
{
if(str.size() == 2)
{
std::cout << aux << str[0] << str[1] << std::endl;
std::cout << aux << str[1] << str[0] << std::endl;
return;
}
@fernandoc1
fernandoc1 / socket_client.java
Created October 17, 2018 12:58
This is a socket client example for android
//--> name of the package here
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.OutputStream;
import java.net.InetAddress;
@fernandoc1
fernandoc1 / draw_random_circle.html
Created October 24, 2018 17:53
Draw random dots in a HTML5 canvas.
<html>
<body>
<canvas id="mainCanvas" width="300" height="300"></canvas>
</body>
</html>
<script>
var ctx = document.getElementById("mainCanvas").getContext("2d");
@fernandoc1
fernandoc1 / random_dots_colors.html
Created October 24, 2018 17:58
Code for creating random color dots in HTML5 canvas.
<html>
<body>
<canvas id="mainCanvas" width="300" height="300"></canvas>
</body>
</html>
<script>
var ctx = document.getElementById("mainCanvas").getContext("2d");
@fernandoc1
fernandoc1 / main.cpp
Created January 25, 2019 14:36
QProcess::finished with lambda function example.
#include <QCoreApplication>
#include <QtGlobal>
#include <QDebug>
#include "global_settings.hpp"
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);