Skip to content

Instantly share code, notes, and snippets.

javascript:const clear=(()=>{let e=e=>null!=e,r=["ytd-video-masthead-ad-v3-renderer","ytd-engagement-panel-title-header-renderer","ytd-display-ad-renderer","ytd-promoted-sparkles-web-renderer","ytd-compact-promoted-video-renderer","ytd-action-companion-ad-renderer","ytd-action-engagement-panel-content-renderer","ytd-banner-promo-renderer","ytd-in-feed-ad-layout-renderer","ytd-ad-inline-playback-meta-block","ytd-player-legacy-desktop-watch-ads-renderer","ytd-ads-engagement-panel-content-renderer"],o=setInterval(()=>{for(staticAd in r)e(document.querySelector(r[staticAd]))&&(document.querySelector(r[staticAd]).remove(),console.info("%cStatic Ad Blocked!","background: rgba(0,204,0,0.2); color: yellow;display: block"));let o=document.querySelectorAll(".ad-showing")[0],l=document.getElementsByClassName("ytp-ad-skip-button")[0];if(e(o)){let t=document.querySelector("video");e(t)&&(t.currentTime=t.duration,l.click(),console.info("%cAd Blocked!","background: rgba(0,204,0,0.2); color: yellow;display: block"))}},1);ret
@nadavrot
nadavrot / Matrix.md
Last active August 16, 2024 08:59
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@yasufumy
yasufumy / argmax.py
Created December 17, 2016 08:29
argmax function by pure python
def argmax1(array):
return array.index(max(array))
def argmax2(array):
return max(range(len(array)), key=lambda x: array[x])
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active September 9, 2024 10:19
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@protrolium
protrolium / wget.md
Last active March 8, 2024 01:46
wget commands

Download Only Certain File Types Using wget -r -A

You can use this under following situations:

  • Download all images from a website
  • Download all videos from a website
  • Download all PDF files from a website

$ wget -r -A.pdf http://url-to-webpage-with-pdfs/

@microamp
microamp / immutable.py
Last active October 16, 2023 05:30
How to make immutable classes in Python
#-*- coding: utf-8 -*-
from collections import namedtuple
class Immutable(namedtuple("Immutable", "x, y")):
"""Immutable class using collections.namedtuple."""
def __str__(self):
return "class: {c}, x: {x}, y: {y}".format(c=Immutable.__name__,
x=self.x, y=self.y)
@seungwon0
seungwon0 / garp.c
Last active July 2, 2024 08:28
Send IPv4 Gratuitous ARP Packet
/* garp.c - Send IPv4 Gratuitous ARP Packet
Usage Example: sudo ./garp eth0
Copyright (C) 2011-2013 P.D. Buchan (pdbuchan@yahoo.com)
Copyright (C) 2013 Seungwon Jeong (seungwon0@gmail.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
@jwebcat
jwebcat / gist:5122366
Last active August 25, 2024 12:59 — forked from lemenkov/gist:1674929
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@leipzig
leipzig / mycd.sh
Created January 21, 2012 03:36
directory based history bash profile
function mycd()
{
#if this directory is writable then write to directory-based history file
#otherwise write history in the usual home-based history file
tmpDir=$PWD
echo "#"`date '+%s'` >> $HISTFILE
echo $USER' has exited '$PWD' for '$@ >> $HISTFILE
builtin cd "$@" # do actual cd
if [ -w $PWD ]; then export HISTFILE="$PWD/.dir_bash_history"; touch $HISTFILE; chmod --silent 777 $HISTFILE;
else export HISTFILE="$HOME/.bash_history";
@nolim1t
nolim1t / socket.c
Created June 10, 2009 03:14
HTTP Request in C using low level write to socket functionality
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>