Skip to content

Instantly share code, notes, and snippets.

View martin-ueding's full-sized avatar

Martin Ueding martin-ueding

View GitHub Profile
#include "mymath.h"
#include <stdio.h>
int main(){
double t=5;
double *p;
double m;
p=&t;
m=square_to(p);
printf("%f\n%f\n", t, m);
// Copyright © 2017 Martin Ueding <dev@martin-ueding.de>
// Licensed under the MIT license
// Compiled with:
//
// gcc -Wall -Wpedantic -fopenmp strcpy.c -o strcpy -O3 -g
/*
String length: 1,000,000,000
short_strcpy: 0.961368
// Copyright © 2017 Martin Ueding <dev@martin-ueding.de>
// Implementation of the “Game of Life”.
//
// This uses a linearized 2D array with an index function (`idx`).
#include <stdio.h>
#include <stdlib.h>
// For `memset`.
#' Apply and Merge
#'
#' Applies the given function to each row of the data frame. The function is
#' expected to return a data frame itself. The resulting data frames are bound
#' together and joined with the previous data frame.
apply_merge <- function (df, f, cols) {
# We first need to label the rows in the given data frame. We use a column
# name with period as this is an implementation detail.
df$.id <- 1:nrow(df)
@martin-ueding
martin-ueding / fix-plasma-panel.py
Created January 8, 2019 11:33
Script to move Plasma panel to the primary screen
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright © 2019 Martin Ueding <dev@martin-ueding.de>
# Licensed under the MIT/Expat license.
# Based on https://bugs.kde.org/show_bug.cgi?id=356225#c312
import argparse
@martin-ueding
martin-ueding / t_test.py
Created May 3, 2020 15:01
Standard deviation and standard error
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2016 Martin Ueding <mu@martin-ueding.de>
import argparse
import random
import time
import matplotlib.pyplot as pl
#!/bin/bash
# Copyright © 2014, 2016 Martin Ueding <mu@martin-ueding.de>
# Licensed under the MIT license
set -e
set -u
set -x
options="-Wall -Wpedantic -O3 -march=native"
module mycube() {
cube(size = 20, center = true);
};
module myplane(thickness) {
color("black", alpha = 0.1)
rotate([0, 0, 180])
rotate([0, 0, 135])
rotate([-145, 0, 0])
translate([-20, 0, -20])
// Copyright © 2016 Martin Ueding <mu@martin-ueding.de>
// Test the cost of various time implementations.
#include <mpi.h>
#include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2016 Martin Ueding <mu@martin-ueding.de>
import argparse
import re
import subprocess
PATTERN = re.compile(r'Boot([0-9A-F]{4})\*?\s+([^\t]+)\s(\S+)')