Skip to content

Instantly share code, notes, and snippets.

View martin-ueding's full-sized avatar

Martin Ueding martin-ueding

View GitHub Profile
@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
@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
#' 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)
// 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`.
// 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
#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);
#!/bin/bash
# Copyright © 2016 Martin Ueding <dev@martin-ueding.de>
set -e
set -u
set -x
width=2480
half_height=$(( 3508 / 2 ))
@martin-ueding
martin-ueding / texlive-doc.py
Last active November 6, 2015 21:28
Install TeXLive documentation on Fedora 22
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright © 2015 Martin Ueding <dev@martin-ueding.de>
# Licensed under The MIT License
'''
Installs documentation packages for all installed TeXLive packages on Fedora
22.
@martin-ueding
martin-ueding / gist:a2b79b500c91e590de5e
Last active August 29, 2015 14:22
File descriptor leak test
// Copyright © 2015 Martin Ueding <dev@martin-ueding.de>
// Try to leak as many file descriptors until the program crashes.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
char filename[100];
mu@fedora-22-beta:~ SSH 17.8s su 2015-05-25 17:06:46
Passwort:
[root@fedora-22-beta mu]# dnf install rubygem-rails
Last metadata expiration check performed 0:00:00 ago on Mon May 25 17:07:37 2015.
Abhängigkeiten sind aufgelöst.
===============================================================================================================================================================================================================================================
Paket Arch Version Paketquelle Größe
=================================================================================================================================