Skip to content

Instantly share code, notes, and snippets.

View dnyall's full-sized avatar
:shipit:

daniyal abbaszadeh dnyall

:shipit:
  • Iran-tehran
View GitHub Profile
@dnyall
dnyall / ubuntu-install-bitchx.sh
Created June 4, 2023 21:44 — forked from AubreyHewes/ubuntu-install-bitchx.sh
Compile and Install BitchX on Ubuntu
#!/bin/sh
####################################################################################
#
# Download Compile and Install BitchX on Ubuntu
#
####################################################################################
# download bitchx source
# @todo make smarter, i.e. regexp, though now uses _always_ available commands (sic)
@dnyall
dnyall / gist:a016ab0c8232aa1f68207a653cab14c4
Created July 30, 2023 12:08
watchForElement function - if specefic element add or remove from dom
watchForElement(className , cb) {
const observer = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList') {
const addedNodes = Array.from(mutation.addedNodes);
const elementExists = addedNodes.some(node => node.classList && node.classList.contains(`${className}`));
if (elementExists) {
// Element with the specific class has been added to the DOM
console.log('Element added!');
In general, a cache is a "more local" copy of a memory resource that you want to access.
Its a copy that is faster to access than the original, but that memory is also more expensive.
This link, provides some measurements that illustrate the benefits: http://norvig.com/21-days.html#answers
Disk cache is RAM memory, that contains a copy of the information on the disk.
Typically, when you access something on the drive, the whole page is brought into cache, on the assumption that the next access will be in that page.
The first disk seek might take 8ms, while seeks from cache 100 ns (many times faster - note nanoseconds instead of milliseconds)
Memory cache is the same concept, but the cache is located on the CPU chip. So the original memory access is 100ns, the L1 cache access can be 0.5 ns.