Skip to content

Instantly share code, notes, and snippets.

View snehesht's full-sized avatar

Snehesh snehesht

View GitHub Profile
@snehesht
snehesht / AES Counter-mode implementation in JavaScript.js
Created March 21, 2015 15:47
AES Implementation in JavaScript
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* AES Counter-mode implementation in JavaScript (c) Chris Veness 2005-2014 / MIT Licence */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* jshint node:true *//* global define, escape, unescape, btoa, atob */
'use strict';
if (typeof module!='undefined' && module.exports) var Aes = require('./aes'); // CommonJS (Node.js)
/**
@snehesht
snehesht / RemoveYTShortVideos.js
Created August 15, 2023 04:43 — forked from Shubhang/RemoveYTShortVideos.js
Remove short videos from youtube recommendations
// Open YouTube: Navigate to the YouTube homepage.
// Open Developer Console: Press F12 or right-click anywhere on the page and select "Inspect" to open the developer console. Then, click on the "Console" tab.
// Paste and Run the Script: Copy and paste the following code into the console, then press Enter.
// This code searches for video duration elements on the page and hides the corresponding video if its duration is less than 10 minutes.
// Repeat as Needed: If you scroll down and more videos load, or if you navigate to a different page, you'll need to run the script again.
@snehesht
snehesht / gist:ab1f9279bd61cebd5a81
Created April 6, 2015 18:16
proxy loadbalancing
Src : http://stackoverflow.com/questions/17590816/kernel-based-linux-data-relay-between-two-tcp-sockets
# With Nginx
TCP Connections load-balancing
# With HAProxy
Using Linux TCP Splicing with HAProxy
Willy Tarreau <w@1wt.eu>
- 2007/01/06 -
@snehesht
snehesht / clarify-error.ts
Created March 3, 2022 04:45
Clarify Error Stacks
function splitStack(err: Error | string): Array<string> {
if (typeof err === 'string') return [`Error: ${err}`];
else if (err.stack) return err.stack.split('\n');
else return [`${err.name}: ${err.message}`];
}
export = function clarify(innerError: Error | string, message: string): Error {
const outerError = new Error(message);
const outerStack = outerError.stack!.split('\n');
outerStack.splice(1, 1);
@snehesht
snehesht / install.sh
Created February 26, 2022 10:27
Install Wireguard
#!/bin/bash
# Secure WireGuard server installer
# https://github.com/angristan/wireguard-install
RED='\033[0;31m'
ORANGE='\033[0;33m'
NC='\033[0m'
function isRoot() {
@snehesht
snehesht / esm-package.md
Created September 14, 2021 03:43 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from 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.

Inlets free binary

@snehesht
snehesht / terraform-kubernetes-docker-macos.md
Created June 24, 2021 21:42 — forked from ivaravko/terraform-kubernetes-docker-macos.md
The simple Terraform and Kubernetes with Docker on macOS

If you'd like to experiment with Terraform and Kubernetes on macOS locally, a great provider for doing so is the Kubernetes provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.