Skip to content

Instantly share code, notes, and snippets.

@vunb
vunb / install-development-tools.sh
Last active December 28, 2015 02:09
Cài đặt các gói công cụ phát triển, biên dịch: make, gcc, gdb, .... cơ bản là đầy đủ
sudo yum update
sudo yum groupinstall "Development Tools"
sudo yum install kernel-devel kernel-headers
@vunb
vunb / mvn-copy-dependencies.sh
Created November 12, 2013 09:55
Maven copy dependencies to lib folder
mvn dependency:copy-dependencies -DoutputDirectory=path/to/lib/folder
@vunb
vunb / mount
Created November 13, 2013 07:52
how to mount .img file on linux?
try to use the -r flag (read-only)
# mount -r -o loop file.img /mnt
if that doesn't work try:
# unsquashfs
@vunb
vunb / micoff.sh
Last active December 29, 2015 06:29
Digital Audio Technology
#! /bin/bash
if [ $# -eq 0 ]; then
echo "You have to specify a module index"
exit 128
fi
pactl unload-module $1
Easy WordPress Parallax Slider
http://wordpress.org/plugins/easy-wp-parallax-slider/
http://demo.oscitasthemes.com/demos/easy-wordpress-parallax-slider/
http://www.velvetinkmedia.com/wp-content/themes/vim/sliders/
http://www.velvetinkmedia.com/wp-content/themes/vim/sliders/parallax/documentation/documentation.html
@vunb
vunb / node.js
Last active December 31, 2015 23:09
The error is Error: Cannot find module 'express'.
Problem: Seems like npm (now?) installs node modules to /usr/local/lib/node_modules/ and not /usr/local/lib/node/
Solution: sudo ln -s /usr/local/lib/node_modules/ /usr/local/lib/node
OR:
Check NODE_PATH: npm root -g
You can add the following to ~/.bash_profile:
export NODE_PATH=/usr/lib/node_modules:$NODE_PATH
@vunb
vunb / A simple cache for Java application.
Last active January 1, 2016 19:39
Although in last our projects we're using more Java and XSLT, we always compare Java and .NET features. It's not a secret that in most applications we may find cache solutions used to improve performance. Unlike .NET providing a robust cache solution Java doesn't provide anything standard. Of course Java's adept may find a lot of caching framewo…
Ref: http://www.nesterovsky-bros.com/weblog/2008/12/04/ASimpleCacheForJavaApplication.aspx
Although in last our projects we're using more Java and XSLT, we always compare Java and .NET features. It's not a secret that in most applications we may find cache solutions used to improve performance. Unlike .NET providing a robust cache solution Java doesn't provide anything standard. Of course Java's adept may find a lot of caching frameworks or just to say: "use HashMap (ArrayList etc.) instead", but this is not the same.
Think about options for Java:
1. Caching frameworks (caching systems). Yes, they do their work. Do it perfectly. Some of them are brought to the state of the art, but there are drawbacks. The crucial one is that for simple data caching one should use a whole framework. This option requires too many efforts to solve a simple problem.
2. Collection classes (HashMap, ArrayList etc.) for caching data. This is very straightforward solution, and very productive. Everyone knows these classes, nothin
@vunb
vunb / find-apache-username.php
Last active August 29, 2015 13:56
In order to find out what user your instance of apache is running as, create a test script with the following content: <?php echo(exec("whoami")); ?>
<?php echo(exec("whoami")); ?>
// # chown -R apache_username: wordpress_folder
@vunb
vunb / dep windows 7
Created February 14, 2014 08:55
Turn on or off DEP or Data Execution Prevention
Here is a very simple way to turn off DEP
- Go to START
- Type in CMD but do NOT press enter.
- Right click the CMD.exe icon and run as Administrator - verify your command prompt says Windows\System32>
- Enter this command exactly as shown
@vunb
vunb / updatePassword.sql
Last active August 29, 2015 13:56
Change and Update WordPress URLS in Database When Site is Moved to new Host
use wp_yourdb;
SELECT ID, user_login, user_pass FROM wp_users;
UPDATE wp_users SET user_pass = MD5('new_password') WHERE ID=1 LIMIT 1;
-- REF: http://www.wpexplorer.com/reset-wordpress-password-using-mysql/