Skip to content

Instantly share code, notes, and snippets.

@hungneox
hungneox / WIN10.MD
Last active August 2, 2025 12:35
How Make a Windows 10 USB Using Your Mac - Build a Bootable ISO From Your Mac's Terminal

Most new PCs don't come with DVD drives anymore. So it can be a pain to install Windows on a new computer.

Luckily, Microsoft makes a tool that you can use to install Windows from a USB storage drive (or "thumbdrive" as they are often called).

But what if you don't have a second PC for setting up that USB storage drive in the first place?

In this tutorial we'll show you how you can set this up from a Mac.

Step 1: Download the Windows 10 ISO file

You can download the ISO file straight from Windows. That's right - everything we're going to do here is 100% legal and sanctioned by Microsoft.

@hungneox
hungneox / nginxproxy.md
Created January 12, 2020 13:37 — 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

@hungneox
hungneox / README.md
Last active January 11, 2020 13:50
Run superset with gunicorn
@hungneox
hungneox / tostring.go
Created December 9, 2019 12:57
Struct to string
type Person struct {
FirstName string
LastName string
Age int
}
func asFields(data interface{}) string {
v := reflect.ValueOf(data)
b := &strings.Builder{}
@hungneox
hungneox / main.scala
Last active November 11, 2019 00:30
Pipe operator in scala
package helloworld
object Main {
implicit class Pipe[A](val a: A) extends AnyVal {
def |>[B](f: A => B): B = f(a)
}
def main(args: Array[String]): Unit = {

Data Ingestion with Apache Nifi

The goal is to design simple flows that can be used to ingest data from files by copying and moving files as well as using brokers to send file contents.

Setup

Apache Nifi

You can download Apache Nifi and install it into your machine. Note that the current Apache Nifi needs Java 8. Check the document to see if a minimum configuration should be made for your installation.

Start Nifi server

@hungneox
hungneox / env2json.py
Created June 24, 2019 08:38
Tools for converting .env to Azure webapp settings json
#!/usr/bin/python3
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-f", "--file", dest="filename", help="path to .env file", metavar="FILE")
args = parser.parse_args()
if (args.filename):
@hungneox
hungneox / export_csv_postgres.sql
Last active June 11, 2019 16:14
Export table data to stdout as csv
copy (select * from table_name) TO STDOUT DELIMITER ';' CSV HEADER
@hungneox
hungneox / phantom.dart
Last active June 11, 2019 00:06
Phantom types Dart lang
// https://dev.to/busypeoples/notes-on-typescript-phantom-types-kg9
class FormData<T> {
String value;
FormData(String v) {
value = v;
}
String toString() {
return value;
}
@hungneox
hungneox / face-regconition-opencv.py
Created January 27, 2019 21:11
Nhận diện gương mặt bằng OpenCV
import cv2
cap = cv2.VideoCapture(0)
cap.set(3, 640) # WIDTH
cap.set(4, 480) # HEIGHT
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')
while(True):