Skip to content

Instantly share code, notes, and snippets.

@orbitcowboy
orbitcowboy / gcc_6.3.0_Raspian.txt
Created October 12, 2019 10:26
g++ -dM -E -x c++ - < /dev/null > gcc_6.3.0_Raspian.txt
#define __DBL_MIN_EXP__ (-1021)
#define __HQ_FBIT__ 15
#define __cpp_attributes 200809
#define __UINT_LEAST16_MAX__ 0xffff
#define __ARM_SIZEOF_WCHAR_T 4
#define __ATOMIC_ACQUIRE 2
#define __SFRACT_IBIT__ 0
#define __FLT_MIN__ 1.1754943508222875e-38F
#define __GCC_IEC_559_COMPLEX 2
#define __cpp_aggregate_nsdmi 201304
@orbitcowboy
orbitcowboy / setScreenResoultion.bash
Created November 24, 2018 11:02
A script to set the screen resolution
#!/bin/bash
xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088
1120 -hsync +vsync
xrandr --addmode Virtual1 1920x1080_60.00
xrandr --output Virtual1 --mode 1920x1080_60.00
@orbitcowboy
orbitcowboy / donateCPU.desktop
Last active September 26, 2018 07:56
This starts the Cppchecks donate-cpu.py script at startup
[Desktop Entry]
Name=Autostart-donateCPU
Comment=This starts the Cppchecks donate-cpu.py script at startup
Type=Application
Exec=/usr/pi/cppcheckDonateCPU.bash &
Terminal=false
@orbitcowboy
orbitcowboy / cppcheckDonateCPU.bash
Last active September 12, 2018 06:41
cppcheckDonateCPU.bash for Raspberry Pi
#!/bin/bash
(while true; do
/usr/bin/python ~/cppcheck-donate-cpu-workfolder/cppcheck/tools/donate-cpu.py &> ~/Desktop/log.txt
done) &
//
// RGB to HSV convert sample
//
// see also : http://ja.wikipedia.org/wiki/HSV%E8%89%B2%E7%A9%BA%E9%96%93
//
#include <stdio.h>
#include <math.h>
#define min_f(a, b, c) (fminf(a, fminf(b, c)))
@orbitcowboy
orbitcowboy / runCppcheckOnProjects.sh
Created August 13, 2016 16:07
Run cppcheck on multiple sln files
#!/bin/bash
find . -type f -name '*.sln' -exec readlink -f {} \; | uniq | sed -e 's/^/cppcheck --enable=all --std=posix --library=std,windows --project=/' > /tmp/cppcheck.sh && sh /tmp/cppcheck.sh && rm /tmp/cppcheck.sh
#include <inttypes.h>
#include <iostream>
#include <cstdio>
// def.h
struct INFO {
uint32_t val1;
uint32_t val2;
};
struct INFO_LIST {
@orbitcowboy
orbitcowboy / concat.c
Created June 10, 2015 08:22
How to concatenate two strings in a C macro?
#include <stdio.h>
#define concat0(str1, str2) (str1 " " str2)
#define concat1(str1, str2) (#str1 " " #str2)
int main()
{
printf("%s\n%s\n",
concat0 ("a","b"),
concat1 ("a","b"));
@orbitcowboy
orbitcowboy / .gitignore
Last active August 29, 2015 14:10 — forked from sehe/.gitignore
*.o
a.out
test
.*.swp
*~
*.png
tags
@orbitcowboy
orbitcowboy / generateExpression.cpp
Last active August 29, 2015 14:05
A program to generate test cases for ticket (http://trac.cppcheck.net/ticket/6074)
#include <iostream>
#include <string>
int main()
{
const std::string operand[6] = { "a", "!(a)", "!(!a)", "~(a)", "~(!a)", "!(~a)" };
const std::string op[2] = { "==" , "!=" };
std::cout << "void f(bool a)\n"
"{\n";
for(unsigned int l = 0; l < 6; ++l)