Download and unzip to ~/adt
cd ~
wget http://dl.google.com/android/adt/adt-bundle-linux-x86-20140702.zip
unzip adt-bundle-linux-x86-20140702.zip
rm adt-bundle-linux-x86-20140702.zip
mv adt-bundle-linux-x86-20140702 adt
Install dependencies
sudo apt-get install openjdk-7-jre openjdk-7-jdk
Include the /sdk/tools and /sdk/platform-tools folders in your environment path
echo 'export PATH=${PATH}:~/adt/sdk/tools'|cat - ~/.bashrc > /tmp/out && mv /tmp/out ~/.bashrc
echo 'export PATH=${PATH}:~/adt/sdk/platform-tools'|cat - ~/.bashrc > /tmp/out && mv /tmp/out ~/.bashrc
source ~/.bashrc
run the /sdk/tools/android binary and install updates
android
run the android emulator to make sure everything is working
android avd
Gmail 'Send Mail As' SMTP Setup (Ubuntu & Postfix)
Gmail used to let us send mail from non-gmail addresses using the gmail servers. For some reason, they decided to disable this feature and force us to set up our own SMTP servers for outbound mail.
This guide will cover how to set up Postfix with SASL authentication on Ubuntu and avoid the dreaded "We are having trouble authenticating with your other mail service. Please try a different port or connection option" error.
First let's install postfix and sasl and make sure postfix is running
sudo apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules
sudo service sendmail stop
sudo service postfix restart
You may want to set up postfix to receive / forward mail or whatever else you want to do with it. I usually set up a virtual configuration that simply forwards mail to my gmail account.
At this point, you should have postfix running and listening to port 25, but if you try to configure gmail to send through it, you will get some stupid error like this "We are having trouble authenticating with your other mail service. Please try a different port or connection option". This is because gmail wants some sort of secure authentication, and you have not set that up yet.
So the next step is to create an SSL certificate for SASL, which is a huge pain, but you can simply past this in line by line and type in whatever makes you happy when it asks you questions. Make sure you write down the certificate password and use the same one every time it asks.
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
Cool beans. Now you just have to configure postfix to use SASL. You can paste this all in at once. It should not ask you any questions.
sudo postconf -e 'smtpd_sasl_local_domain ='
sudo postconf -e 'smtpd_sasl_auth_enable = yes'
sudo postconf -e 'smtpd_sasl_security_options = noanonymous'
sudo postconf -e 'broken_sasl_auth_clients = yes'
sudo postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
sudo postconf -e 'inet_interfaces = all'
sudo postconf -e 'smtp_tls_security_level = may'
sudo postconf -e 'smtpd_tls_security_level = may'
sudo postconf -e 'smtpd_tls_auth_only = no'
sudo postconf -e 'smtp_use_tls = yes'
sudo postconf -e 'smtpd_use_tls = yes'
sudo postconf -e 'smtp_tls_note_starttls_offer = yes'
sudo postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
sudo postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
sudo postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
sudo postconf -e 'smtpd_tls_loglevel = 1'
sudo postconf -e 'smtpd_tls_received_header = yes'
sudo postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
sudo postconf -e 'tls_random_source = dev:/dev/urandom'
sudo postconf -e 'home_mailbox = Maildir/'
sudo postconf -e 'mailbox_command ='
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
sudo service postfix restart
Now we need to configure SASL so it starts up automatically and change some things so that postfix can communicate with it.
sudo sed -i 's/START\=no/START\=yes/g' /etc/default/saslauthd
sudo sed -i 's/\/var\/run\/saslauthd/\/var\/spool\/postfix\/var\/run\/saslauthd/g' /etc/default/saslauthd
sudo echo 'PWDIR="/var/spool/postfix/var/run/saslauthd"' >> /etc/default/saslauthd
sudo echo 'PARAMS="-m ${PWDIR}"' >> /etc/default/saslauthd
sudo echo 'PIDFILE="${PWDIR}/saslauthd.pid"' >> /etc/default/saslauthd
sudo dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd
sudo service saslauthd restart
Wonderful! Now you can use the 'adduser' command on your server to set up users that correspond to whatever email accounts you want to send mail as. Then you simply go into the gmail settings and use the users and passwords that you set up with adduser.
The SMTP hostname is whatever you have set up as the MX record in the DNS settings for your hostname. I usually just use the @ record, but some people really like subdomains, so more power to them. The port should be 25, and TLS should be set up and working out of the box. It is highly recommended that you use that.
That should cover the basics. It is important to note that you do not need to buy an SSL certificate like you would need to do with a webserver. Generating your own works just fine. Setting up a mail server should cost you nothing but 30 minutes of work. It should now surprise you that companies like GoDaddy charge so much money for something so simple.
I will cover receiving mail in another post, but that is straight forward as well. You can either set up postfix forwarding or use dovecot for pop or imap. Another alternative is to set up an open source mail interface on your server like RoundCube. I just find gmail's convenience worth the privacy invasion most of the time, expecially when you have 30 email addresses to listen on.
This guide will cover how to set up Postfix with SASL authentication on Ubuntu and avoid the dreaded "We are having trouble authenticating with your other mail service. Please try a different port or connection option" error.
sudo apt-get install postfix libsasl2-2 sasl2-bin libsasl2-modules
sudo service sendmail stop
sudo service postfix restart
You may want to set up postfix to receive / forward mail or whatever else you want to do with it. I usually set up a virtual configuration that simply forwards mail to my gmail account.
At this point, you should have postfix running and listening to port 25, but if you try to configure gmail to send through it, you will get some stupid error like this "We are having trouble authenticating with your other mail service. Please try a different port or connection option". This is because gmail wants some sort of secure authentication, and you have not set that up yet.
So the next step is to create an SSL certificate for SASL, which is a huge pain, but you can simply past this in line by line and type in whatever makes you happy when it asks you questions. Make sure you write down the certificate password and use the same one every time it asks.
mkdir /etc/postfix/ssl
cd /etc/postfix/ssl/
openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024
chmod 600 smtpd.key
openssl req -new -key smtpd.key -out smtpd.csr
openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt
openssl rsa -in smtpd.key -out smtpd.key.unencrypted
mv -f smtpd.key.unencrypted smtpd.key
openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
Cool beans. Now you just have to configure postfix to use SASL. You can paste this all in at once. It should not ask you any questions.
sudo postconf -e 'smtpd_sasl_local_domain ='
sudo postconf -e 'smtpd_sasl_auth_enable = yes'
sudo postconf -e 'smtpd_sasl_security_options = noanonymous'
sudo postconf -e 'broken_sasl_auth_clients = yes'
sudo postconf -e 'smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination'
sudo postconf -e 'inet_interfaces = all'
sudo postconf -e 'smtp_tls_security_level = may'
sudo postconf -e 'smtpd_tls_security_level = may'
sudo postconf -e 'smtpd_tls_auth_only = no'
sudo postconf -e 'smtp_use_tls = yes'
sudo postconf -e 'smtpd_use_tls = yes'
sudo postconf -e 'smtp_tls_note_starttls_offer = yes'
sudo postconf -e 'smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key'
sudo postconf -e 'smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt'
sudo postconf -e 'smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem'
sudo postconf -e 'smtpd_tls_loglevel = 1'
sudo postconf -e 'smtpd_tls_received_header = yes'
sudo postconf -e 'smtpd_tls_session_cache_timeout = 3600s'
sudo postconf -e 'tls_random_source = dev:/dev/urandom'
sudo postconf -e 'home_mailbox = Maildir/'
sudo postconf -e 'mailbox_command ='
echo 'pwcheck_method: saslauthd' >> /etc/postfix/sasl/smtpd.conf
echo 'mech_list: plain login' >> /etc/postfix/sasl/smtpd.conf
sudo service postfix restart
Now we need to configure SASL so it starts up automatically and change some things so that postfix can communicate with it.
sudo sed -i 's/START\=no/START\=yes/g' /etc/default/saslauthd
sudo sed -i 's/\/var\/run\/saslauthd/\/var\/spool\/postfix\/var\/run\/saslauthd/g' /etc/default/saslauthd
sudo echo 'PWDIR="/var/spool/postfix/var/run/saslauthd"' >> /etc/default/saslauthd
sudo echo 'PARAMS="-m ${PWDIR}"' >> /etc/default/saslauthd
sudo echo 'PIDFILE="${PWDIR}/saslauthd.pid"' >> /etc/default/saslauthd
sudo dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd
sudo service saslauthd restart
Wonderful! Now you can use the 'adduser' command on your server to set up users that correspond to whatever email accounts you want to send mail as. Then you simply go into the gmail settings and use the users and passwords that you set up with adduser.
The SMTP hostname is whatever you have set up as the MX record in the DNS settings for your hostname. I usually just use the @ record, but some people really like subdomains, so more power to them. The port should be 25, and TLS should be set up and working out of the box. It is highly recommended that you use that.
That should cover the basics. It is important to note that you do not need to buy an SSL certificate like you would need to do with a webserver. Generating your own works just fine. Setting up a mail server should cost you nothing but 30 minutes of work. It should now surprise you that companies like GoDaddy charge so much money for something so simple.
I will cover receiving mail in another post, but that is straight forward as well. You can either set up postfix forwarding or use dovecot for pop or imap. Another alternative is to set up an open source mail interface on your server like RoundCube. I just find gmail's convenience worth the privacy invasion most of the time, expecially when you have 30 email addresses to listen on.
BFL ASIC CGMINER INSTALL UBUNTU 13.10
Just run this little script:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install git make libtool autoconf libcurl4-openssl-dev libudev-dev
git clone https://github.com/ckolivas/cgminer.git
cd cgminer
sudo ./autogen.sh
sudo ./configure --enable-bflsc
sudo make
sudo make install
sudo cgminer
Here is a the same stuff with a better explanation + cron setup
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get -y install git make libtool autoconf libcurl4-openssl-dev libudev-dev
git clone https://github.com/ckolivas/cgminer.git
cd cgminer
sudo ./autogen.sh
sudo ./configure --enable-bflsc
sudo make
sudo make install
sudo cgminer
Here is a the same stuff with a better explanation + cron setup
Free IP Locator API - Convert IP Addresses to Zip Codes with PHP
If you just want a free site to use:
IP Address Locator with Map
If you want a quick PHP solution, try this:
$ip = 'xxx.xxx.xxx.xxx';
var_dump(json_decode(file_get_contents("https://freegeoip.net/json/$ip"),true));
If you want quick responses, you can install the freegeoip server on ubuntu. This will give you your own personal IP locator service to use privately (or publicly if you are a nice guy):
Install golang 1.1.1
--------------------
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:duh/golang
sudo apt-get update
sudo apt-get install golang
go version
Set your go environment variables
---------------------------------
export GOROOT=/usr/lib/go
Install freegeoip
-----------------
git clone https://github.com/fiorix/freegeoip.git
cd freegeoip
go build
Download the database
---------------------
cd db
./updatedb
file ipdb.sqlite
Run it
------
cd ..
./freegeoip
cron script to keep the server running (replace $FREEGEOIP_PATH)
----------------------------------------------------------------
#!/bin/bash
ps cax | grep -v grep | grep freegeoip > /dev/null
result=$?
echo "${result}"
if [ "${result}" -eq "0" ] ; then
echo "freegeoip is already running" #>>/home/work/cgcron
else
cd $FREEGEOIP_PATH
./freegeoip &
fi
cron script to update the database regularly (replace $FREEGEOIP_PATH)
----------------------------------------------------------------------
#!/bin/bash
cd $FREEGEOIP_PATH/db
./updatedb &
IP Address Locator with Map
If you want a quick PHP solution, try this:
$ip = 'xxx.xxx.xxx.xxx';
var_dump(json_decode(file_get_contents("https://freegeoip.net/json/$ip"),true));
If you want quick responses, you can install the freegeoip server on ubuntu. This will give you your own personal IP locator service to use privately (or publicly if you are a nice guy):
Install golang 1.1.1
--------------------
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:duh/golang
sudo apt-get update
sudo apt-get install golang
go version
Set your go environment variables
---------------------------------
export GOROOT=/usr/lib/go
Install freegeoip
-----------------
git clone https://github.com/fiorix/freegeoip.git
cd freegeoip
go build
Download the database
---------------------
cd db
./updatedb
file ipdb.sqlite
Run it
------
cd ..
./freegeoip
cron script to keep the server running (replace $FREEGEOIP_PATH)
----------------------------------------------------------------
#!/bin/bash
ps cax | grep -v grep | grep freegeoip > /dev/null
result=$?
echo "${result}"
if [ "${result}" -eq "0" ] ; then
echo "freegeoip is already running" #>>/home/work/cgcron
else
cd $FREEGEOIP_PATH
./freegeoip &
fi
cron script to update the database regularly (replace $FREEGEOIP_PATH)
----------------------------------------------------------------------
#!/bin/bash
cd $FREEGEOIP_PATH/db
./updatedb &
Install CPU Miner on Ubuntu and Mine FTC
# install dependencies
sudo apt-get install autoconf automake libcurl4-nss-dev gcc git
# download cpuminer
git clone https://github.com/pooler/cpuminer
# cd to directory
cd cpuminer
# generate make files
./autogen.s
./configure CFLAGS="-O3"
# install
sudo make install
# run on wemineftc mining pool
sudo minerd -o stratum+tcp://stratum.wemineftc.com:4444 -u [username].[worker] -p [worker password]
#cron script to keep you mining whenever your computer is on
sudo vi /usr/sbin/mine_cron
------------------------------------------------------
#!/bin/bash
ps cax | grep -v grep | grep minerd > /dev/null
result=$?
echo "${result}"
if [ "${result}" -eq "0" ] ; then
echo "minderd is already running" #>>/home/work/cgcron
else
sudo minerd -o stratum+tcp://stratum.wemineftc.com:4444 -u [username].[worker] -p [worker password]
fi
-------------------------------------------------------
sudo chmod a+x /usr/sbin/mine_cron
#run it however often you like
crontab -e
--------------------------------------------------------
# m h dom mon dow command
* * * * * /usr/sbin/mine_cron
--------------------------------------------------------
sudo apt-get install autoconf automake libcurl4-nss-dev gcc git
# download cpuminer
git clone https://github.com/pooler/cpuminer
# cd to directory
cd cpuminer
# generate make files
./autogen.s
./configure CFLAGS="-O3"
# install
sudo make install
# run on wemineftc mining pool
sudo minerd -o stratum+tcp://stratum.wemineftc.com:4444 -u [username].[worker] -p [worker password]
#cron script to keep you mining whenever your computer is on
sudo vi /usr/sbin/mine_cron
------------------------------------------------------
#!/bin/bash
ps cax | grep -v grep | grep minerd > /dev/null
result=$?
echo "${result}"
if [ "${result}" -eq "0" ] ; then
echo "minderd is already running" #>>/home/work/cgcron
else
sudo minerd -o stratum+tcp://stratum.wemineftc.com:4444 -u [username].[worker] -p [worker password]
fi
-------------------------------------------------------
sudo chmod a+x /usr/sbin/mine_cron
#run it however often you like
crontab -e
--------------------------------------------------------
# m h dom mon dow command
* * * * * /usr/sbin/mine_cron
--------------------------------------------------------
Why Does CodeIgniter Set Cookie Not Work?
Well, because CodeIgniter is garbage, and you should probably be using Yii.
If you want to fix CodeIgniter, open up system/core/Input.php and scroll down to line 248 to see this line:
$expire = time() - 86500;
Well that's silly ... someone decided to set the cookie's expiration date to yesterday!
If you change the '-' to a '+', your cookies will be good for 24 hours. If you want your cookie to be good for 40+ years, try this:
$expire = time() * 2;
This bug may have been fixed in later versions, but it certainly was not in mine.
If you want to fix CodeIgniter, open up system/core/Input.php and scroll down to line 248 to see this line:
$expire = time() - 86500;
Well that's silly ... someone decided to set the cookie's expiration date to yesterday!
If you change the '-' to a '+', your cookies will be good for 24 hours. If you want your cookie to be good for 40+ years, try this:
$expire = time() * 2;
This bug may have been fixed in later versions, but it certainly was not in mine.
Buttfly Labs ASIC, CGMiner Ubuntu Install with BitMinter Pool Mining Example
# install dependencies
sudo apt-get install autoconf libtool libcurl4-openssl-dev libncurses5-dev pkg-config yasm make libusb-1.0 libudev-dev
# download cgminer tar.gz
# https://launchpad.net/ubuntu/+source/cgminer
# extract tar
tar -xf cgminer*
# cd to directory
cd cgminer*
# generate make files
./autogen.sh --enable-bflsc
# install
sudo make install
# run on bitminter mining pool
sudo cgminer -o http://mint.bitminter.com:8332 -u [username]_[worker] -p whatever
#cron script to keep you mining whenever your computer is on
sudo vi /usr/sbin/mine_cron
------------------------------------------------------
#!/bin/bash
ps cax | grep -v grep | grep cgminer > /dev/null
result=$?
echo "${result}"
if [ "${result}" -eq "0" ] ; then
echo "cgminer is already running" #>>/home/work/cgcron
else
sudo cgminer -o http://mint.bitminter.com:8332 -u [username]_[worker] -p whatever
fi
-------------------------------------------------------
sudo chmod a+x /usr/sbin/mine_cron
#run it however often you like
crontab -e
--------------------------------------------------------
# m h dom mon dow command
* * * * * /usr/sbin/mine_cron
--------------------------------------------------------
Oh hi, I wrote a simple script for the install here
sudo apt-get install autoconf libtool libcurl4-openssl-dev libncurses5-dev pkg-config yasm make libusb-1.0 libudev-dev
# download cgminer tar.gz
# https://launchpad.net/ubuntu/+source/cgminer
# extract tar
tar -xf cgminer*
# cd to directory
cd cgminer*
# generate make files
./autogen.sh --enable-bflsc
# install
sudo make install
# run on bitminter mining pool
sudo cgminer -o http://mint.bitminter.com:8332 -u [username]_[worker] -p whatever
#cron script to keep you mining whenever your computer is on
sudo vi /usr/sbin/mine_cron
------------------------------------------------------
#!/bin/bash
ps cax | grep -v grep | grep cgminer > /dev/null
result=$?
echo "${result}"
if [ "${result}" -eq "0" ] ; then
echo "cgminer is already running" #>>/home/work/cgcron
else
sudo cgminer -o http://mint.bitminter.com:8332 -u [username]_[worker] -p whatever
fi
-------------------------------------------------------
sudo chmod a+x /usr/sbin/mine_cron
#run it however often you like
crontab -e
--------------------------------------------------------
# m h dom mon dow command
* * * * * /usr/sbin/mine_cron
--------------------------------------------------------
Oh hi, I wrote a simple script for the install here
Subscribe to:
Posts (Atom)