Skip to content

Instantly share code, notes, and snippets.

@giupo
giupo / ProgrammersOath.rst
Created August 24, 2017 10:05
Programmer's Oath

Programming Oath

  1. I will not produce harmful code.
  2. The code that I produce will always be my best work. I will not knowingly allow code that is defective either in behavior or structure to accumulate.
  3. I will produce, with each release, a quick, sure, and repeatable proof that every element of the code works as it should.
#!/usr/bin/env bash
PREFIX=`pwd`/repec
export CFLAGS="-I${PREFIX}/include"
export CXXFLAGS="-I${PREFIX}/include"
NCPU=`grep -c ^processor /proc/cpuinfo`
if [ ! -d "$(pwd)/pcre-8.4.1" ]; then
@giupo
giupo / init.el
Created March 19, 2018 13:45
Emacs config
;; Added by Package.el. This must come before configurations of
;; installed packages. Don't delete this line. If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)
(server-start)
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
@giupo
giupo / test.r
Created April 9, 2018 07:13
Test script for R
message("Hello World!")
@giupo
giupo / ripristino.r
Created July 5, 2018 20:52
ripristinoGrafo
require(rcf)
elimina("cf10")
con = pgConnect()
GrafoDB:::.copyGraph(from="cf10p2674", to="cf10", con=con)
@giupo
giupo / snippet.cpp
Last active April 30, 2019 09:19
Texture da BMS
include <Windows.h>
HANDLE textureDataMemHandle = NULL;
long* textureData = NULL;
do {
textureDataMemHandle = OpenFileMapping(FILE_MAP_ALL_ACCESS, TRUE,
TEXT("FalconTexturesSharedMemoryArea"));
if (!textureDataMemHandle) {
std::cout << "Unable to open file. Is Falcon Running?\n";
} else {
@giupo
giupo / bmstest.cpp
Last active May 15, 2019 17:08
Smashing my head on FalconTexturesSharedMemoryArea
#include <iostream>
#include <Windows.h>
#include "SFML/Graphics.hpp"
#include "dds.hpp"
#define FALCON_TEXTURE_SHM "FalconTexturesSharedMemoryArea"
int main(int argc, char** argv) {
@giupo
giupo / dds.hpp
Created November 15, 2019 08:08
DDS
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
// This header defines constants and structures that are useful when parsing
// DDS files. DDS files were originally designed to use several structures
#include <Arduino.h>
#include <U8g2lib.h> // lib ext
#include <SPI.h>
#include <Wire.h>
#include "FalconDED_full.h" // fornito ad-hoc
//Function | Nano Pin | OLED Pin
//---------+----------+----------
/*
Fontname: -FreeType-FalconDED-Medium-R-Normal--17-120-100-100-P-71-ISO10646-1
Copyright: Copyright uri_ba 2014
Capital A Height: 9, '1' Height: 9
Calculated Max Values w= 9 h=11 x= 3 y= 5 dx= 9 dy= 0 ascent=10 len=22
Font Bounding box w= 9 h=11 x= 0 y=-1
Calculated Min Values x= 0 y=-1 dx= 0 dy= 0
Pure Font ascent = 9 descent=-1
X Font ascent = 9 descent=-1
Max Font ascent =10 descent=-1