Skip to content

Instantly share code, notes, and snippets.


Mohamed A. Bamakhrama mohamed

View GitHub Profile
mohamed / ctest2junit.xsl
Last active May 11, 2020
CTest XML to JUnit XML
View ctest2junit.xsl
<xsl:stylesheet xmlns:xsl="" version="1.0">
<xsl:param name="pass" select="'this'"/>
<xsl:output method="xml" indent="yes"/>
<!-- convert ctest output to junit format -->
Inspired by
Based on
Extended by providing total Start date, total time, total test stats
<xsl:template match="/Site">

title: Bash scripting category: CLI layout: 2017/sheet tags: [Featured] updated: 2019-10-02 keywords:

  • Variables
  • Functions
  • Interpolation
mohamed / udrive.reg
Created Jan 21, 2020
Create Windows drive
View udrive.reg
"U Drive"="subst U: %LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs"
mohamed /
Created Dec 30, 2019
Encoding your WiFi access point password into a QR code

Encoding your WiFi access point password into a QR code

Up until recently, it was a pain to defend againt WPA2 brute-force attacks by using a random 63-character password (the maximum in WPA-Personal) mode). Thanks to Android and now iOS 11 supporting reading WiFi passwords from a QR code, this is finally a practical defense.

Generating the QR code

After installing the qrencode package, run the following:

mohamed /
Last active Dec 1, 2019
Implement time delay for a signal in frequency domain
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
def nextpow2(i):
Find the next power 2 number for FFT
mohamed /
Last active Oct 24, 2019
Git sparse checkout

Using Git Sparse Checkout

Here are the steps to create a “sparse” Git local repository.

  1. Enable Sparse Checkouts

    git config core.sparsecheckout true

View vitter.c
//Copyright Kevin Lawler, released under ISC License
double random_double() //your random double function
//[0,1) uniformly random double, mt19937-64.c source is fine
//keep in mind most double-based implementations drop randomness to 52-bits
return genrand64_real2();
//POTENTIAL_OPTIMIZATION_POINT: Christian Neukirchen points out we can replace exp(log(x)*y) by pow(x,y)
mohamed / compound-literals.c
Last active Aug 23, 2019
C compound literals
View compound-literals.c
* Compile with:
* gcc compound-literals.c -Wall -Wextra -std=c99 -Werror
#include <stdio.h>
#include <stdlib.h>
struct bin_tree {
int value;
mohamed / test_fcvt_invalid.c
Last active Jul 1, 2019
Test IEEE 754-2008 invalid exception under conversion operations
View test_fcvt_invalid.c
* Compile with:
* gcc -mavx512f -std=c89 -Wall -Wextra -Werror test_ov.c -o test_ov -lm
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
/* For fe* functions */
mohamed / vim.rst
Last active Jul 25, 2019
Vim cheatsheet
View vim.rst


guu                         : lowercase line
gUU                         : uppercase line
g~~                         : flip case line
gf                          : open file name under cursor (SUPER, requires :set path+=<path_to_file>)
<C-w>f                      : open file name under cursor in a new window
You can’t perform that action at this time.