Skip to content

Instantly share code, notes, and snippets.

View Tomaszal's full-sized avatar

Tomas Zaluckij Tomaszal

  • Freelance Web Developer
  • Edinburgh, United Kingdom
  • 15:13 (UTC +01:00)
View GitHub Profile
@Tomaszal
Tomaszal / HexToDec.h
Created February 25, 2018 13:01
Hexadecimal C string to decimal integer converter function.
#include <assert.h>
int hexToDec(char *hex) {
int dec = 0;
do {
assert((*hex >= '0' && *hex <= '9') || (*hex >= 'A' && *hex <= 'F'));
dec = (dec << 4) | ((*hex - ((*hex >= 'A') ? ('A' - 10) : '0')) & 0xF);
} while (*++hex);
@Tomaszal
Tomaszal / C++.sublime-build
Created February 24, 2018 12:18
Glut build system snippet
"shell_cmd": "g++ $file_name -o ${file_base_name}.bin -lGL -lGLU -lglut && ./${file_base_name}.bin"
@Tomaszal
Tomaszal / C++.sublime-build
Last active November 2, 2017 20:33
My C++ Sublime build system config. Prints results in Sublime's shell. Has an option to capture standard streams (pipes contents of file "in" to stdin & pipes stdout to file "out").
{
"selector": "source.cpp",
"file_patterns": ["*.cpp"],
"working_dir": "$file_path",
"shell": true,
"linux":
{
"shell_cmd": "g++ $file_name -o ${file_base_name}.bin && echo | ./${file_base_name}.bin && echo \n"
},
@Tomaszal
Tomaszal / C.sublime-build
Last active November 2, 2017 17:08
My C Sublime build system config. Prints results in Sublime's shell. Has an option to capture standard streams (pipes contents of file "in" to stdin & pipes stdout to file "out").
{
"selector": "source.c",
"file_patterns": ["*.c"],
"working_dir": "$file_path",
"shell": true,
"linux":
{
"shell_cmd": "gcc $file_name -o ${file_base_name}.bin && echo | ./${file_base_name}.bin && echo \n"
},