Skip to content

Instantly share code, notes, and snippets.

View tranduydat's full-sized avatar
🦆
Run

Dat Tran tranduydat

🦆
Run
View GitHub Profile
@tranduydat
tranduydat / .vimrc
Last active October 27, 2018 07:56
.vimrc config
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree' " Files manager.
Plug 'nightsense/stellarized'
Plug 'itchyny/lightline.vim'
Plug 'dracula/vim', { 'as': 'dracula' }
call plug#end()
"========== General Configs ==========
@tranduydat
tranduydat / fonts-spacemacs-install.sh
Last active August 3, 2018 14:24
Script auto install necessary fonts for Spacemacs
#!/bin/sh
# Userland mode (~$USER/), (~/).
# ~/.fonts is now deprecated and that
#FONT_HOME=~/.fonts
# ~/.local/share/fonts should be used instead
FONT_HOME=~/.local/share/fonts
echo "installing fonts at $PWD to $FONT_HOME"
mkdir -p "$FONT_HOME/adobe-fonts/source-code-pro"
@tranduydat
tranduydat / note.txt
Created July 13, 2018 02:27
#JUSTNOTE
[Emacs] M-x text-scale-increase: increase font size
// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
// cam bien sieu am config
const unsigned int TRIG_PIN = 7;
@tranduydat
tranduydat / 12.6.txt
Last active March 8, 2020 16:29
12.6
// X = (A + B * C)/(D - E * F)
// three-address code
MPY Y, B, C
ADD Y, Y, A
MPY Z, E, F
SUB Z, D, Z
DIV X, Y, Z
@tranduydat
tranduydat / 6.cpp
Created March 12, 2020 01:58
Exercise 6
// ex 6
#include <stdio.h>
void enterArray(int *a, int &n)
{
printf("How many elements do you want to put into this array?\nEnter n: ");
scanf("%d", &n);
for (int i = 0; i < n; i++)
{
@tranduydat
tranduydat / fix-git.txt
Last active August 13, 2020 15:05
Hot fix Github commands
git pull origin master --allow-unrelated-histories
git config --global credential.helper cache
@tranduydat
tranduydat / install-oracle-jdk-1.8.sh
Created August 11, 2020 17:27
Install Oracle JDK 1.8 (or newer) on Ubuntu
# Go to https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
# then download 'jdk-8u261-linux-x64.tar.gz' (for Linux 64-bit)
# cd to your Downloads directory then run Terminal
sudo mkdir -p /usr/lib/jdk
sudo tar zxvf jdk-8u261-linux-x64.tar.gz -C /usr/lib/jdk
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jdk/jdk1.8.0_261/bin/java" 1
sudo update-alternatives --set java /usr/lib/jdk/jdk1.8.0_261/bin/java
java -version
# Install spaCy
pip3 install -U spacy
# Download the large English model for spaCy
python3 -m spacy download en_core_web_lg
# Install textacy which will also be useful
pip3 install -U textacy
# Insert into file.py
@tranduydat
tranduydat / Vinmec_QA.py
Created September 1, 2020 10:10
Vinmec_QA.py
import scrapy
import re
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
# TODO
# get the h2 article (1 per page)
class Vinmec_QA(scrapy.Spider):
name = "Vinmec_QA"
allowed_domains = ['vinmec.com']