Skip to content

Instantly share code, notes, and snippets.

@rmorse
rmorse / react-router-dom-v.6.02.prompt.blocker.js
Last active December 21, 2023 04:22
Adds back in `useBlocker` and `usePrompt` to `react-router-dom` version 6.0.2 (they removed after the 6.0.0 beta, temporarily)
/**
* These hooks re-implement the now removed useBlocker and usePrompt hooks in 'react-router-dom'.
* Thanks for the idea @piecyk https://github.com/remix-run/react-router/issues/8139#issuecomment-953816315
* Source: https://github.com/remix-run/react-router/commit/256cad70d3fd4500b1abcfea66f3ee622fb90874#diff-b60f1a2d4276b2a605c05e19816634111de2e8a4186fe9dd7de8e344b65ed4d3L344-L381
*/
import { useContext, useEffect, useCallback } from 'react';
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom';
/**
* Blocks all navigation attempts. This is useful for preventing the page from
* changing until some condition is met, like saving form data.
@wieshka
wieshka / middleware.py
Last active October 6, 2023 05:53
WSE middleware
#!/usr/bin/env python3
import argparse
import asyncio
import websockets
import ssl
# Since we are sending messages to wss://localhost, we need to bypass SSL verification,
# hence initialising SSL context for that
ssl_context = ssl.create_default_context()
@wingkwong
wingkwong / About.md
Last active April 22, 2024 04:58
About.md

Hello World!

@jaredloson
jaredloson / Cursor.jsx
Last active December 3, 2022 19:35
Interactive Javascript Cursor in React
import React, { useContext, useState } from "react";
import useMousePosition from "./useMousePosition";
import { CursorContext } from "./CursorContextProvider";
import isTouchDevice from "./isTouchDevice";
const Cursor = () => {
if (isTouchDevice) {
return null;
}
@christianjunk
christianjunk / csharp-winform-controls-abbreviations
Created December 18, 2019 18:07
C# WinForm Controls Abbreviation
btn Button chk CheckBox ckl CheckedListBox
cmb ComboBox dtp DateTimePicker lbl Label
llb LinkLabel lst ListBox lvw ListView
mtx MaskedTextBox cdr MonthCalendar icn NotifyIcon
nud NumeircUpDown pic PictureBox prg ProgressBar
rdo RadioButton rtx RichTextBox txt TextBox
tip ToolTip tvw TreeView wbs WebBrowser
??
flp FlowLayoutPanel grp GroupBox pnl Panel
@NikolayIT
NikolayIT / SimpleHttpServerWithTcpListener.cs
Created September 16, 2018 12:26
Simple HTTP server in .NET Core using TcpListener
namespace SimpleHttpServer
{
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
public static class Program
{
public static void Main(string[] args)
I was able to find a VERY QUICK AND DIRTY way to use the media-autobuild suite to compile my own 64-bit static FFmpeg for Windows with the NDI library.
Download it and extract to a place on your computer, and keep note of the path. I put it in "D:\ndi\media-autobuild_suite-master", so for the sake of these instructions when you see "<autobuild>", you need to substitute whatever path you've put it in.
During the initial setup process, request to use the static build and add whatever else you'd like to have in your ffmpeg, then pause what you're doing when the on-screen prompts tell you the ffmpeg_options file has been written, then go into <autobuild>\build\ffmpeg_options.txt and add somewhere a line with
Code:
--enable-libndi_newtek
@vikas5914
vikas5914 / makeCert.bat
Created January 22, 2018 13:02
Generate a self-signed certificate for localhost
@echo off
REM IN YOUR SSL FOLDER, SAVE THIS FILE AS: makeCERT.bat
REM AT COMMAND LINE IN YOUR SSL FOLDER, RUN: makecert
REM IT WILL CREATE THESE FILES: example.cnf, example.crt, example.key
REM IMPORT THE .crt FILE INTO CHROME Trusted Root Certification Authorities
REM REMEMBER TO RESTART APACHE OR NGINX AFTER YOU CONFIGURE FOR THESE FILES
REM PLEASE UPDATE THE FOLLOWING VARIABLES FOR YOUR NEEDS.
SET HOSTNAME=example
@moeiscool
moeiscool / ffmpegToWeb.js
Last active May 1, 2024 12:29
FLV Live Stream to Web Page with flv.js, FFMPEG, and Express Web Server (Node.js)
// Shinobi (http://shinobi.video) - FFMPEG FLV over HTTP Test
// How to Use
// 1. Navigate to directory where this file is.
// 2. Run `npm install express`
// 3. Start with `node ffmpegToWeb.js`
// 4. Get the IP address of the computer where you did step 1. Example : 127.0.0.1
// 5. Open `http://127.0.0.1:8001/` in your browser.
var child = require('child_process');
var events = require('events');
@pingec
pingec / DumpHttpRequests.cs
Created November 14, 2017 20:35
C# Simple http server to dump requests to console (HttpListener)
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
namespace DumpHttpRequests
{
internal class Program
{