Skip to content

Instantly share code, notes, and snippets.

View loinguyenduc101's full-sized avatar

Loi Nguyen loinguyenduc101

View GitHub Profile
@loinguyenduc101
loinguyenduc101 / spring log.log
Created April 19, 2016 07:53
spring: [class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016/04/19:14:49:33.479 INFO [RMI TCP Connection(2)-127.0.0.1] : org.springframework.integration.config.DefaultConfiguringBeanFactoryPostProcessor No bean named 'errorChannel' has been explicitly defined. Therefore, a default PublishSubscribeChannel will be created.
2016/04/19:14:49:33.513 INFO [RMI TCP Connection(2)-127.0.0.1] : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016/04/19:14:49:33.777 INFO [RMI TCP Connection(2)-127.0.0.1] : org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor Initializing ExecutorService 'taskExecutor'
2016/04/19:14:49:33.778 INFO [RMI TCP Connection(2)-127.0.0.1] : org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker Bean 'taskExecutor' of type [class org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] is not eligible for getting processed by all BeanPostProcessors (for examp
@loinguyenduc101
loinguyenduc101 / nginx-mobile-redirect.conf
Last active June 16, 2016 03:26
nginx auto detect mobile device and redirect to site correct
#----- redirect to mobile check (starts) -----#
### http://detectmobilebrowsers.com/
set $mobile_rewrite do_not_perform;
if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") {
set $mobile_rewrite perform;
}
if ($http_user_agent ~* "^(1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt
@loinguyenduc101
loinguyenduc101 / ServletExceptionHandler.java
Created July 2, 2016 04:53
Response Json from sprign boot exception handler for servelet exception
// this default json object that default spring boot have handling
// in @Controller ( java code )
throw new ServletException("Invalid login");
// response json
{
"data": {
"timestamp": 1467434876215,
"status": 500,
# set statis ip on eth0 card : /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.54.11.5
NETMASK=255.255.255.224
GATEWAY=10.54.11.30
DNS1=10.151.6.100
DNS2=10.151.6.248
@loinguyenduc101
loinguyenduc101 / vmware.repo
Created July 13, 2016 05:41
install VMware Tools on Centos 6 with yum
# touch /etc/yum.repos.d/vmware.repo
# vi /etc/yum.repos.d/vmware.repo
[vmware-tools]
name=VMware Tools for Red Hat Enterprise Linux $releasever - $basearch
baseurl=http://packages.vmware.com/tools/esx/latest/rhel6/$basearch
enabled=1
gpgcheck=1
gpgkey=http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub
// --- install via yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
$ yum --enablerepo=remi,remi-test install redis
// commands
$ chkconfig --add redis
$ chkconfig --level 345 redis on
@loinguyenduc101
loinguyenduc101 / ROOT.xml
Created September 9, 2016 18:27
Change Tomcat 8 Root Context ( TOMCAT_HOME\conf\Catalina\localhost\ROOT.xml)
<?xml version="1.0" encoding="UTF-8"?>
<Context path="" docBase="C:\Users\..\mlady-cms.war" unpackWARs="true" autoDeploy="true" />
@loinguyenduc101
loinguyenduc101 / IntelliJ IDEA 16 key.license
Created September 20, 2016 07:52
IntelliJ IDEA 16 key
43B4A73YYJ-eyJsaWNlbnNlSWQiOiI0M0I0QTczWVlKIiwibGljZW5zZWVOYW1lIjoibGFuIHl1IiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJBQyIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDE3LTAyLTI1In0seyJjb2RlIjoiRE0iLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJDTCIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IlJTMCIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IlJDIiwicGFpZFVwVG8iOiIyMDE3LTAyLTI1In0seyJjb2RlIjoiUEMiLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJSTSIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9LHsiY29kZSI6IldTIiwicGFpZFVwVG8iOiIyMDE3LTAyLTI1In0seyJjb2RlIjoiREIiLCJwYWlkVXBUbyI6IjIwMTctMDItMjUifSx7ImNvZGUiOiJEQyIsInBhaWRVcFRvIjoiMjAxNy0wMi0yNSJ9XSwiaGFzaCI6IjMzOTgyOTkvMCIsImdyYWNlUGVyaW9kRGF5cyI6MCwiYXV0b1Byb2xvbmdhdGVkIjpmYWxzZSwiaXNBdXRvUHJvbG9uZ2F0ZWQiOmZhbHNlf
@loinguyenduc101
loinguyenduc101 / CentoOs 6 rename eth1 to eth0.txt
Created October 13, 2016 20:05
change-network-device-name-from-eth1-back-to-eth0
If it’s a CentOS 6 machine you need to change 2 files to rename the interface for example from eth1 back to eth0.
One file is the udev rule for network devices which is located here:
/etc/udev/rules.d/70-persistent-net.rules
Copy the new mac address to the line of your eth0 rule and delete the new rule for eth1.
# PCI device 0x15ad:0x07b0 (vmxnet3)
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”00:50:56:b2:23:e0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″
Modify the network configuration located under:
@loinguyenduc101
loinguyenduc101 / Increase the size of a Linux LVM.txt
Last active October 14, 2016 04:57
How to Increase the size of a Linux LVM by expanding the virtual machine disk
How to Increase the size of a Linux LVM by expanding the virtual machine disk
### https://www.rootusers.com/how-to-increase-the-size-of-a-linux-lvm-by-expanding-the-virtual-machine-disk/
VM với Disk 20G cần tăng lên Disk 30G: thực hiện tunr off và tăng size của disk lên 30G sau đó thực hiện bước sau để centos nhận đủ 30G:
1. hiển thị thông tin hiện tại
fdisk -l
df -h