Skip to content

Instantly share code, notes, and snippets.

@mems
mems / Code coverage.md
Last active Sep 27, 2022
Web frontend code coverage
View Code coverage.md

Every line of code we write today will end up as someone’s legacy code.

Everything that you write is going to disappears some day

RUM Code coverage, chose a 1h timeframe (per day) where 1% traffic run that the test

JS coverage

FES javascript instrimentation visualization

@mems
mems / ASP.Net dependency graph.md
Last active Jul 19, 2022
Build dependency graph of an ASP.Net project
View ASP.Net dependency graph.md

For all files: HTML, JS, CSS, LESS, CSHTML, ASCX, ASPX, CS (SVC) And config files XML, JSON

Write a webpack loader to load backend templates dependencies.

C# Razor and Web Forms templates

Entry points: ^[^_].*\.cshtml$ and .aspx$ should be an entries points

  • WebForm templates (ASPX use ASCX controls) files are HTML/XML with processing instruction nodes
@mems
mems / akamaiopen.sh
Last active Jul 7, 2022 — forked from mousavian/akamai.api.sh
Akamai Open API with Bash
View akamaiopen.sh
#!/usr/bin/env bash
# See also https://github.com/akamai/AkamaiOPEN-edgegrid-powershell
usage() {
cat <<EOT
Usage: ${basename $0} -X value -s value -t value -a value -u value [-d value] [-h]
Options:
-s Client secret
@mems
mems / msrdwa-for-all.user.js
Last active Apr 22, 2022
[Userscript] Microsoft Remote Desktop Web Access for all
View msrdwa-for-all.user.js
// ==UserScript==
// @name Microsoft Remote Desktop Web Access for all
// @namespace memmie.lenglet.name
// @author mems <memmie@lenglet.name>
// @homepageURL https://gist.github.com/mems/e7277c1118e1d876dd7333bb8c2bb49b
// @description Allow to use RD Web Access on browser that don't support RD ActiveX
// @match *://*/RDWeb/Pages/*
// @updateURL https://gist.github.com/mems/e7277c1118e1d876dd7333bb8c2bb49b/raw/msrdwa-for-all.user.js
// @version 1.0.0
// ==/UserScript==
@mems
mems / gist:5301297
Last active Feb 23, 2022
How to convert a (simple) SWF to PDF
View gist:5301297

Convert (simple) SWF to PDF

In SWFTools a programs called gfx2gfx is available to do this task, but it's not officially available precompiled.

It can convert SWF, PDF or image to SWF, PDF, ebook or image.

For discard downscaling for rasterized image (default: 72dpi) we use the provided by @m-p-y: add -r attribute to increase maxdpi

Requirements

View README.md
@mems
mems / icloudtabs2md.js
Last active Aug 30, 2021
Generate a markdown links list from iCloud tabs
View icloudtabs2md.js
#!/usr/bin/env node
/*
Generate a markdown links list from iCloud tabs, on macOS
Usage:
./icloudtabs2md.js > icloudtabs.md
./icloudtabs2md.js | pbcopy
Require:
@mems
mems / README.md
Last active Jun 12, 2021
Tabnabbing attack on Facebook
View README.md

Share it on Facebook. When the user click on the shared link and come back to the Facebook tab, he should see a fake Facebook login page (in French).

This attack use window.open vector. Since all shared link on Facebook use target="_blank", the opener property is shared with the target page (attacker page) and allow this page to control the facebook tab location

To solve that, Facebook should use a redirect page where the property window.opener is set to null:

<head>