Skip to content

Instantly share code, notes, and snippets.

View bertrandmartel's full-sized avatar
💤
👀

Bertrand Martel bertrandmartel

💤
👀
View GitHub Profile
@bertrandmartel
bertrandmartel / convert_hex_to_bytearray.png
Last active August 29, 2015 14:20
[ SHELL - JAVA ] Convert a file to hexadecimal format with xxd command and build a Java formatted static byte array with all these values
convert_hex_to_bytearray.png
@bertrandmartel
bertrandmartel / maven_jar_install.sh
Last active August 29, 2015 14:20
[ MAVEN ] Maven install jar
mvn install:install-file -Dfile=target.jar -DgroupId=fr.company -DartifactId=groupId -Dversion=3.2.3 -Dpackaging=jar
@bertrandmartel
bertrandmartel / nullptr_keyword_qt.sh
Last active August 29, 2015 14:20
[ CPP - QT ] use nullptr keyword in qt makefiles
QMAKE_CXXFLAGS += -std=c++0x
@bertrandmartel
bertrandmartel / shared_lib_qt_makefile.sh
Last active August 29, 2015 14:20
[ CPP - QT ] qt makefile using external library
#library creation makefile:
TARGET = libTest
#test using this library makefile
DEPENDPATH += . ../libTest
INCLUDEPATH += ../libTest
LIBS += -L../libTest -llibTest
@bertrandmartel
bertrandmartel / remove_warning.sh
Last active August 29, 2015 14:20
[ CPP - QT ] remove warning : deprecated conversion from string constant to char*
#in qt makefile
QMAKE_CXXFLAGS = -Wno-write-strings
@bertrandmartel
bertrandmartel / is_numeric.cpp
Last active August 29, 2015 14:20
[ CPP ] find if char * is numeric
#include <cctype>
bool stringutils::isNum(char *s) {
int i = 0, flag;
while(s[i]){
//if there is a letter in a string then string is not a number
if(isalpha(s[i])){
flag = 0;
break;
@bertrandmartel
bertrandmartel / iterate_vector_of_struct.cpp
Last active August 29, 2015 14:20
[ CPP ] iterate through vector of struct
for(std::vector<customStruct>::iterator it = my_vect.begin(); it != my_vect.end(); ++it) {
if (code==(*it).code_value)
return true;
}
@bertrandmartel
bertrandmartel / static_struct_data_storage.cpp
Last active August 29, 2015 14:20
[ CPP ] store static data struct
typedef struct statusCodeStruct
{
int code_value;
std::string code_phrase;
statusCodeStruct(int code_value,std::string code_phrase) :
code_value(code_value), code_phrase(code_phrase){}
} statusCode;
static std::vector<statusCodeStruct> http_status_code_list;
@bertrandmartel
bertrandmartel / find_key_in_mapp_cpp.cpp
Last active August 29, 2015 14:20
[ CPP ] Find a key in a map without inserting value
//##################### CLASSIC MAP ###############################
std::map<std::string,std::string> map;
if (map.find(key)!=map.end()){
//key was found
}
else{
//key not found
}
//#################### POINTER MAP #################################
@bertrandmartel
bertrandmartel / copy_headers.sh
Last active August 29, 2015 14:20
[ SHELL - MAKEFILE ] Copy only headers file in release folder without putting project directory tree inside
rsync -avm --include=*/ --include=*.h --exclude=* project/ project/release
# >ls release
# project_subdir1
# project_subdir2
# project_subdir3
# executable
# for qmake QMAKE_POST_LINK +=$$quote(rsync -avm --include=*/ --include=*.h --exclude=* $${PWD}/ $${PWD}/$${DESTDIR})