Skip to content

Instantly share code, notes, and snippets.

View lap00zza's full-sized avatar
🏠
Working from home

Jewel Mahanta lap00zza

🏠
Working from home
View GitHub Profile
@kentbrew
kentbrew / node-on-ec2-port-80.md
Last active February 4, 2024 19:14
How I Got Node.js Talking on EC2's Port 80

The Problem

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. How, then, could I get Node talking on port 80 on EC2? (I wanted it to go as fast as possible and use the smallest possible share of my teeny tiny little micro-instance's resources, so proxying through nginx or Apache seemed suboptimal.)

The temptingly easy but ultimately wrong solution:

Alter the port the script talks to from 8000 to 80:

}).listen(80);
var attempts = 1;
function createWebSocket () {
var connection = new WebSocket();
connection.onopen = function () {
// reset the tries back to 1 since we have a new connection opened.
attempts = 1;
// ...Your app's logic...
@nickautomatic
nickautomatic / cmder.md
Last active September 20, 2023 13:59
Setting up Cmder to use bash by default

Set up cmder to use msysgit / bash by default

  • Install cmder_mini (msysgit is already installed, so no need for full version)
  • In Cmder, open settings: Win + Alt + P
  • Under Startup > Tasks, add a task called {bash} with the following settings:
    • Task parameters (set icon):
      • For Cmder icon: /icon "%CMDER_ROOT%\cmder.exe"
      • For Git icon: /icon "C:\Program Files (x86)\Git\etc\git.ico"
    • Commands (open Git's bash shell):
  • "C:\Program Files (x86)\Git\bin\sh.exe" -l -new_console:d:%USERPROFILE%
@CMCDragonkai
CMCDragonkai / http_streaming.md
Last active April 10, 2024 21:00
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@joepie91
joepie91 / vpn.md
Last active April 20, 2024 21:15
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@lap00zza
lap00zza / lapzbotAPI.py
Last active July 9, 2016 20:24
lapzbotAPI
# coding=utf-8
"""
LAPZBOT Restful
Handles the inter process communications between Lapzbot and the Console, without having to rely on the database
for Server / User information. This is intended to be run in a thread.
Typical UseCase:
----------------
import lapzbotAPI
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active April 23, 2024 13:36 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@lap00zza
lap00zza / scrapper.js
Last active October 16, 2017 17:27
Scrape anime info from MAL
const h2 = document.querySelectorAll("h2");
const infoH2 = (() => {
for (let i = 0; i < h2.length; i++) {
if (h2[i].innerText === "Information") return h2[i];
}
})();
// holds the elements between the Information (H2) and the next H2
const elList = [];
// start from the element after the H2
let now = infoH2.nextElementSibling;