Skip to content

Instantly share code, notes, and snippets.

Avatar

Mohamed A. Bamakhrama mohamed

View GitHub Profile
@mohamed
mohamed / ctest2junit.xsl
Last active May 11, 2020
CTest XML to JUnit XML
View ctest2junit.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:param name="pass" select="'this'"/>
<xsl:output method="xml" indent="yes"/>
<!-- convert ctest output to junit format -->
<!--
Inspired by https://stackoverflow.com/questions/6329215/how-to-get-ctest-results-in-hudson-jenkins
Based on https://github.com/zanata/zanata-tests/blob/master/scripts/CTest2JUnit.xsl
Extended by providing total Start date, total time, total test stats
-->
<xsl:template match="/Site">
View bash_cheatsheet.md

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

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

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
mohamed / delay.py
Last active Dec 1, 2019
Implement time delay for a signal in frequency domain
View delay.py
#!/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
mohamed / git-sparse-checkout.md
Last active Oct 24, 2019
Git sparse checkout
View git-sparse-checkout.md

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
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
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
mohamed / vim.rst
Last active Jul 25, 2019
Vim cheatsheet
View vim.rst

Misc

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.