Skip to content

Instantly share code, notes, and snippets.

View bugb's full-sized avatar
🎯
Do it small and do it well!

Chau Giang bugb

🎯
Do it small and do it well!
View GitHub Profile
#!/bin/sh
set -eu
sudo fallocate -l 2G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
@bugb
bugb / nginxproxy.md
Created January 18, 2020 10:05 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@bugb
bugb / Install_OpenCV3_CUDA9.md
Created January 10, 2020 01:46 — forked from raulqf/Install_OpenCV3_CUDA9.md
Install OpenCV 3.4.1 with CUDA 9.0 support for an Ubuntu 18.04 distro.

How to install OpenCV 3.4.1 with CUDA on Ubuntu distro

First of all install update and upgrade your system:

    $ sudo apt-get update
    $ sudo apt-get upgrade

Then, install required libraries:

@bugb
bugb / gist:9ced8dee5abac749df8d3be56ef8f62d
Created January 3, 2020 04:27 — forked from bigsnarfdude/gist:a0702a88b122be81cb1f4edb55229a7b
[self-driving-car] links and resources
General Nanodegree Information
Nanodegrees Programs: https://www.udacity.com/nanodegree
Nanodegree Plus (job guarantee): https://www.udacity.com/nanodegree/plus
UConnect (weekly in-person study sessions): https://www.udacity.com/uconnect
Courses on Udacity
Machine Learning Engineer Nanodegree by Google (Currently Available): https://www.udacity.com/course/machine-learning-engineer-nanodegree-by-google--nd009
Artificial Intelligence for Robots (Free Course) https://www.udacity.com/course/artificial-intelligence-for-robotics--cs373
Intro to Statistics (Free Course) https://www.udacity.com/course/intro-to-statistics--st101
Deep Learning (Free Course) https://www.udacity.com/course/deep-learning--ud730

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

Keybase proof

I hereby claim:

  • I am bugb on github.
  • I am chaugiang (https://keybase.io/chaugiang) on keybase.
  • I have a public key whose fingerprint is DEEE EB30 ED4F A999 4F96 8629 87C1 9AC3 E474 340F

To claim this, I am signing this object:

@bugb
bugb / gist.md
Last active October 27, 2024 19:00
Mongo DB behind Nginx as reverse proxy, share your Mongo DB with your friends in LAN network

Mongo DB works with raw TCP instead of HTTP so we need create stream with Nginx.

Add the below code above http block in nginx config file (eg: /etc/nginx/nginx.conf for Ubuntu)

stream {
    server {
        listen  9999;
        proxy_connect_timeout 1s;
 proxy_timeout 3s;
@bugb
bugb / youtube.js
Created July 20, 2019 16:09 — forked from max-te/youtube.js
Download Youtube-Video in node.js
var http = require('http')
var fs = require('fs')
var argv = require('optimist').argv
var rxVideoID = /v=([\]\[!"#$%'()*+,.\/:;<=>?@\^_`{|}~-\w]*)/
var link = argv._.toString()
var videoID = link.match(rxVideoID)[1]
http.get("http://www.youtube.com/get_video_info?video_id="+videoID, function(res) {
var chunks = []
@bugb
bugb / gist:ba5a1308ec5b0a5766a09aaa636d3f89
Created July 18, 2019 12:23 — forked from mharsch/gist:5188206
serve HLS (HTTP Live Streaming) content from node.js

HLS streaming from node

Provided that you already have a file or stream segmenter generating your .m3u8 playlist and .ts segment files (such as the ffmpeg 'hls' muxer), this little node server will serve up those files to an HLS compatible client (e.g. Safari). If you're using node for your streaming app already, this obviates the need to serve the HLS stream from a separate web server.

loosely based on https://gist.github.com/bnerd/2011232

// loosely based on https://gist.github.com/bnerd/2011232
// requires node.js >= v0.10.0
// assumes that HLS segmenter filename base is 'out'
// and that the HLS playlist and .ts files are in the current directory

Keybase proof

I hereby claim:

  • I am bugb on github.
  • I am chaugiang (https://keybase.io/chaugiang) on keybase.
  • I have a public key ASCVt4o9PSa_aaPUFv4ke4ZfOTKGaXp6HhrZ7qJHOeg02wo

To claim this, I am signing this object: