Skip to content

Instantly share code, notes, and snippets.

View lamngockhuong's full-sized avatar
🍊
Working

Lâm Ngọc Khương lamngockhuong

🍊
Working
View GitHub Profile
@lamngockhuong
lamngockhuong / linux.md
Last active December 30, 2017 16:43
[Linux notes] #linux
$ pkill --oldest chrome // kill chrome process
Change file names with string pattern
rename 's/(.*)/[ngockhuong]_$1/' *.jpg
@lamngockhuong
lamngockhuong / postgresql.md
Last active December 30, 2017 16:44
[Learn postgresql] #postgresql

Linux

$ sudo service postgresql start
$ sudo service postgresql restart
$ sudo service postgresql stop

login postgresql

$ sudo -u postgres psql
@lamngockhuong
lamngockhuong / how-to-set-phpmyadmin-password-on-xampp.md
Last active December 29, 2024 23:36
[How to set phpmyadmin password on xampp] #phpmyadmin #xampp
  1. Goto "phpmyadmin" folder, find and open "config.inc.php" file
  2. Find the line: $cfg [‘Servers’] [$a] [‘auth_type’] = ‘config’; in “config.inc.php” file.
  3. Change the word $cfg [‘Servers’] [$a] [‘auth_type’] = ‘config’; to $cfg [‘Servers’] [$a] [‘auth_type’] = ‘cookie’; in “config.inc.php” file and Save the changes.
  4. Now open browser and type “localhost/phpmyadmin”. Enter username is “root“. password is null means empty. you don’t type anything leave blank and press GO button.
  5. Now you can see “change password” link. please click that link.
  6. Set your phpMyAdmin password and retype again and press GO button.

@lamngockhuong
lamngockhuong / MD5.java
Last active November 8, 2023 15:41
[Mã hóa MD5 trong Java] #java
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* Author: Lam Ngoc Khuong
* Website: http://ngockhuong.com - Programming knowledge sharing
*/
public class MD5 {
@lamngockhuong
lamngockhuong / Slug.java
Last active December 29, 2017 09:50
[Convert Text to Slug String in web] #java
public class Slug {
public String createSlug(String title) {
String slug = Normalizer.normalize(title, Normalizer.Form.NFD);
Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+");
slug = pattern.matcher(slug).replaceAll("");
slug = slug.toLowerCase();
// Thay đ thành d
slug = slug.replaceAll("đ", "d");
// Xóa các ký tự đặt biệt
slug = slug.replaceAll("([^0-9a-z-\\s])", "");
@lamngockhuong
lamngockhuong / docker-learning.md
Last active December 30, 2017 16:41
[Docker Learning] #docker

Learning the Docker with ngockhuong.com

Khởi động docker

service docker start

Kiểm tra phiên bản docker đang dùng

docker version

Liệt kê danh sách image hiện có

docker images

Kiểm tra container nào đang chạy

docker ps

Kiểm tra có tất cả bao nhiêu container có trong máy
@lamngockhuong
lamngockhuong / gist:1493d1bddfbcae8947295f1e22fc6aab
Last active December 30, 2017 16:25
[Difference between / and /* in servlet mapping url pattern] #java #jsp #servlet
<url-pattern>/*</url-pattern>
The /* on a servlet overrides all other servlets, including all servlets provided by the servletcontainer such as the default servlet and the JSP servlet. Whatever request you fire, it will end up in that servlet. This is thus a bad URL pattern for servlets. Usually, you'd like to use /* on a Filter only. It is able to let the request continue to any of the servlets listening on a more specific URL pattern by calling FilterChain#doFilter().
<url-pattern>/</url-pattern>
The / doesn't override any other servlet. It only replaces the servletcontainer's builtin default servlet for all requests which doesn't match any other registered servlet. This is normally only invoked on static resources (CSS/JS/image/etc) and directory listings. The servletcontainer's builtin default servlet is also capable of dealing with HTTP cache requests, media (audio/video) streaming and file download resumes. Usually, you don't want to override the default servlet as you would otherwise have to take ca
@lamngockhuong
lamngockhuong / android-note.md
Last active December 30, 2017 16:38
[Android Ref Link] #android
@lamngockhuong
lamngockhuong / ajax.md
Last active July 28, 2019 16:34
[Ajax JQuery] #ajax #js
<script>		
  $.ajax({
    url: 'URL',
    type: '',
    cache: false,
    data: {
    //Dữ liệu gửi đi
    },
 success: function(data){