Skip to content

Instantly share code, notes, and snippets.

View trimechee's full-sized avatar
💯

trimechee

💯
View GitHub Profile
youtube-dl -o "%(playlist_index)s-%(title)s.%(ext)s" -f 22 "url_here"
(function() {
"use strict";
function padd(x) {
var x = String(x);
return x.length < 2 ? '0' + x : x;
}
var duration = +document.querySelector("video").duration;
var playerData = document.querySelector("ytd-watch-flexy").__data.playerData;
@maedoc
maedoc / simplevi.py
Last active October 20, 2021 06:33
Simple example of variational inference with autograd
from autograd import grad, numpy as np
from autograd.scipy.stats import norm
from autograd.misc.optimizers import adam
def simple_vi(n=2000):
x = np.random.normal(loc=+1.5, scale=+0.3, size=10)
log_p = lambda z: np.mean(norm.logpdf(x[:, None], z[0], np.exp(z[1])), axis=0)
log_q = lambda z, l: norm.logpdf(z, l[:, None], 0.3)
samp_q = lambda l: np.random.normal(l[:, None], 0.3, (2, n))
# https://arxiv.org/pdf/1401.0118.pdf, eq 3
@RubenKelevra
RubenKelevra / IPFS-convert-datastore-with-system-service-installation.md
Created May 4, 2020 18:50
IPFS convert datastore with system service installation

Compile the tool https://github.com/ipfs/ipfs-ds-convert via your user account

echo "$GOPATH" -> if empty go to ~/go/bin/, else "$GOPATH/bin/"

copy the ipfs-ds-convert binary to /tmp/:

cp -a ipfs-ds-convert /tmp/

convert your datastore:

@luckyshot
luckyshot / magic-copy.js
Last active December 11, 2023 21:00
JavaScript - Add/Append custom text on copy to clipboard
/**
* Magic Copy
* This little script will append some text to the clipboard when a user copies text from the website
*
* WARNING: This feature is an anti-pattern and a bad usability practice in 99% of cases, use only in
* those situations where it can really benefit the user to have a link to the full resource
*/
document.addEventListener('copy', (event) => {
if (document.getSelection().toString().length < 10){ return; }
const pagelink = `\n${document.location.href}`;
@eliorsterling
eliorsterling / readingmode.js
Created June 19, 2020 01:03 — forked from luckyshot/readingmode.js
Bookmarklet: Readability (remove all styling from a website, optimize for reading and scroll to article). Also available as a Chrome Extension: https://chrome.google.com/webstore/detail/readingmode-lightest/peoapnglceoafojobbkpohnojniabmkd
javascript:
/*! ReadingMode © Xavi Esteve */
(function(d) {
var el = d.getElementsByTagName("*");
var htmlDiv = d.createElement("div");
var readingModeMenu = d.createElement("div");
var title = d.title;
var rmSettings = {};
/* Remove all event listeners */
@panzi
panzi / enable_context_menu.js
Created July 22, 2020 21:17
Bookmarklet to re-enable context menus on sites that disable it.
javascript:(function(pd){Event.prototype.preventDefault=function(){if(this.type!=='contextmenu')return%20pd.apply(this,arguments);};})(Event.prototype.preventDefault);void(0)
@panzi
panzi / VideoScreenshot.js
Last active May 7, 2022 10:59
Make a screenshot of a video.
javascript:(function() {
function screenshot(video) {
var canvas = document.createElement('canvas');
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
context = canvas.getContext('2d');
var now = new Date();
context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
var url = canvas.toDataURL('image/png');
var link = document.createElement('a');
@valinet
valinet / README.md
Last active April 15, 2025 14:05
Get dark command windows all the time in Windows

Case study: Get dark command windows all the time in Windows

TL;DR

  1. Make a copy conhost.exe from System32.
  2. Open it with a hex editor (I use HxD).
  3. In HxD, go to Search - Find - Hex-values.
  4. Search for 881d9e530a004885c07477ff15b32e08009084c0.
  5. In Windows 10 version 2004, replace ff15b32e0800 with 909090909090. If using Windows 10 version 20H2, replace ff15b32e08009084 with 9090909090909090.
  6. Save file and copy it back to System32 (take ownership of original conhost.exe in order to replace it).
  7. Profit!
@luckyshot
luckyshot / download.js
Created September 18, 2020 13:28
Download all images from website (JS + PHP)
var buffer = [];
document.querySelectorAll('img').forEach(function(item) {
if (item.src){
buffer.push( item.src );
}
});
console.log('Total items:', buffer.length );
localStorage.buffer = JSON.stringify(buffer);
// Now grab localStorage.buffer and paste it in PHP