Skip to content

Instantly share code, notes, and snippets.


Mohammad H. Sattarian mhsattarian

View GitHub Profile
mahmoud-eskandari /
Last active Jan 27, 2023
Install v2ray on Bridge:(Ubuntu +18 via systemd) - Upstream (Ubuntu +18/CentOS +7 via docker)

برای شروع میتوانید یک دایرکتوری در سرور خارجی ایجاد کنید و وارد آن شوید.

mkdir vmess
cd vmess
marcus-at-localhost /
Last active Oct 30, 2022
[JSON Path with Alpine CSP build in Postman Visualizer] Query JSON Response with JSON Path

JSON Path with Alpine.js CSP build in Postman Visualizer

Query JSON Response with JSON Path


To work more easily with Postman JSON results, I implemented JSONPath in a Postman Visualizer, to query the results.

JSONPath is to JSON what XPath is to XML, and it helps to dig into large nested objects and get what you are looking for faster.

First I was using just a jQuery version that can be found in the examples and that worked just fine. (JSONpath Visualizer | Postman Team Collections | Postman API Network)

steveruizok / findSnapPoints.ts
Last active May 13, 2022
Find the snap points between a bounding box and several other bounding boxes.
View findSnapPoints.ts
interface TLBoundsWithCenter {
minX: number
midX: number
maxX: number
minY: number
midY: number
maxY: number
width: number
height: number

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
Jack-Works / 2018.js
Last active Jan 22, 2023
cRAzY eSnEXt (*all* proposals mixed in)
View 2018.js
#! Aaaaaaaaaaa this is JS!!!
// This file is mixing all new syntaxes in the proposal in one file without considering syntax conflict or correct runtime semantics
// Enjoy!!!
// Created at Nov 23, 2018
for await(const x of (new A //
|> do { //
case(?) { //
when {val}: class {
gaearon / Classes.js
Created May 27, 2020
Beneath Classes: Prototypes
View Classes.js
class Spiderman {
lookOut() {
alert('My Spider-Sense is tingling.');
let miles = new Spiderman();
View final-waveform.js
import React, { Component } from 'react';
import WaveSurfer from 'wavesurfer.js';
import { WaveformContianer, Wave, PlayButton } from './Waveform.styled';
class Waveform extends Component {
state = {
playing: false,
bvaughn /
Last active Dec 29, 2022
How to use profiling in production mode for react-dom

React recently introduced an experimental profiler API. This page gives instructions on how to use this API in a production release of your app.

Table of Contents

Profiling in production

React DOM automatically supports profiling in development mode for v16.5+, but since profiling adds some small additional overhead it is opt-in for production mode. This gist explains how to opt-in.

gachiemchiep /
Created Aug 16, 2018
Write/Read image data on Redis using opencv or PIL
import redis
import cv2
import numpy as np
import time
import io
from PIL import Image
r = redis.StrictRedis.from_url('redis://:password@')
img_path ="image"
SeppPenner / Installing Python 3.7.4 on Raspbian.rst
Last active Dec 19, 2022
Installing Python 3.7.4 on Raspbian
View Installing Python 3.7.4 on Raspbian.rst

Installing Python 3.7.4 on Raspbian

As of July 2018, Raspbian does not yet include the latest Python release, Python 3.7.4. This means we will have to build it ourselves, and here is how to do it.

  1. Install the required build-tools (some might already be installed on your system).