Halaman

Selasa, 26 April 2016

Usefull ADB commands [Android]

Taken from : https://thangamaniarun.wordpress.com/2013/04/19/useful-android-adb-commands-over-usbwi-fi/
#connect adb over wi-fi
adb shell setprop service.adb.tcp.port 5555 && stop adbd && start adbd
adb connect
#Unlock your Android screen
adb shell input keyevent 82
#Lock your Android screen
adb shell input keyevent 6
adb shell input keyevent 26
#Open default browser
adb shell input keyevent 23
#Keep your android phone volume up(+)
adb shell input keyevent 24
#Keep your android phone volume down(-)
adb shell input keyevent 25
#Go to your Android Home screen
adb shell input keyevent 3
#Take Screenshot from adb
adb shell screenshot /sdcard/test.png#Another Screen capture command
#screencap [-hp] [-d display-id] [FILENAME]
# -h: this message
# -p: save the file as a png.
# -d: specify the display id to capture, default 0
#start clock app
adb shell am start com.google.android.deskclock
#stop clock app
adb shell am force-stop com.google.android.deskclock
#start wifi settings manager
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.wifi.WifiSettings
#Testing wifi status – Thanks Saimadhu
adb shell am start -n com.android.settings/.wifi.WifiStatusTest
Below commands only works on Rooted Devices – Thanks Pooja Shah for asking the questions
#wifi on
adb shell svc wifi enable
#wifi off
adb shell svc wifi disable
#Mobile Data on
adb shell svc data enable
#Mobile Data off
adb shell svc data disable
I hope some one will benefits:)

Rabu, 17 Februari 2016

.Net on Ubuntu


Sementara ini dulu step-step nya..
  1. http://docs.asp.net/en/latest/getting-started/installing-on-linux.html#installing-on-ubuntu-14-04
  2. sudo npm install -g yo generator-aspnet
  3. yo aspnet
  4. dnvm use default -r coreclr
  5. dnu build --framework dnxcore50
  6. dnx -p project.json web

Jumat, 05 Februari 2016

Ubuntu 14.04 Postgre

As simple as this:
sudo apt-get install postgresql postgresql-contrib
createuser new_postgre_user
createdb new_postgre_user the_new_db

and then to login to psql
$ psql --host=127.0.0.1 --username=new_postgre_user --dbname=the_new_db

Voila!

Jumat, 03 Juli 2015

Install Desktop on Linux VPS

Follow the following simple steps :

  1. sudo apt-get update
  2. sudo apt-get upgrade
  3. sudo apt-get install xfce4
  4. sudo apt-get install vnc4server
  5. vncserver :3000
  6. sudo fallocate -l 4G /swapfile
  7. sudo chmod 600 /swapfile
  8. sudo mkswap /swapfile
  9. sudo swapon /swapfile
  10. Set permanent swapfile: nano /etc/fstab
  11. add the line to /etc/fstb : /swapfile   none    swap    sw    0   0
now your vncserver is running on port : 8900 (because when running vnc server, we specify :3000, so it is 5900 + 3000 = 8900)

Connect using vncviewer client to the ip address xxx.xxx.xxx.xxx:8900 specify the password you typed on step 5, and then when loged in to the desktop on the terminal run startxfce4

Enjoy!

Senin, 08 Juni 2015

More simpler, setup wildcard subdomain on Ubuntu

$ sudo nano /etc/NetworkManager/NetworkManager.conf
- search for "dns=dnsmasq"
- replace with "#dns=dnsmasq"
$ sudo apt-get install dnsmasq
$ sudo nano /etc/dnsmasq.conf
- append line: "listen-address=127.0.0.1"
- append line: "bind-interfaces"
- append line: "address=/dev/127.0.0.1"
$ sudo netstat -plant | grep :53
- look for "NUMBER/dnsmasq"
$ sudo kill -9 NUMBER
- fill in the number you found for "NUMBER"
$ sudo service dnsmasq restart
$ sudo nano /etc/dhcp/dhclient.conf
- append line: "prepend domain-name-servers 127.0.0.1;"
$ sudo service network-manager restart

and to add a wildcard subdomain add to the virtual host directive
ServerAlias *.vhostdomain.com

On the courtesy of: http://www.leaseweblabs.com/2013/08/wildcard-dns-ubuntu-hosts-file-using-dnsmasq/

Selasa, 14 April 2015

Recursively chmod only on directories or files

A Very simple neat trick to chmod the directories/files
chmod 755 $(find /path/to/base/dir -type d)
and
chmod 644 $(find /path/to/base/dir -type f)
alternative: executing one by one, instead..
for files:
sudo find . -type f -exec chmod 644 {} \;
for directories
sudo find . -type d -exec chmod 755 {} \;
And if you are using that chmod, you are likely using that for your web server. Don't forget to install suPHP on apache, and then setup the configuration at /etc/suphp/suphp.conf and on your virtual host(s) add the 
php_admin_flag engine off
suPHP_Engine on

or perhaps using the fast-cgi approach

Cheers! :D

Setup Wildcard SubDomain on local computer


  1. Install Bind
  2. Install Webmin
  3. Configure server using webmin
    1. check if webmin service is run by running sudo service webmin start
    2. browse to the http://{YOUR_IP or LOCALHOST}:10000
    3. enter your root / sudoer account password
      1. Configure the bind service
        1. Forwarding and Transfer
          1. Enter google dns servers (8.8.8.8, 8.8.4.4)
      2. Configure the server (Servers >> Existing DNS Zones), if this is not shown, use the following command to install the bind-server:
        sudo apt-get install bind9 bind9utils bind9-doc and then refresh the modules on webmin
        1. Create master zone
        2. Domain name: enter your domain, example domain.do
        3. Email address: enter your valid email address format
        4. Edit master zone domain.do
          1. Name: domain.do
            Address: 127.0.0.1
          2. Name: *.domain.do
            Address: 127.0.0.1
        5. try to ping domain.do it should returns 127.0.0.1
If you are receiving a 503 error, try to change the directory mode to 0755 and the file to 0644
It is also important to put index.php (indexes file) on your root.
Don't forget to also add the directory to the list of accessible directory by Apache, **see the Apache configuration files**

:) Cheers!

Jumat, 05 September 2014

[MySQL] Using temporary variables on select statements

When your query need a long formula, to make it "maintainable" and "readable" you sometime need  the help of a temporary variable, simply put: you assign them on the select term by using the syntax:

@tempName := price * discount_percent as disc, @tempName2 := @tempName + price as net_price

And that should be it folks! ;)