Skip to content

Instantly share code, notes, and snippets.

@mems
mems / msrdwa-for-all.user.js
Last active April 22, 2022 13:55
[Userscript] Microsoft Remote Desktop Web Access for all
// ==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 / chunked.php
Created May 22, 2017 15:23
Chunked transport encoding video
<?php
if(isset($_GET['videofile'])){
// PHP encode transfer automatically if you use flush() and output_buffering is activated (don't need to use special header nor chunk metadata)
// http://php.net/manual/en/outcontrol.configuration.php#ini.output-buffering
header('Transfer-Encoding: chunked');
header('Content-Encoding: none');
// No cache
header('Cache-Control: no-cache, no-store, must-revalidate');
@mems
mems / README.md
Created October 6, 2016 20:27
Convert Thunderbird mbox to maildir

Email file name is the timestamp of received email (in microseconds). Example: 1466698612265640, start with From - Thu Jun 23 18:16:52 2016 (Thu Jun 23 2016 18:16:52 GMT+0200 (CEST))

Use NodeJS:

// Note: this script not work properly if an email contains "\n\nFrom - "
const fs = require('fs');
const path = require('path');
@mems
mems / README.md
Created March 27, 2016 17:40
Download all videos from http://www.appanimations.com/

First exec this in WebDev console for each page, copy in clipboard the iframes src of each videos + title + keywords

copy(JSON.stringify(Array.from(document.querySelectorAll("article")).map(article => [article.querySelector("iframe").src, /<a[^>]*>([^<]+)/.exec(article.querySelector("textarea").value)[1], article.querySelector(".cat").textContent])))

Go to https://videos.sproutvideo.com/embed/189bdbb01e1ce7c790/98b77e706be88310, open WebDev console and exec:

var videos = [
@mems
mems / README.md
Last active March 27, 2018 05:20
Fix AdressBook errors in OSX 10.11 (fixed in OSX 10.12)

For /var/log/system.log full of errors like these ones:

kernel[0]: Sandbox: com.apple.Addres(XXXXX) deny(1) network-outbound /private/var/run/mDNSResponder
com.apple.AddressBook.InternetAccountsBridge[XXXXX]: dnssd_clientstub ConnectToServer: connect()-> No of tries: 1
com.apple.AddressBook.InternetAccountsBridge[XXXXX]: dnssd_clientstub ConnectToServer: connect() failed path:/var/run/mDNSResponder Socket:4 Err:-1 Errno:1 Operation not permitted

How to fix it?

@mems
mems / performance.html
Last active March 29, 2016 17:14
Canvas stress test. Usefull for detect low-end devices or old tablets/smartphones
<!DOCTYPE html PUBLIC>
<html>
<head>
<title></title>
</head>
<body>
<script>
// Polyfill
window.performance = (window.performance || {
offset: Date.now(),
@mems
mems / README.md
Last active June 12, 2021 14:18
Tabnabbing attack on Facebook

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>
	
@mems
mems / README.md
Last active April 2, 2024 16:24
Fullres images of a https://www.fashionanthology.com/ galleries
@mems
mems / DisplayProductID-73e
Last active November 6, 2016 22:26
Add support of OSCAR LCD Panel 1024 × 768 as HiDPI screen to macOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayProductID</key>
<integer>1854</integer>
<key>DisplayProductName</key>
<string>OSCAR LCD panel</string>
<key>DisplayVendorID</key>
<integer>1970170734</integer>
@mems
mems / gist:d54ad804d8d8d17d0011
Last active October 24, 2022 03:24
Found the Apple live stream URL
  1. Open http://www.apple.com/live/ which redirect to something like http://www.apple.com/live/2015-june-event/
  2. Find a loaded script like: /live/2015-june-event/scripts/2015-june-event.built.js
  3. Open this script and search p.events-delivery.apple.com.edgesuite.net You find something like http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/js_files/event
  4. append to it /url.json (details: host + path + url.json)
  5. Open the generated URL
  6. Found an URL like http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/m3u8/hls_mvp.m3u8

Now you can watch it in VLC or any other videoplayer that support M3U and MP4(H264+AAC)!