Skip to content

Instantly share code, notes, and snippets.

View malja's full-sized avatar

Jan Malčák malja

View GitHub Profile
@malja
malja / configuration.txt
Created September 21, 2021 08:54
Eclipse CDT 2021-09 installation configuration
*** Date: Tuesday, September 21, 2021 at 10:53:43 AM Central European Summer Time
*** Platform Details:
*** System properties:
applicationXMI=org.eclipse.ui.workbench/LegacyIDE.e4xmi
ds.delayed.keepInstances=true
ds.delayed.keepInstances.default=true
eclipse.application=org.eclipse.ui.ide.workbench
eclipse.buildId=4.21.0.I20210906-0500
@malja
malja / i2c_master.c
Last active September 2, 2021 12:18
MSP430FR50431 I2C master with interruptions
#include <i2c_master.h>
// BIT_SET is macro for REGISTER |= (BIT)
// BIT_CLEAR is macro for REGISTER &= ~(BIT)
//
#include <macros.h>
#include <driverlib.h>
#include <config.h>
#include <string.h>
#include <clock.h>
@malja
malja / README.md
Last active May 12, 2023 09:03
MSP430FR50431 millis() implementation

Implementation of millis() function froom Arduino on MSP430FR50431 processor

This gits implements function millis() known from Arduino ecosystem. What it does is that it counts number of milliseconds since the program started. It uses timer TA3, set to UP mode with custom TA3CCR0 value.

When user runs function millis(), it returns value from the counter.

Timer TA3

This timer is set to UP mode. It means that the timer counts up to the value stored in TA3CCR0 register.

@malja
malja / runtime.php
Created September 6, 2018 07:03
PHP class for measuring function execution time
<?php
/***********************************************************************\
|
| RunTime Class
| =============
| Class to measuring the execution time of function or method.
|
| Author: malja <github.com/malja>
| Version: 1.0
| Created: 26. 8. 2013
@malja
malja / minercraft_server_status.php
Created September 5, 2018 20:04
PHP class for getting minecraft server status - number of players, MOTD, version and ping
<?php
class ServerStatus {
/*private $motd;
private $address;
private $ip;
private $port;
private $version;
private $players;
private $max_players;
@malja
malja / style.css
Created September 5, 2018 19:38
PHP class for creating pretty HTML table from PHP array
/************************************************************************\
|
| CSS Theme
| =========
|
| This is a default CSS theme for tabletizer class.
|
\************************************************************************/
table.tabletizer {
@malja
malja / sdl2_screenshot.cpp
Last active April 11, 2024 08:51
Create screenshot in SDL2
// Save screenshot
// file: Filename for created screenshot
// renderer: pointer to SDL_Renderer
bool saveScreenshot(const std::string &file, SDL_Renderer *renderer ) {
// Used temporary variables
SDL_Rect _viewport;
SDL_Surface *_surface = NULL;
// Get viewport size
SDL_RenderGetViewport( renderer, &_viewport);
@malja
malja / file_exists_access.cpp
Last active May 28, 2018 20:27
Three methods for checking if file exists in C++.
#include <string>
#include <unistd.h>
// Funkce bere za parametr jméno souboru
bool fileExists(const std::string &file_name) {
// Pokud soubor existuje
if ( access( file_name.c_str(), F_OK ) != -1 ) {
// Vrátí true
return true;
// V opačném případě
@malja
malja / 2d_graph.py
Created January 3, 2018 13:23
PPS test grafy
import matplotlib.pyplot as plt
ekg_data = []
fpg_data = []
with open("./zadani/ekg.txt") as file:
for line in file:
ekg_data.append( float(line.replace("\n", "").replace("o", "0").replace(",", ".")) )
with open("./zadani/fpg.txt") as file:
@malja
malja / default.css
Created January 3, 2018 11:56
PPS test HTML část
body {
/* Nutné kvůli height 100vh*/
display: flex;
flex-direction: column;
/* Asi nepotřebné */
width: 100%;
/* Margin je na main */
margin: 0px;