Skip to content

Instantly share code, notes, and snippets.

View Huy-Ngo's full-sized avatar
💻
Not GitHubbed

Ngô Ngọc Đức Huy Huy-Ngo

💻
Not GitHubbed
View GitHub Profile
@Huy-Ngo
Huy-Ngo / scatter.py
Last active February 4, 2021 14:36
Drawing scatter plot
import numpy as np
X_large = np.array([X_pca[i] for i in range(len(y)) if y[i] > y.mean()])
X_small = np.array([X_pca[i] for i in range(len(y)) if y[i] < y.mean()])
plt.figure(figsize=(9, 6))
plt.scatter(X_large[:, 0], X_large[:, 1], label="larger than mean")
plt.scatter(X_small[:, 0], X_small[:, 1], label="smaller than mean")
plt.legend()
@Huy-Ngo
Huy-Ngo / questions.json
Last active November 14, 2020 02:35
OOAD Question bank practice
[
{
"q": "Which statement is true about an iterative development process?",
"a": {
"A": "Testing and integration take place in every iteration",
"B": "An iteration focuses on partial completion of selected use-case realizations.",
"C": "It encourages user feedback in later iterations",
"D": "It is based on functional decomposition of a system"
},
"correct": "A"
@Huy-Ngo
Huy-Ngo / log.txt
Created July 29, 2020 10:07
pycrypto: failed installation
Installing dependencies from Pipfile.lock (f1d158)…
Ignoring backports.functools-lru-cache: markers 'python_version < "3"' don't match your environment
Looking in indexes: https://pypi.python.org/simple
Ignoring cachetools: markers 'python_version == "2.7"' don't match your environment
Looking in indexes: https://pypi.python.org/simple
Ignoring configparser: markers 'python_version < "3"' don't match your environment
Looking in indexes: https://pypi.python.org/simple
Ignoring contextlib2: markers 'python_version < "3"' don't match your en
@Huy-Ngo
Huy-Ngo / gen_words.py
Last active July 28, 2020 10:08
Generate words
from random import choice, random, choices
N_WORDS = 10000
syllable_structure = 'CwVTf' # lowercase = optional
letters = {
'V': ['a', 'i', 'u', 'o', 'e', 'é', 'ó', 'ö', 'ü'],
'C': ['p', 'b', 't', 'd', 'm', 'f', 'v', 'n', 'ñ', 'g', 's', 'z', 'c', 'j',
'sh', 'zh', 'ch', 'jh', 'kh', 'gh', 'k', 'h', 'r', 'w', 'y'],
'f': ['p', 't', 'm', 'n', 'ñ', 'g', 's', 'z', 'c', 'sh', 'zh', 'ch', 'kh',
'gh', 'k', 'w', 'y'],
Data:
Received: by mail-wr1-f47.google.com with SMTP id 88so1180248wrh.3
for <xb2jzms0@15minmail.tk>; Wed, 22 Jul 2020 02:20:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20161025;
h=mime-version:from:date:message-id:subject:to;
bh=caNUne9CMXNTIOKAw0Q2iG7yO8vLW3PLKcjhkJCX1hs=;
b=pyJu1utlVR7jTR5vsN9jP3SQhj8GQO794fUZl2QgPitzkDAfvyd+nYuMklCnXVvHUN
nfP8Xt90K14OaHg8LfzvN2sfokTSa3PPflV+1FTfSaBaepMvuelJo2xVE2/8CuUOgp4y
niARyPCnAxmJH+0ZtZqZQW0p78zkJ9mUkPWUF55Uy34EXnVu4yQK6imlSQGy631J4aJQ
Data:
b'Received: by mail-wm1-f48.google.com with SMTP id f18so1093864wml.3\n for <6m48t39x@15minmail.tk>; Wed, 22 Jul 2020 01:11:29 -0700 (PDT)\nDKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20161025;\n h=mime-version:from:date:message-id:subject:to;\n bh=zmG2HoahYkoKd+rQDfXczxTlH4Oe8g4grY95S4REoUg=;\n b=L/DWzNVNNgL1/XVj6Uh3dvwTVnQAMwFe3LB1Kbg8LsdZ9LNmmITrTMXdW8Dso3iBzG\n o8LctWB97VkwG4P/APeB+/pG7korxATK0hTyASNX8IiI/xmRTvVsGFZTTYn+We9gfXdN\n wKNnUubB3IT5nK6LZJhz1+h5fWmu5CWF/nn9DSXMUpd1JK6wSdTwop6nZgaUcrFfeyY3\n HCbMq7o7X+5BS/RcV8kwv7SfFpq/Kh7ibkv6HYRhGQ2pzm486cas/AQuiDn734DqkT0G\n Va7SnttEXOC/KxcUdwTY/TB1Wn5s+rWDI7dHmR8jF7dVYH9oMOJ5thhEQfznbU0Krkfc\n VJqw==\nX-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:mime-version:from:date:message-id:subject:to;\n bh=zmG2HoahYkoKd+rQDfXczxTlH4Oe8g4grY95S4REoUg=;\n b=HNQBPAhiUTqpWy
@Huy-Ngo
Huy-Ngo / router-1-ifconfig
Last active July 1, 2020 14:18
Network debug
xarvos@router-1:~$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::a00:27ff:fec7:4036 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:c7:40:36 txqueuelen 1000 (Ethernet)
RX packets 45028 bytes 53661238 (53.6 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8188 bytes 682102 (682.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
@Huy-Ngo
Huy-Ngo / cmake build
Created May 11, 2020 13:31
Cmake output
C:\Users\Admin\openal_build\app_build>cmake -A x64 -S ..\alure -B ..\alure\build
-- Building for: Visual Studio 16 2019
-- The C compiler identification is MSVC 19.25.28614.0
-- The CXX compiler identification is MSVC 19.25.28614.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
@Huy-Ngo
Huy-Ngo / abstract.js
Last active May 7, 2020 12:55
Take only the function declaration out of the code
str = str.replace(/package.*/g, "")
str = str.replace(/import.*/g, "")
// Remove comments
str = str.replace(/\/\*(.|\n)*?\*\//g, "")
// Remove contents in a block (if it's 4-space indented and is within a class)
str = str.replace(/\s\s\s\s\s\s.*/g, "")
// Remove parentheses
str = str.replace(/[{}]/g, "")
// remove newlines
str = str.replace(/(\s+)\n+/g, "\n")
This file has been truncated, but you can view the full file.
array('f', [0.0, 5.141890246918024e-10, 1.0283780493836048e-09, 1.5425671850977096e-09, 2.0567560987672096e-09, 2.5709452344813144e-09, 3.0851343701954193e-09, 3.599323283864919e-09, 4.113512197534419e-09, 4.627701333248524e-09, 5.141890468962629e-09, 5.656079604676734e-09, 6.1702687403908385e-09, 6.6844574320157335e-09, 7.198646567729838e-09, 7.712835703443943e-09, 8.227024395068838e-09, 8.741213974872153e-09, 9.255402666497048e-09, 9.769592246300363e-09, 1.0283780937925258e-08, 1.0797969629550153e-08, 1.1312159209353467e-08, 1.1826347900978362e-08, 1.2340537480781677e-08, 1.2854726172406572e-08, 1.3368914864031467e-08, 1.3883104443834782e-08, 1.4397293135459677e-08, 1.4911481827084572e-08, 1.5425671406887886e-08, 1.59398609866912e-08, 1.6454048790137676e-08, 1.696823836994099e-08, 1.7482427949744306e-08, 1.799661575319078e-08, 1.8510805332994096e-08, 1.902499491279741e-08, 1.9539184492600725e-08, 2.00533722960472e-08, 2.0567561875850515e-08, 2.108175145565383e-08, 2.1595939259100305e-08, 2.211012883890362e-