Skip to content

Instantly share code, notes, and snippets.

Working from home

Sudhir Mitharwal sudkumar

Working from home
View GitHub Profile
sudkumar / channels.tsx
Last active Dec 4, 2022
Web-Sockets in ReactJS with PusherJs and Laravel Echo with public and private channels
View channels.tsx
import React, { useEffect, useState, useMemo } from "react"
import Echo from "laravel-echo"
import Pusher from "pusher-js"
* Pusher configuration
const pusherConfig = {
key: '<your_pusher_key_here>',
cluster: '<pusher_cluster>',
sudkumar / frontmatter.js
Last active Jan 7, 2023
MDX Remark plugin to handle frontmatter
View frontmatter.js
// helps us in parsing the frontmatter from text content
const matter = require('gray-matter')
// helps us safely stringigy the frontmatter as a json object
const stringifyObject = require('stringify-object')
// helps us in getting the reading time for a given text
const readingTime = require('reading-time')
// please make sure you have installed these dependencies
// before proceeding further, or remove the require statements
// that you don't use
sudkumar / # neovim - 2018-10-17_20-42-08.txt
Created Oct 17, 2018
neovim on macOS 10.14 - Homebrew build logs
View # neovim - 2018-10-17_20-42-08.txt
Homebrew build logs for neovim on macOS 10.14
Build date: 2018-10-17 20:42:08
sudkumar /
Last active Jun 10, 2022
How to install tmux locally
# Installing tmux locally
# 1. visit:
# 2. create a local directory to install tmux
# 3. download depencencies
# 1. libevent
# 1. visit:
# 2. download the stable version
# 2. ncurses
# import the required stuff
import urllib2
import lxml.html
import urlparse
pdfLinks = []
def getContentType(connection):
meta =
return meta.getheader("Content-Type")

Regular Expression

Regular expression are used to match a string or a set of string

General format

  • matching_pattern: Any pattern to match with a string