Skip to content

Instantly share code, notes, and snippets.

View amitkhare's full-sized avatar
🤔
Brainstorming

Amit Kumar Khare amitkhare

🤔
Brainstorming
View GitHub Profile
@amitkhare
amitkhare / Open-chrome-as-app.bat
Created February 23, 2021 13:26
Opens running code server at default gateway port 9090 in chrome as app.
@echo off
netsh wlan show interfaces | Findstr /c:"Signal" && set "CStatus=true" || set "CStatus=false"
for /f "tokens=2,3 delims={,}" %%a in ('"WMIC NICConfig where IPEnabled="True" get DefaultIPGateway /value | find "I" "') do set "location=%%a"
set location=%location:"=%
IF /i "%CStatus%"=="true" "C:\Program Files\Google\Chrome\Application\chrome.exe" --new-window --app=https://%location%:9090
@amitkhare
amitkhare / ProjectionMath.cs
Last active November 14, 2020 06:50
ProjectionMath for Wasp3D
#region NameSpaceRegion
using System;
using System.Windows.Forms;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Xml;
using System.Xml.Linq;
using BeeSys.Wasp3D.Hosting;
#region NameSpaceRegion
using System;
using System.Windows.Forms;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Xml;
using System.Xml.Linq;
using BeeSys.Wasp3D.Hosting;
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://apis.google.com/js/api.js"></script>
<script>
@amitkhare
amitkhare / Nginx RTMP module on Ubuntu 18.04.md
Last active November 22, 2023 02:29
Nginx RTMP module on Ubuntu 18.04 with RTMPS support for Facebook live streaming Hardware and Software live-streaming encoders have typically used the RTMP streaming protocol. With the Facebook enforcement of the RTMPS encrypted live-stream some older hardware and software encoders can no longer work. By using the method below we can convert RTM…

update

sudo apt-get update
sudo apt-get upgrade

install nginx

sudo apt-get install nginx -y
sudo apt-get install libnginx-mod-rtmp -y
@amitkhare
amitkhare / sub.example.com.conf
Last active May 9, 2020 19:56
Apache2 Reverse Proxy with web-sockets and SSL
<VirtualHost *:80>
ServerName sub.example.com
ProxyPreserveHost On
SSLProxyEngine On
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
@amitkhare
amitkhare / node_nginx_ssl.md
Created May 6, 2020 06:48 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

#!/bin/sh
dirbase="/var/www/"
# cd $dirbase
read -p "Current Directory as base?(y/N) " isCurrDir
if [ "$isCurrDir" = "Y" ] || [ "$isCurrDir" = "y" ]; then
dirpath=$(pwd)
var inX = 0; // -100 to +100;
var inY = 0; // -100 to +100;;
var inZ = 0; // -100 to +100;
var inW = 100; // 0 to 100;
var inH = 100; // 0 to 100;
var areaW = d; // out Width range
var areaH = e; // out Height range
@amitkhare
amitkhare / .rtorrent.rc
Created April 9, 2020 20:27
sample rtorrent.rc file with move on complete
# Where rTorrent saves the downloaded files
directory= /srv/torrent/downloads
# Where rTorrent saves the session
session.path.set = /srv/torrent/.session
# Which ports rTorrent can use (Make sure to open them in your router)
network.port_range.set = 50000-50000
network.port_random.set = no