Skip to content

Instantly share code, notes, and snippets.

View SaifAqqad's full-sized avatar

Saif Alaqqad SaifAqqad

View GitHub Profile
@pavelsavara
pavelsavara / Multi-threading-browser-design-details.md
Created May 14, 2024 10:05
Multi-threading on a browser - details discovered during initial design

Alternatives - as considered 2023 Sep

  • how to deal with blocking C# code on UI thread
    • A) pretend it's not a problem (this we already have)
    • B) move user C# code to web worker
    • C) move all Mono to web worker
    • D) like A) just move call of the C# Main() to JSWebWorker
  • how to deal with blocking in synchronous JS calls from UI thread (like onClick callback)
    • D) pretend it's not a problem (this we already have)
    • E) throw PNSE when synchronous JSExport is called on UI thread
  • F) dispatch calls to synchronous JSExport to web worker and spin-wait on JS side of UI thread.
@tochanenko
tochanenko / gist:10d4c1dc7888b035b55192faaf678458
Last active April 11, 2024 16:57
How to create and run MPI projects in CLion

How to create and run MPI projects in CLion

  1. Download and install MPI from Microsoft Website. You need to download both msmpisetup.exe and msmpisdk.msi.

Note that you shouldn't have spaces or cyrillic characters in path to MPI installation.

  1. Open Windows Terminal and try running mpiexec:
Microsoft MPI Startup Program [Version 10.1.12498.18]
@sai-manoj-kumar
sai-manoj-kumar / database_size.csl
Created May 12, 2021 10:38
Find the size of all tables in your Kusto database
// To find the size of all tables in your Kusto database
find in ( database('<your database name>').* ) where 1 == 1
| summarize total = format_bytes(sum(estimate_data_size(*)))
// Similarly for whole Kusto cluster
find in ( cluster('<your cluster name>').database('*').* ) where 1 == 1
| summarize total = format_bytes(sum(estimate_data_size(*)))
<?php
public function invert(Node $tree): Node
{
$right = $tree->getLeft();
$left = $tree->getRight();
return new Node($tree->getValue(), $left, $right);
}

Deezer Keys

Deezer is unique amongst most of the commercial music streaming services I've attempted to reverse engineer in that many keys are stored (obfuscated) on the client side, including the "DRM" used to encrypt tracks. With some reverse engineering effort, this makes it fairly trivial to implement clients and libraries.

Note that many keys and algorithms are implemented in a strange way - often the ASCII hex form of a key or hash is used rather than the raw bytes.

Logging in to Deezer using the mobile API

On the desktop versions of Deezer, logging in requires a Captcha. However, on the mobile versions no Captcha is required. This is because on mobile the app uses a different endpoint to log in, but encrypts the login parameters instead (using a hardcoded key). This details how to obtain the login parameter encryption key (what I call the "gateway key"). The gateway key is a 16 character ASCII uppercase string of numbers and letters.

Note that no keys will be posted here due to fear of DMCA take

@ErikEJ
ErikEJ / IQueryableExtensions.cs
Last active June 14, 2024 19:25
Replacement for EF Core .Contains, that avoids SQL Server plan cache pollution
using System.Linq.Expressions;
namespace Microsoft.EntityFrameworkCore
{
public static class IQueryableExtensions
{
public static IQueryable<TQuery> In<TKey, TQuery>(
this IQueryable<TQuery> queryable,
IEnumerable<TKey> values,
Expression<Func<TQuery, TKey>> keySelector)
@rmtsrc
rmtsrc / raspberry-pi-cec-client.md
Created May 13, 2019 09:49
Using cec-client on a Raspberry Pi to control TV power and inputs via HDMI

Using cec-client on a Raspberry Pi

Most modern HDMI connected devices support Consumer Electronics Control (CEC). It allows devices to send commands to each other, typically to get the TV to switch input and control volume. If you have ever turned on a Game Console and had your TV automatically change input to that device you have seen CEC in action. It is very convenient and useful, sort of a universal remote that works.

Every manufacturer seems to have it’s own branding of CEC (e.g. Samsung Anynet+, LG SimpLink, Sharp Aquos Link) but it may need to be enabled. Check your manual for details.

Using a Raspberry Pi connected to a TV that supports CEC, you can use the command line cec-client application to control the inputs and the TV itself. These are notes on how to use cec-client and understand the different options.

Details

@dcazrael
dcazrael / b64.ahk
Created April 10, 2019 10:55 — forked from tmplinshi/b64.ahk
Base64 Encode/Decode support UTF-16-LE encoding. Ported from VBS code https://stackoverflow.com/a/40118072/1631371.
b64_encode(p*) {
return b64.encode(p*)
}
b64_decode(p*) {
return b64.decode(p*)
}
class b64
{
@iiiGerardoiii
iiiGerardoiii / Edge-like scrolling on Firefox
Last active March 31, 2024 03:40
Edge-like scrolling on Firefox
general.smoothScroll.currentVelocityWeighting: 0
general.smoothScroll.mouseWheel.durationMaxMS: 150
general.smoothScroll.stopDecelerationWeighting; 0.82
mousewheel.min_line_scroll_amount: 25
@archetana
archetana / index.html
Created July 6, 2018 12:52
Pan and Zoom in jsPlumb Community Edition with Dagre and jQueryUI Draggable
<div class="container">
<div class="panzoom">
<div class="diagram">
<div id="i0" class="item">Root!</div>
<div id="i1" class="item">Child 1</div>
<div id="i11" class="item">Child 1.1</div>
<div id="i12" class="item">Child 1.2</div>
<div id="i2" class="item">Child 2</div>
<div id="i21" class="item">Child 2.1</div>
<div id="i3" class="item">Child 3</div>