Skip to content

Instantly share code, notes, and snippets.

View RadiatedMonkey's full-sized avatar
🐳

Ruben Adema RadiatedMonkey

🐳
  • University of Groningen
  • Netherlands
  • 05:13 (UTC +01:00)
View GitHub Profile
pub struct ExtensionMeta {
name: &'static str,
version: [u8; 4]
}
macro_rules! metadata {
($metadata: ident) => {
// Make sure that the given variable is of type ExtensionMeta
const __PYRO_METADATA: ExtensionMeta = $metadata;
@RadiatedMonkey
RadiatedMonkey / JsonParser.hs
Last active October 3, 2022 22:30
JSON file parser
import Control.Monad (void)
import Data.Map (Map, (!))
import qualified Data.Map as Map (fromList)
import Text.ParserCombinators.Parsec
import Text.Parsec.Error (messageString, errorMessages)
import Text.Parsec.Token
import Text.Parsec.Language
import Text.Read (readEither)
import System.Environment (getArgs)
import System.IO (readFile)
@RadiatedMonkey
RadiatedMonkey / CsvParser.hs
Created October 2, 2022 14:54
Simple parser for CSV files,
import Control.Monad
import Text.ParserCombinators.Parsec
import System.Environment
import System.IO
infixr 5 !:
(!:) :: [[a]] -> (Int, Int) -> a
a !: (x, y) = a !! x !! y
normalValue :: Parser String
    void SubchunkBE::DeserializeBlocksAVX2(ByteStream& stream, int word_count,
        int bits_per_block, int block_count) noexcept
    {
        const int all_ones = 0xFFFFFFFF;
        int lower_zeros = all_ones << bits_per_block;
        int lower_ones = ~lower_zeros;
        __m256i _vec_shift = _mm256_set1_epi32(bits_per_block);
        __m256i _vec_lower_ones = _mm256_set1_epi32(lower_ones);
function(add_filepath_macro target)
get_target_property(SOURCE_FILES ${target} SOURCES)
foreach(FILE_PATH IN LISTS SOURCE_FILES)
file(RELATIVE_PATH RELATIVE_FILE_PATH ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_PATH})
set_property(SOURCE ${FILE_PATH} APPEND PROPERTY COMPILE_DEFINITIONS FILEPATH="${RELATIVE_FILE_PATH}")
endforeach()
endfunction()
add_filepath_macro(phoenix)
@RadiatedMonkey
RadiatedMonkey / sudoku.lua
Created July 21, 2020 19:39
A sudoku app for the TI-Nspire™ CX II T calculator (probably works on others too)
platform.apiLevel = '2.4'
BOX9_WIDTH = platform.window:width() / 3
BOX9_HEIGHT = platform.window:height() / 3
BOX_WIDTH = platform.window:width() / 9
BOX_HEIGHT = platform.window:height() / 9
answers = {}
selected = {0, 0}
is_in_menu = true
@RadiatedMonkey
RadiatedMonkey / vector.c
Created July 19, 2020 15:56
A vector implementation in C
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
struct vector {
int* data;
size_t allocsize;
size_t size;
};
@RadiatedMonkey
RadiatedMonkey / linked_list.c
Last active July 19, 2020 15:42
A linked list implementation in C
#include <stdio.h>
#include <stdlib.h>
struct node {
struct node* next;
int data;
};
struct list {
struct node* head;
@RadiatedMonkey
RadiatedMonkey / hello_world.bf
Created June 21, 2020 14:06
Hello world in Brainf*ck
>+++++++++[->++++++++[-<<+>>]<]<.>+++++++[->++++[-<<+>>]<]<+.+++++++..+++.>++++++++++[->++++++++[-<<->>]<]<+.>+++++++++++[->+++++[-<<+>>]<]<.>++++++++[->+++[-<<+>>]<]<.+++.------.--------.>++++++++[->++++++++[-<<+>>]<]<---.