Skip to content

Instantly share code, notes, and snippets.

const ProxyChain = require("proxy-chain")
const server = new ProxyChain.Server({
// Port where the server will listen. By default 8000.
port: 8000,
// Enables verbose logging
verbose: true,
// Custom user-defined function to authenticate incoming proxy requests,
import { firefox, chromium } from "playwright-extra"
import { Browser, Page, LaunchOptions, BrowserContext } from "playwright"
import { PlaywrightBlocker } from "@cliqz/adblocker-playwright"
import fetch from "cross-fetch" // required 'fetch'
import { promises as fs } from "fs" // used for caching
import os from "os"
import RecaptchaPlugin from "puppeteer-extra-plugin-recaptcha"
import StealthPlugin from "puppeteer-extra-plugin-stealth"
import { newInjectedContext } from "fingerprint-injector"
@meotimdihia
meotimdihia / How to fix the bug: "Warning: Expected server HTML to contain a matching <div> in <div>." in Next.js.md
Last active December 21, 2022 10:01
How to fix the bug: "Warning: Expected server HTML to contain a matching <div> in <div>." in Next.js

1 Easy but re-render

most simple way, but it will re-render. It may be related to the scrolling restoration bug when the user return the page if your data is fetched on the client

import {useState, useEffect} from 'react'

export default function Index() {
  const [mounted, setMounted] = useState(false);
  useEffect(() => {
      setMounted(true)
@meotimdihia
meotimdihia / .tmux.conf.md
Last active April 6, 2021 09:35
Simple tmux v3.0+ config, show CPU, memory usage.

screenshot

# https://www.medo64.com/2020/01/colored-cpu-usage-in-tmux/
# https://gist.github.com/spicycode/1229612

# remap prefix to Control + a
set -g prefix C-a

# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
@meotimdihia
meotimdihia / SpeedTest.Net Server List
Created May 16, 2020 16:24 — forked from gxgani/SpeedTest.Net Server List
Speedtest.net Server List
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<servers><server url="http://speedtest.pronea.no/speedtest/upload.php" lat="69.6828" lon="18.9428" name="Tromso" country="Norway" countrycode="NO" sponsor="Pronea AS" sponsorurl="http://www.pronea.no/" id="1327" gid="0" url2="http://speedtest.pronea.no/speedtest/upload.php" bigsamples="1" />
<server url="http://speedtest.mmsn.ru/speedtest/upload.php" lat="68.9667" lon="33.0833" name="Murmansk" country="Russian Federation" countrycode="RU" sponsor="JSC M2C" sponsorurl="http://www.mmsn.ru" id="1521" gid="0" url2="http://speedtest.mmsn.ru/speedtest/upload.php" bigsamples="1" />
<server url="http://st1.teletoria.ru/speedtest/upload.php" lat="68.9667" lon="33.0833" name="Murmansk" country="Russian Federation" countrycode="RU" sponsor="ISP Teletoria" sponsorurl="http://www.teletoria.ru" id="2342" gid="0" url2="http://st1.teletoria.ru/speedtest/upload.php" bigsamples="1" />
<server url="http://speedtest.oltv.ru/speedtest/upload.php" lat="68.1500" lon="33.2833" nam
Each YouTube video has 4 generated images. They are predictably formatted as follows:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
The first one in the list is a full size image and others are thumbnail images. The default thumbnail image (ie. one of 1.jpg, 2.jpg, 3.jpg) is:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
@meotimdihia
meotimdihia / config.fish
Created June 26, 2018 10:07 — forked from alyssaq/config.fish
config.fish set environment variables from bash_profile
# Fish shell
egrep "^export " ~/.bash_profile | while read e
set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "PATH"
@meotimdihia
meotimdihia / config.fish
Created June 26, 2018 10:07 — forked from alyssaq/config.fish
config.fish set environment variables from bash_profile
# Fish shell
egrep "^export " ~/.bash_profile | while read e
set var (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([A-Z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "PATH"
@meotimdihia
meotimdihia / pre-commit
Last active August 29, 2015 14:05
Check error for php files.
#!/usr/bin/php
<?php
$output = array();
$return = 0;
exec('git rev-parse --verify HEAD 2> /dev/null', $output, $return);
exec("git diff-index --cached --name-only HEAD", $output);
exec("git diff-index --cached --name-only --diff-filter=D HEAD", $outputDels);
$filename_pattern = '/\.(php|ctp)$/';
@meotimdihia
meotimdihia / gist:5270063
Created March 29, 2013 10:18
Grep the process id and kill all the filtered process
kill $(ps ax | grep 'search' | awk '{print $1}')
ps ax | grep 'search' | awk '{print $1}' | xargs svn add