Skip to content

Instantly share code, notes, and snippets.

View fcaylus's full-sized avatar

Fabien Caylus fcaylus

  • 18:22 (UTC +02:00)
View GitHub Profile
@fcaylus
fcaylus / cccc_tbl.patch
Created May 31, 2014 17:33
Fix build error on cccc-3.1.4
--- cccc_tbl.cc 2006-01-05 17:05:30.000000000 +0100
+++ cccc_tbl--diff.cc 2014-05-31 10:44:07.565059727 +0200
@@ -96,7 +96,7 @@
typename map_t::iterator value_iterator=map_t::find(old_item_ptr->key());
if(value_iterator!=map_t::end())
{
- erase(value_iterator);
+ this->erase(value_iterator);
retval=true;
}
@fcaylus
fcaylus / .colors
Created June 1, 2014 08:17
Colors defines in shell.
#
# Colored defines
#
RCol='\e[0m' # Text Reset
# Regular Bold Underline High Intensity BoldHigh Intens Background High Intensity Backgrounds
Bla='\e[0;30m'; BBla='\e[1;30m'; UBla='\e[4;30m'; IBla='\e[0;90m'; BIBla='\e[1;90m'; On_Bla='\e[40m'; On_IBla='\e[0;100m';
Red='\e[0;31m'; BRed='\e[1;31m'; URed='\e[4;31m'; IRed='\e[0;91m'; BIRed='\e[1;91m'; On_Red='\e[41m'; On_IRed='\e[0;101m';
Gre='\e[0;32m'; BGre='\e[1;32m'; UGre='\e[4;32m'; IGre='\e[0;92m'; BIGre='\e[1;92m'; On_Gre='\e[42m'; On_IGre='\e[0;102m';
@fcaylus
fcaylus / build0
Last active August 29, 2015 14:02
Some scripts used to build JustPlug project on a jenkins server (see https://github.com/Toutjuste/JustPlug)
#!/bin/bash
#Execute code metrics
echo -e "Start code metrics tool ..."
cd "$WORKSPACE"
wget -nv https://gist.githubusercontent.com/Toutjuste/a606a0d2079e3df1755b/raw/c4547f90c6a4bf65495421797fae6f6f5548851e/lang-def.cloc
cloc --force-lang-def=lang-def.cloc --by-file --xml --out="cloc.xml" .
# Get xslt conversion table file from gist
wget -nv https://gist.githubusercontent.com/Toutjuste/ebdfd3b839902d20fb78/raw/4106299437b73d68a52b9485913621858d1647b3/cloc2sloccount.xsl
<xsl:stylesheet version="1.0" xmlns:de="." xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" version="4.0" encoding="iso-8859-1"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:template match="file">
<xsl:variable name="file_path" select="translate(@name,'\\','/')"/>
<xsl:variable name="file_path_part1" select="substring-after($file_path,'/')"/>
<xsl:variable name="module" select="substring-before($file_path_part1,'/')"/>
<xsl:value-of select="@code"/>
@fcaylus
fcaylus / centerQWidget
Created June 16, 2014 12:48
QWidget centered
// Put the widget in the center of the screen
QRect qrect = QApplication::desktop()->availableGeometry(this);
move(qrect.center() - rect().center());
#To use the usb WIFI key sagem xg-703a, install this package :
# linux-firmware-nonfree
#On debian, the package name is:
# firmware-linux-nonfree
#On raspberry pi with raspbian (debian arm), do following commands:
sudo aptitude install firmware-linux-nonfree linux-wlan-ng
wget http://daemonizer.de/prism54/prism54-fw/fw-usb/2.13.1.0.lm86.arm --no-check-certificate
@fcaylus
fcaylus / install-qt5-on-pi
Last active August 29, 2015 14:03
Install Qt5 librairie on rpi
#Add this lines in /etc/apt/sources.list
# deb http://twolife.be/raspbian/ wheezy main backports
# deb-src http://twolife.be/raspbian/ wheezy main backports
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 2578B775
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libqt5-* qt5-default libgles2-mesa
@fcaylus
fcaylus / SFML-minimal-code.cpp
Created June 29, 2014 08:40
Code minimal SFML
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
int main(int argc, char** argv)
{
// Création de la fenêtre de rendu
RenderWindow App(sf::VideoMode(800, 600, 32), "Fenetre de tests SFML");
#include <ctime>
std::string GetDate()
{
time_t now = time(NULL);
struct tm * tm = localtime(&now);
char date[64];
strftime(date, sizeof date, "%d-%m-%Y--%H-%M-%S", tm);
#include <QChar>
QChar unaccented(const QChar char)
{
const QString decomp = char.decomposition();
return (decomp.isEmpty()) ? char : decomp.at(0);
}