Skip to content

Instantly share code, notes, and snippets.

View th0j's full-sized avatar
💭
🚀 🚀

Tho Vo th0j

💭
🚀 🚀
View GitHub Profile
@th0j
th0j / shellconfig.sh
Last active April 11, 2017 04:41
Vagrant Java
echo " ========== Install Java 8 ========== "
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections
sudo apt-get -f install -y oracle-java8-installer
echo 'JAVA_HOME="/usr/lib/jvm/java-8-oracle"' >> ~/.bash_profile
echo 'JAVA_HOME="/usr/lib/jvm/java-8-oracle"' >> ~/.bash
echo " ========== Install MYSQL 5.5 ========== "
export DEBIAN_FRONTEND=noninteractive
@th0j
th0j / install_server_centos.sh
Last active April 27, 2017 03:24
install_server_centos
echo 'UPDATE YUM'
yum update -y
yum upgrade -y
yum install -y wget
echo 'DISABLE FIREWALL'
service iptables stop
chkconfig iptables off
echo 'INSTALL JAVA'
@th0j
th0j / find_second_salary.sql
Created June 8, 2017 14:04
find_second_salary.sql
select MAX(Salary) from Employee WHERE Salary NOT IN (select MAX(Salary) from Employee);
@th0j
th0j / User.java
Created June 9, 2017 03:24
Not use lombok
public class User implements java.io.Serializable{
public String username;
public String email;
public String getUsername() {
return username;
}
public void setUsername(String username) {
@th0j
th0j / User(lombok).java
Created June 9, 2017 03:33
User.java with Lombok library
import lombok.Getter;
import lombok.Setter;
public class User implements java.io.Serializable{
@Setter @Getter
public String username;
@Setter @Getter
public String email;
------------------ CREATE SAMPLE DATABASE ------------------
CREATE TABLE depts(
dept_id INT PRIMARY KEY,
dept_name VARCHAR(50) NOT NULL
);
CREATE TABLE Employees(
employee_id INT PRIMARY KEY,
dept_id INT NOT NULL,
@th0j
th0j / Dockerfile
Created October 9, 2017 15:59
Speedup docker
FROM ruby:2.4.1-alpine3.6
RUN apk add --update build-base libffi-dev libxml2-dev libxslt-dev postgresql-dev nodejs tzdata bash
ENV RAILS_ENV=production \
APP_HOME=/app \
ENV BUNDLE_PATH /bundle
RUN mkdir -p $APP_HOME
@th0j
th0j / Dockerfile
Last active April 5, 2018 16:35
Docker alpine + Rails + Postgresql
FROM ruby:2.4.1-alpine3.6
RUN apk add --update build-base libffi-dev libxml2-dev libxslt-dev postgresql-dev nodejs tzdata bash
ENV RAILS_ENV=production \
APP_HOME=/app
ENV BUNDLE_PATH /box
RUN mkdir -p $APP_HOME
@th0j
th0j / curl.sh
Created April 9, 2018 08:44
Curl multipart/form-data
curl -X POST -H "Content-Type: multipart/form-data" -F cloud_storages[]["bookmark_data"]=@arch_screenshot.png -F cloud_storages[]["real_filename"]=test_1 -F cloud_storages[]["ext"]=jpg -F cloud_storages[]["bookmark_data"]=@arch_screenshot.png -F cloud_storages[]["real_filename"]=test_2 -F cloud_storages[]["ext"]=png localhost:3000/api/v2/cloud_storages?keyapi=03da0b83c3dab8e2a48d28d1944b08dd
@th0j
th0j / ci.sh
Last active May 8, 2018 15:01
Setup shell for Jenkins CI
cd /var/lib/jenkins/workspace/rails_ci_1
ruby -v
gem install bundler
bundle install