run ss -s util
Monday, December 21, 2015
Saturday, November 28, 2015
Wednesday, November 25, 2015
Detect hardcoded strings in android java files
1. click analyze menu in android studio
2. click inspect by name
3. enter "Hardcoded strings"
4. use filemask as "*.java"
5. fix issues one by one
2. click inspect by name
3. enter "Hardcoded strings"
4. use filemask as "*.java"
5. fix issues one by one
Wednesday, November 18, 2015
run wordpress with ngnx
https://www.linode.com/docs/websites/nginx/how-to-install-nginx-and-php-via-fastcgi-on-ubuntu-12-04-lts-precise-pangolin
Monday, October 26, 2015
disable gedit auto saving
gsettings set org.gnome.gedit.preferences.editor create-backup-copy 'false'
Monday, September 7, 2015
Wednesday, August 12, 2015
Monday, August 3, 2015
Saturday, August 1, 2015
setting up nginx on ubuntu
below url have good content:
https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache
https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-for-apache
Friday, July 31, 2015
Allow remote access to mysql
bind mysql to 0.0.0.0
grant permission: GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' WITH GRANT OPTION;
add user 'root'@'%' with password
grant permission: GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' WITH GRANT OPTION;
add user 'root'@'%' with password
Friday, July 10, 2015
FInd reject files recursively
use below command:
find $directory -type f -name "*.in"
Thursday, June 11, 2015
Sunday, May 3, 2015
Short bash prompt
use below in .bashrc
PROMPT_DIRTRIM=2
Thursday, April 30, 2015
How to get complete android apk info
hint:
/home/bhola/android-sdk/sdk/build-tools/21.1.0/aapt dump badging app-x86-debug.apk
/home/bhola/android-sdk/sdk/build-tools/21.1.0/aapt dump badging app-x86-debug.apk
Building apk for multiple architecture
productFlavors {
defaultFlavor {
proguardFile 'proguard-rules.txt' }
x86 {
versionCode Integer.parseInt("6" + defaultConfig.versionCode)
ndk {
abiFilter "x86" }
}
mips {
versionCode Integer.parseInt("4" + defaultConfig.versionCode)
ndk {
abiFilter "mips" }
}
armv7 {
versionCode Integer.parseInt("2" + defaultConfig.versionCode)
ndk {
abiFilter "armeabi-v7a" }
}
arm {
versionCode Integer.parseInt("1" + defaultConfig.versionCode)
ndk {
abiFilter "armeabi" }
}
}
Sunday, April 26, 2015
Sunday, April 19, 2015
How to build scalable PHP based webservices
1. Use facebook hhvm
https://github.com/facebook/hhvm/wiki
2. No sessions
https://github.com/facebook/hhvm/wiki
2. No sessions
Saturday, April 18, 2015
Resources for learning GO language
Installing go:
1. mkdir ~/go
mkdir ~/goprojects
Install go from golang.org site
Install goeclipse ==> juno eclipse and install goeclipse plugin
Install gocode
go get -u github.com/nsf/gocode
setup environment variables in ~/.profile
export GOROOT=$HOME/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=$HOME/goprojects
export PATH=$PATH:$GOPATH/bin
https://tour.golang.org/welcome/1
Golang book
http://www.golang-book.com/11/index.htm
Go Libraries:
https://github.com/Xelom/Go-Libraries
Debugging tips:
1. only variable with Capital letter are exported.
Saturday, April 11, 2015
Tuesday, March 31, 2015
Monday, March 23, 2015
Saturday, March 14, 2015
Wednesday, March 11, 2015
Sunday, March 1, 2015
Monday, February 23, 2015
How to apply patch in git
check logs
git log --pretty=oneline -3
git format-patch <patch number > master
git format-patch commitStart^..commitLatest --stdout > test.patch
git format-patch HEAD~
git apply --check <patch name>
git apply --reject --ignore-whitespace <patch name>
git log --pretty=oneline -3
git format-patch <patch number > master
git format-patch commitStart^..commitLatest --stdout > test.patch
git format-patch HEAD~
git apply --check <patch name>
git apply --reject --ignore-whitespace <patch name>
Saturday, February 21, 2015
enabling moto g for ubuntu debugging
1. tap 7 time on build number
2. use sudo to start adb sever
use android rules
2. use sudo to start adb sever
use android rules
- Log in as root and create this file:
/etc/udev/rules.d/51-android.rules.Use this format to add each vendor to the file:SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
In this example, the vendor ID is for HTC. TheMODEassignment specifies read/write permissions, andGROUPdefines which Unix group owns the device node.Note: The rule syntax may vary slightly depending on your environment. Consult theudevdocumentation for your system as needed. For an overview of rule syntax, see this guide to writing udev rules. - Now execute:
chmod a+r /etc/udev/rules.d/51-android.rules
Wednesday, February 18, 2015
handling back on notification activities
below is right thing to do:
You need to add the parent stack for the activity you're launching, not the parent of it.
Replace:
stackBuilder.addParentStack(MainActivity.class);
with:
stackBuilder.addParentStack( MatchActivity.class );
This assumes that you've defined the parent in your Manifest (API 16+):
<activity android:name=".MatchActivity"
android:parentActivityName=".MainActivity"
... />
Sunday, February 15, 2015
Saturday, February 14, 2015
Nodejs and async handling
below is great blog about it:
http://www.sebastianseilund.com/nodejs-async-in-practice
http://www.sebastianseilund.com/nodejs-async-in-practice
gearman and node.js
install
npm install node-gearman
https://www.npmjs.com/package/gearmanode
worker code example:
var nodejspath='/var/www/node_js/node_modules';
var gearmanode = require(nodejspath+'/gearmanode');
var worker = gearmanode.worker();
worker.addFunction('gcm_ca_nodejs', function (job) {
console.log("got input as "+job.payload.toString());
job.workComplete("done");
});
npm install node-gearman
https://www.npmjs.com/package/gearmanode
worker code example:
var nodejspath='/var/www/node_js/node_modules';
var gearmanode = require(nodejspath+'/gearmanode');
var worker = gearmanode.worker();
worker.addFunction('gcm_ca_nodejs', function (job) {
console.log("got input as "+job.payload.toString());
job.workComplete("done");
});
learn node.js
http://nodeschool.io/#workshoppers
install globally:
npm -g install <>
export NODE_PATH='/usr/loca/lib/node_modules'
including other javascript files
install globally:
npm -g install <>
export NODE_PATH='/usr/loca/lib/node_modules'
including other javascript files
module.exports = {
foo: function () {
// whatever
},
bar: function () {
// whatever
}
};
using sqlite as gearman persistent queue
create sqlite db
sqlite3 gear-queue.db
CREATE TABLE gearman_queue(unique_key TEXT PRIMARY KEY,function_name TEXT,when_to_run INTEGER,priority INTEGER,data BLOB);
vi /etc/default/gearman-job-server
params="gearmand -q libsqlite3 --libsqlite3-db=/tmp/xx.sqlite"
sqlite3 gear-queue.db
CREATE TABLE gearman_queue(unique_key TEXT PRIMARY KEY,function_name TEXT,when_to_run INTEGER,priority INTEGER,data BLOB);
vi /etc/default/gearman-job-server
params="gearmand -q libsqlite3 --libsqlite3-db=/tmp/xx.sqlite"
setup gearman monitor
install https://github.com/yugene/Gearman-Monitor
2. install pear package
sudo pear install Net_Gearman-0.2.3
2. install pear package
sudo pear install Net_Gearman-0.2.3
Friday, February 13, 2015
Thursday, February 12, 2015
Tips for s3sf performance improvements
1. use max_ stat_cache_size="100000"
2. use use_cache=/tmp/cache
2. use use_cache=/tmp/cache
Wednesday, February 11, 2015
Getting started with Windows Azure tools on Ubuntu
1. install npm
sudo apt-get install nodejs-legacy
2, install azure cli tools through
sudo npm install azure-cli -g
sudo apt-get install nodejs-legacy
2, install azure cli tools through
sudo npm install azure-cli -g
Tuesday, February 10, 2015
enable ssl on apache2
sudo a2ensite default-ssl
sudo a2enmod ssl
create below dir:
/etc/apach2/ssl.crt
/etc/apache2/ssl.key
/etc/apache2/ca-bundle
ssl.key should be from CSR
remove pass phrase
sudo a2enmod ssl
create below dir:
/etc/apach2/ssl.crt
/etc/apache2/ssl.key
/etc/apache2/ca-bundle
ssl.key should be from CSR
remove pass phrase
/path/to/openssl rsa -in /path/to/originalkeywithpass.key -out /path/to/newkeywithnopass.key
write way to handle non-www to www migration in apache
add below lines in vhost conf:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Friday, February 6, 2015
running amazon cli cron jobs
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
AWS_CONFIG_FILE="/home/ubuntu/.aws/config"36 7 * * * sh /var/www//scripts/amz-stop.sh >/home/ubuntu/logs/amz-stop.log 2>&1
5 7 * * * sh /var/www//scripts/amz-launch.sh >/home/ubuntu/logs/amz-start.log
2>&1
Hosting s3 files
use CNAME to host s3.
Name of bucket should be same as CNAME
http://download.onlinetyari.com ==> http://download.onlinetyari.com.s3.amazonaws.com
Name of bucket should be same as CNAME
http://download.onlinetyari.com ==> http://download.onlinetyari.com.s3.amazonaws.com
Wednesday, February 4, 2015
Tuesday, February 3, 2015
Useful mysql debugging commands
Total tables:
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE';
show global status like 'open%';
SHOW VARIABLES LIKE '%max%'
Saturday, January 31, 2015
how to mount s3 for website write
find uid and gid
id -i www-data
id -g www-data
chmod -R 1777 /file_name
sudo s3fs ot-cdn /var/www/ot/cdn -o uid=1000,gid=33,use_rrs=1,allow_other,default_acl=public-read,umask=002,use_cache=/home/ubuntu/cdn
id -i www-data
id -g www-data
chmod -R 1777 /file_name
sudo s3fs ot-cdn /var/www/ot/cdn -o uid=1000,gid=33,use_rrs=1,allow_other,default_acl=public-read,umask=002,use_cache=/home/ubuntu/cdn
setup s3fs fuse on amazon ec2 machine
apt-get install build-essential git libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool
apt-get install pkg-config libssl-dev # See (*3)
apt-get lib-xml2 lib-xmlv2
git clone https://github.com/s3fs-fuse/s3fs-fuse cd s3fs-fuse/ ./autogen.sh ./configure --prefix=/usr --with-openssl # See (*1) make sudo make install
create ~/.passwd_s3fs
chmod 600 ~/.passwd_s3fs
keys in <k1>:</k2> format
s3fs <b> /mnt
Friday, January 30, 2015
how to sync local file content to s3 bucket
use below command:
aws s3 sync . s3://********/ --acl=public-read
aws s3 sync . s3://********/ --acl=public-read
Wednesday, January 28, 2015
how to install amazon CLI
sudo apt-add-repository ppa:awstools-dev/awstools sudo apt-get update sudo apt-get install ec2-api-tools
$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" $ unzip awscli-bundle.zip $ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws$aws configure
Monday, January 26, 2015
How to use PhpMyadmin for RDS management
use below code in /etc/phpmyadmin/config.inc.php
$cfg['Servers'][$i]['host'] = 'path';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = TRUE;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['host'] = 'path';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['compress'] = TRUE;
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
creating database on AWS RDS platform
Below is how to create database directly using mysql command line......
1. CREATE DATABASE testdb2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci
1. CREATE DATABASE testdb2 DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci
Subscribe to:
Comments (Atom)