This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ivy-module version="2.4"> | |
<info organisation="com.github.viettd" module="sample-api" /> | |
<dependencies> | |
<dependency org="commons-configuration" name="commons-configuration" rev="1.10"/> | |
<dependency org="org.slf4j" name="slf4j-simple" rev="1.7.12"/> | |
<dependency org="org.eclipse.jetty" name="jetty-server" rev="9.3.8.v20160314"/> | |
<dependency org="org.eclipse.jetty" name="jetty-servlet" rev="9.3.8.v20160314"/> | |
<dependency org="org.mongodb" name="mongodb-driver" rev="3.2.2"/> | |
<dependency org="com.google.code.gson" name="gson" rev="2.6.2"/> | |
<dependency org="commons-io" name="commons-io" rev="2.5"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project name="sample-api" default="default" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant"> | |
<description>Builds, tests, and runs the project user_api.</description> | |
<import file="nbproject/build-impl.xml"/> | |
<property name="ivy.jar.file" value="/home/viettd/netbeans-8.1/extide/ant/lib/ivy-2.4.0.jar" /> | |
<target name="ivy-set-path" description="sets path to ivy file"> | |
<path id="ivy.lib.path"> | |
<pathelement location="${ivy.jar.file}"/> | |
</path> | |
<taskdef resource="org/apache/ivy/ant/antlib.xml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Root logger option | |
log4j.rootLogger=INFO,stdout,main | |
# stdout | |
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | |
log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout | |
# Direct log messages to a log file | |
log4j.appender.main=org.apache.log4j.DailyRollingFileAppender | |
log4j.appender.main.DatePattern='.'yyyy-MM-dd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.viettd.how.to; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.zip.ZipEntry; | |
import java.util.zip.ZipInputStream; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo dd if=/dev/zero of=/swapfile count=2048 bs=1MiB | |
sudo chmod 600 /swapfile | |
sudo mkswap /swapfile | |
sudo swapon /swapfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1 | |
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
//2 | |
jQuery.noConflict(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use `your_schema`; | |
drop function if exists `get_distance`; | |
delimiter $$ | |
use `your_schema`$$ | |
create function `get_distance` (lat1 decimal(9,6), lng1 decimal(9,6), lat2 decimal(9,6), lng2 decimal(9,6)) returns decimal(10,3) | |
begin | |
declare R decimal(30,15); | |
declare rlat1 decimal(30,15); | |
declare rlat2 decimal(30,15); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<String> unzip(String zipFilePath) { | |
try { | |
File zipFile = new File(zipFilePath); | |
try (ZipInputStream inputStream = new ZipInputStream(new FileInputStream(zipFile))) { | |
List<String> fileList = new ArrayList<>(); | |
ZipEntry entry = inputStream.getNextEntry(); | |
while (entry != null) { | |
File newFile = new File(zipFile.getParent() + File.separator + entry.getName()); | |
new File(newFile.getParent()).mkdirs(); | |
if (!entry.isDirectory()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host github.com | |
HostName github.com | |
User git | |
IdentityFile ~/.ssh/viet_zm_mac | |
Host gitlab.com | |
HostName gitlab.com | |
User git | |
IdentityFile ~/.ssh/viet_zm_mac | |
Host bitbucket.org | |
HostName bitbucket.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
import net.sf.json.JSONArray; | |
import net.sf.json.JSONObject; | |
import hudson.model.Actionable; | |
pipeline { | |
agent { label 'golang' } | |
options { | |
ansiColor('xterm') |
OlderNewer