Skip to content

Instantly share code, notes, and snippets.

Always Eager

Humoyun humoyun

Always Eager
View GitHub Profile
humoyun / frontend-ws-connection.ts
Created May 6, 2021 — forked from jsdevtom/frontend-ws-connection.ts
kubernetes-ingress websockets with nodejs
View frontend-ws-connection.ts
export const ws = webSocket<WebsocketMessage>(`wss://${location.hostname}:${location.protocol === 'https:' ? 443 : 80}/ws/`);
export const wsObserver = ws
retryWhen(errors =>
humoyun / doSegmentsIntersect.js
Created May 2, 2021 — forked from lengstrom/doSegmentsIntersect.js
Algorithm for checking whether two line segments intersect, written in Javascript.
View doSegmentsIntersect.js
function intersect(x1, y1, x2, y2, x3, y3, x4, y4){
var a1, a2, b1, b2, c1, c2;
var r1, r2 , r3, r4;
var denom, offset, num;
// Compute a1, b1, c1, where line joining points 1 and 2
// is "a1 x + b1 y + c1 = 0".
a1 = y2 - y1;
b1 = x1 - x2;
c1 = (x2 * y1) - (x1 * y2);
humoyun /
Created Jan 6, 2020 — forked from protrolium/
using ffmpeg to extract audio from video files


Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

humoyun /
Created Oct 12, 2019 — forked from bradtraversy/
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

humoyun /
Created Aug 15, 2019 — forked from jareware/
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

humoyun / gist:9495abdf5c1b906b30ddd6528e3161e5
Created Jan 16, 2018 — forked from ichord/gist:9808444
demo of using pdf.js to extract pages to images
View gist:9495abdf5c1b906b30ddd6528e3161e5
<script src=""></script><html>
Created using
Source can be edited via
<canvas id="the-canvas" style="border:1px solid black"></canvas>
<input id='pdf' type='file'/>
<!-- Use latest PDF.js build from Github -->
humoyun /
Created Jan 13, 2018 — forked from joyrexus/
Node.js streams demystified

A quick overview of the node.js streams interface with basic examples.

This is based on @brycebaril's presentation, Node.js Streams2 Demystified


Streams are a first-class construct in Node.js for handling data.

Think of them as as lazy evaluation applied to data.

View tuning_storm_trident.asciidoc

Tuning Storm+Trident

Tuning a dataflow system is easy:

The First Rule of Dataflow Tuning:
* Ensure each stage is always ready to accept records, and
* Deliver each processed record promptly to its destination