Skip to content

Instantly share code, notes, and snippets.

View carlosb1's full-sized avatar

Carlos B carlosb1

View GitHub Profile
@carlosb1
carlosb1 / error.log
Created November 23, 2013 16:47
Installation Error
nohup nice Labdoo/install/install.sh lbd & tail -f nohup.out &> error1.log
nohup: ignoring input and appending output to ‘nohup.out’
W: Retrying failed download of http://archive.ubuntu.com/ubuntu/pool/main/g/gnupg/gnupg_1.4.11-3ubuntu2_i386.deb
I: Retrieving gnupg 1.4.11-3ubuntu2
I: Validating gnupg 1.4.11-3ubuntu2
W: Retrying failed download of http://archive.ubuntu.com/ubuntu/pool/main/g/gnupg/gnupg_1.4.11-3ubuntu2_i386.deb
I: Retrieving gnupg 1.4.11-3ubuntu2
I: Validating ifupdown 0.7~beta2ubuntu8
I: Retrieving initramfs-tools 0.99ubuntu13
I: Validating gnupg 1.4.11-3ubuntu2
@carlosb1
carlosb1 / kakuro.py
Last active September 4, 2015 23:34
Kakuro solver script
#!/usr/bin/python
import sys
class Cell(object):
def __init__(self,row,col):
self.row = row
self.col = col
def __str__(self):
return "("+str(self.row)+","+str(self.col)+")"
@carlosb1
carlosb1 / threadsafe_queue.h
Created October 15, 2015 17:02
Thread safe queue
#include <queue>
#include <mutex>
#include <condition_variable>
template <typename T> class threadsafe_queue
{
private:
std::mutex mut;
std::queue<T> data_queue;
std::condition_variable data_cond;
#!/bin/sh
find ../libs/armeabi-v7a/* -exec adb push {} /data/local/tmp \;
adb shell LD_LIBRARY_PATH="/data/local/tmp:/vendor/lib:/system/lib" /data/local/tmp/text_extractor_tests
#!/bin/bash
OPENMVG_SFM_BIN="/home/carlos/c-workspace/openMVG_Build/Linux-x86_64-RELEASE"
# Indicate the openMVG camera sensor width directory
CAMERA_SENSOR_WIDTH_DIRECTORY="/home/carlos/c-workspace/openMVG/src/openMVG/exif/sensor_width_database"
CAMERA_SENSORS_FILE="$CAMERA_SENSOR_WIDTH_DIRECTORY/sensor_width_camera_database.txt"
OPENMVG_SFMINIT_IMAGE_LISTING="$OPENMVG_SFM_BIN/openMVG_main_SfMInit_ImageListing"
@carlosb1
carlosb1 / find_words.py
Last active July 9, 2016 09:06
Algorithm which finds possible words from a set of letters. It includes its test
class WordFinder(object):
def __init__(self, dictionary):
self.dictionary = dictionary
"""
Function to find words
"""
def find(self,list_of_letters):
#TODO check words
@carlosb1
carlosb1 / reader_and_writer_problem.cpp
Created July 9, 2016 09:23
Reader and writer problem and its solution in C++
#include <iostream>
#include <atomic>
#include <thread>
#include <chrono>
#include <mutex>
std::atomic_bool finish_reader(false);
std::atomic_bool finish_writer(false);
@carlosb1
carlosb1 / simple_active_object.cpp
Created July 9, 2016 09:38
First version for Active Object pattern
#include "threadsafe_queue2.h"
#include <thread>
#include <iostream>
class Runnable {
public:
virtual void operator()() = 0;
virtual ~Runnable() {};
};
@carlosb1
carlosb1 / serve.py
Created April 22, 2017 22:15
Python server for javascript projects
'''
Taken from:
http://stackoverflow.com/users/1074592/fakerainbrigand
http://stackoverflow.com/questions/15401815/python-simplehttpserver
'''
import SimpleHTTPServer, SocketServer
import urlparse, os
PORT = 3000
@carlosb1
carlosb1 / example_dc_locking.cpp
Created April 24, 2017 21:53
Concurrency exercise for double checked locking
#include <iostream>
class Singleton {
public:
static Singleton *instance (void) {
if (!instance_)
//critical section
instance_ = new Singleton;
return instance_;
}
void method() {