Skip to content

Instantly share code, notes, and snippets.

View ancs21's full-sized avatar
🍰

An Pham ancs21

🍰
  • 0xF0 0x9F 0x8C 0x8F
  • 14:40 (UTC +07:00)
View GitHub Profile
@ancs21
ancs21 / docker-mysql.sh
Last active November 5, 2018 12:59
Install Docker on Ubuntu 16.04
sudo docker run --name some-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=yourpassword -d mysql
# execute
sudo docker exec -it some-mysql sh
@ancs21
ancs21 / install-error-fix-tfjs-node.md
Last active November 13, 2018 16:53
Install tfjs-node

Please use version 8.11.3

yarn add @tensorflow/tfjs @tensorflow/tfjs-node

Error show

yarn add v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
@ancs21
ancs21 / nodemailer.js
Created November 18, 2018 12:29
Send mail firebase function api
import * as functions from 'firebase-functions'
import * as nodemailer from 'nodemailer'
import * as cors from 'cors'
const corsHandler = cors({ origin: true })
export const form = functions.https.onRequest((req, res) => {
const corsFn = cors()
corsFn(req, res, function() {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
@ancs21
ancs21 / 4.sql
Last active November 22, 2018 09:52
Database Management
-- 4.1
create or replace procedure GoiTen(mgvien giaovien.magv%type)
is
tengv giaovien.hoten%type;
phaigv giaovien.phai%type;
begin
select hoten, phai into tengv, phaigv from giaovien where magv = mgvien;
if phaigv = '1' then
dbms_output.put_line('Co ' || tengv);
@ancs21
ancs21 / GUI.py
Last active November 23, 2018 19:38
AES-256 ECB and DES with PyCrypto
# -*- coding: utf-8 -*-
from Crypto.Cipher import DES3
from Crypto.Cipher import AES
from Crypto import Random
# 1. Sinh khóa và lưu khóa
key = b'abcdefgh12345678'
# 2. Đọc khóa và tạo mật mã / giải mật mã DES (ECB, CBC)
@ancs21
ancs21 / promise-with-shell-in-node.js
Last active July 20, 2019 10:11
Promise with shell in Node.js
const { exec } = require('child_process')
/**
* Executes shell command and return as a Promise.
* @param cmd {string}
* @return {Promise<string>}
*/
const execShell = cmd => {
return new Promise((resolve, reject) => {
@ancs21
ancs21 / docker.sh
Created August 27, 2020 06:26
Install few-line
# update first
sudo apt update
# install docker
curl -fsSL get.docker.com -o get-docker.sh && sudo sh get-docker.sh
# Add user to the "docker" group
sudo usermod -aG docker $USER
# install docker-compose
@ancs21
ancs21 / README.md
Created September 4, 2021 14:15
Find and delete node_modules folder tips

Typed name:node_modules type:(file folder) into the search box

@ancs21
ancs21 / 3.11.4.txt
Last active August 7, 2023 13:43
Install Python 3.11.4 on Ubuntu 20.4
# install dependency
sudo apt-get install -y lzma liblzma-dev libreadline-dev libsqlite3-dev libffi-dev libpq-dev
# install pyenv
curl https://pyenv.run | bash
# post-script
# add output from shell
# install python 3.11.4