Skip to content

Instantly share code, notes, and snippets.

View trungkak's full-sized avatar

Trung Lê Hoàng trungkak

View GitHub Profile
@trungkak
trungkak / ubuntu_agnoster_install.md
Created January 7, 2019 02:24 — forked from renshuki/ubuntu_agnoster_install.md
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

from graphviz import Digraph
import re
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from torch.autograd import Variable
import torchvision.models as models
def make_dot(var):
@trungkak
trungkak / zsh.md
Created July 22, 2018 14:47 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu
@trungkak
trungkak / smartsvn-unity-launcher.txt
Created July 19, 2018 03:45 — forked from byk0t/smartsvn-unity-launcher.txt
How to create ubuntu unitiy dash launcher for smartsvn application
1.Create desktop config file
sudo nano /usr/share/applications/smartsvn.desktop
2. Put the text below
[Desktop Entry]
Name=SmartSVN
Name[en]=SmartSVN
Name[ru]=SmartSVN
@trungkak
trungkak / tfpdf.py
Created June 28, 2018 18:52 — forked from bllchmbrs/tfpdf.py
TF IDF Explained in Python Along with Scikit-Learn Implementation
from __future__ import division
import string
import math
tokenize = lambda doc: doc.lower().split(" ")
document_0 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy."
document_1 = "At last, China seems serious about confronting an endemic problem: domestic violence and corruption."
document_2 = "Japan's prime minister, Shinzo Abe, is working towards healing the economic turmoil in his own country for his view on the future of his people."
document_3 = "Vladimir Putin is working hard to fix the economy in Russia as the Ruble has tumbled."
@trungkak
trungkak / PostgreSQL Challenges Completed.md
Created April 29, 2018 16:07 — forked from samlexrod/PostgreSQL Challenges Completed.md
Here I show my commitment to challenge myself to building better queries from places such as codewars, hacker rank, or others.

PostgreSQL Challenges

  1. You need to build a pivot table WITHOUT using CROSSTAB function. Having two tables products and details you need to select a pivot table of products with counts of details occurrences (possible details values are ['good', 'ok', 'bad'].
SELECT
  distinct pro.name,
  (SELECT count(*) FROM details det2 WHERE det2.detail = 'good' AND det2.product_id = det.product_id) AS good,
  (SELECT count(*) FROM details det2 WHERE det2.detail = 'ok' AND det2.product_id = det.product_id) AS ok,
 (SELECT count(*) FROM details det2 WHERE det2.detail = 'bad' AND det2.product_id = det.product_id) AS bad
@trungkak
trungkak / neo4j_cypher_cheatsheet.md
Created April 23, 2018 08:56 — forked from DaniSancas/neo4j_cypher_cheatsheet.md
Neo4j's Cypher queries cheatsheet

Neo4j Tutorial

Fundamentals

Store any kind of data using the following graph concepts:

  • Node: Graph data records
  • Relationship: Connect nodes (has direction and a type)
  • Property: Stores data in key-value pair in nodes and relationships
  • Label: Groups nodes and relationships (optional)
@trungkak
trungkak / hello_sequence.py
Created March 22, 2018 17:59 — forked from pannous/hello_sequence.py
Simple "Hello World" for tensorflow seq2seq model
"""Sequence-to-sequence model with an attention mechanism."""
# see https://www.tensorflow.org/versions/r0.10/tutorials/seq2seq/index.html
# compare https://github.com/tflearn/tflearn/blob/master/examples/nlp/seq2seq_example.py
from __future__ import print_function
import numpy as np
import tensorflow as tf
vocab_size=256 # We are lazy, so we avoid fency mapping and just use one *class* per character/byte
target_vocab_size=vocab_size
learning_rate=0.1
@trungkak
trungkak / install-opencv-2.4.13.4-in-ubuntu.sh
Last active December 12, 2017 10:00 — forked from arthurbeggs/install_opencv2_ubuntu.sh
Install opencv-2.4.13.4 in Ubuntu
#!/bin/bash
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev
@trungkak
trungkak / min-char-rnn.py
Created October 21, 2017 18:34 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)