Recently I found out that you can run a webserver, a database like Redis on any android using Termux, which is crazy :))
This video shows how to monitor android with Trafikito :)
React Native. How change package name for Android?
Make sure android>app>build.gradle
defaultConfig {
applicationId "WHATEVER_THIS_IS"
}
needs to match android>app>src>main>java>com>app_name>MainActivity.java line one:
package WHATEVER_THIS_IS;
needs to match android>app>src>main>java>com>app_name>MainApplication.java line one:
package WHATEVER_THIS_IS;
needs to match android>app>src>AndroidManifest.xml
package="WHATEVER_THIS_IS">
http://stackoverflow.com/questions/37389905/change-package-name-for-android-in-react-native
http://stackoverflow.com/questions/35131769/error-type-3-activity-class-com-awesome-project-com-awesome-project-mainactiv
defaultConfig {
applicationId "WHATEVER_THIS_IS"
}
needs to match android>app>src>main>java>com>app_name>MainActivity.java line one:
package WHATEVER_THIS_IS;
needs to match android>app>src>main>java>com>app_name>MainApplication.java line one:
package WHATEVER_THIS_IS;
needs to match android>app>src>AndroidManifest.xml
package="WHATEVER_THIS_IS">
-----
android/app/src/main/java/com/PROJECT_NAME/MainActivity.java:
package MY.APP.ID;
In android/app/src/main/java/com/PROJECT_NAME/MainApplication.java:
package MY.APP.ID;
In android/app/src/main/AndroidManifest.xml:
package="MY.APP.ID"
And in android/app/build.gradle:
applicationId "MY.APP.ID"
http://stackoverflow.com/questions/37389905/change-package-name-for-android-in-react-native
http://stackoverflow.com/questions/35131769/error-type-3-activity-class-com-awesome-project-com-awesome-project-mainactiv
todo after fresh ubuntu server vps install
apt-get install nano -y
echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc
echo "export LANG=en_US.UTF-8" >> ~/.bashrc
echo "export LANGUAGE=en_US.UTF-8" >> ~/.bashrc
echo "export LC_ALL=en_US.UTF-8" >> ~/.profile
echo "export LANG=en_US.UTF-8" >> ~/.profile
echo "export LANGUAGE=en_US.UTF-8" >> ~/.profile
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
apt-get install htop
How i fix local issues on my ubuntu server
put these lines in your ~/.bashrc and ~/.profile files:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
reboot 1 // can be re-login but reboot is so fast for my vps servers that i just reboot lol, less typing :)
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
reboot 1 // can be re-login but reboot is so fast for my vps servers that i just reboot lol, less typing :)
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
How i did SSL with let's encrypt for free
I use ubuntu v14 on vps machine. I have couple nodejs scripts running with pm2. I use https server inside js files:
In nginx i use this:
Tried different guides and failed.
This worked:
const app = require('express')(); const fs = require('fs'); var privateKey = fs.readFileSync('/etc/letsencrypt/live/domain.com/privkey.pem'); // privatekey.pem
var certificate = fs.readFileSync('/etc/letsencrypt/live/domain.com/cert.pem'); // certificate.pem
var chain = fs.readFileSync('/etc/letsencrypt/live/domain.com/fullchain.pem'); // certificate.pem const https = require('https').Server({ key: privateKey, cert: certificate, ca: chain}, app);
In nginx i use this:
server {
listen 443 ssl;
server_name domain.com www.domain.com;
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem;
keepalive_timeout 10;
location /.well-known/acme-challenge/ {
alias /var/www/challenges/;
try_files $uri =404;
}
location / {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_pass http://pm2upstream;
}
}
Tried different guides and failed.
This worked:
- wget https://dl.eff.org/certbot-auto
- chmod a+x ./certbot-auto
- service nginx stop
- ./certbot-auto certonly & follow instructions, use auto server
- reboot 0 // i hear you screaming about this, best wishes, sys admins
Prestashop update all prices with SQL (fully working)
I had to update all prices of shop made with PrestaShop. Found some tutorials where in that crazy database prices are saved, but none fully working example in one place. I was updating from prices written in Lithuanian Litas to Euros. 1 Euro = 3.4528 Litas So my solution:
PHP Recursive dir size with iterator object
public function getDirSize($dir, $format = true)
{
$dir_iterator = new RecursiveDirectoryIterator($dir);
$iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
$size = 0;
foreach ($iterator as $file) {
$size += $file->getSize();
}
if ($format) {
if ($size / 1048576 > 1) {
return round($size / 1048576, 1) . ' MB';
// if the total size is bigger than 1 KB
} elseif ($size / 1024 > 1) {
return round($size / 1024, 1) . ' KB';
// else return the filesize in bytes
} else {
return round($size, 1) . ' bytes';
}
} else {
// return the total filesize in bytes
return $size;
}
}
usage:
$size = getDirSize('/dir/to/get/size/');
{
$dir_iterator = new RecursiveDirectoryIterator($dir);
$iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
$size = 0;
foreach ($iterator as $file) {
$size += $file->getSize();
}
if ($format) {
if ($size / 1048576 > 1) {
return round($size / 1048576, 1) . ' MB';
// if the total size is bigger than 1 KB
} elseif ($size / 1024 > 1) {
return round($size / 1024, 1) . ' KB';
// else return the filesize in bytes
} else {
return round($size, 1) . ' bytes';
}
} else {
// return the total filesize in bytes
return $size;
}
}
usage:
$size = getDirSize('/dir/to/get/size/');
Hostingo Nuolaidos
50% nuolaida serveriai.lt (svetainių talpinimui)
50% nuolaida dedikuoti.lt (dedikuotų serverių nuomai)
50% nuolaida hostingas.lt (hostingui)
20% nuolaida internetinių adresų registravimui
Serveriai.lt svetainės talpinimo 50% nuolaida
Phalcon upgrade to 1.3.1 errors after upgrade from 1.2.6
I had plenty of errors after upgrade and the solution to all of them at once is simple - re-install php. Uninstall php/apache/nginx/sql/phpmyadmin - what you have and then install all one after one. start with apache, php, sql then phalcon :)
How To download Facebook Look Back video?
1. Open Google Chrome browser and go to https://www.facebook.com/lookback
2. Click F12 button on you keyboard or use your mouse: right-click anywhere outside the movie and select "Inspect Element" (it should be last option on the menu)
2. Click F12 button on you keyboard or use your mouse: right-click anywhere outside the movie and select "Inspect Element" (it should be last option on the menu)
function get_currency_rate
Simple, yet effective way to get currency rate from yahoo finance service. Cache the results, or you will get ban from yahoo.
MongoDB: fixed not starting error
Just use these:
sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/
sudo service mongodb start
Of course change dbpath to your dbpath, this one is default.
sudo -u mongodb mongod --repair --dbpath /var/lib/mongodb/
sudo service mongodb start
Of course change dbpath to your dbpath, this one is default.
Basic Auth .htaccess 101
All these are working on Ubuntu 13.04
1. Check if apache modules are loaded:
on ubuntu this one works find:
apache2ctl -M
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
not all required, but my config is loading these now. auth_... and authn_... are realy required for my example, but i don't know which of those authz are required..
1. Check if apache modules are loaded:
on ubuntu this one works find:
apache2ctl -M
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
not all required, but my config is loading these now. auth_... and authn_... are realy required for my example, but i don't know which of those authz are required..
How to make DOM not to wait till javascript is downloaded and just open the page?
That's easy. Just add async attribute to the script tag. DOM will be ready before Javascript is downloaded, so the visitor will see contents of the page faster. It's always better, when your JavaScript is only used for user's interaction.
How to check if image has no code injected?
If you let images with code injection be saved on your server, it is possible, that it's a highwayto your php files and whole database, so it is important to make sure, that if user uploads avatar, it is really an avatar, not some hacky stuff with code injected into the image.
Free Ajax URL shortening service with 1 letter domain!
Hey geeks! Today I will share with you my new Free Ajax URL shortening service with 1 letter domain! It is simple to use, just make POST or GET request to this url:
How to start Android Studio Windows 8 64bit?
Quick tutorial on how to start Android Studio version 0.1 in Windows 8. You can download Android Studio from here: http://developer.android.com/sdk/installing/studio.html
Subscribe to:
Posts (Atom)

