Saturday, September 24, 2016

protect postfix from outside

iptables -A INPUT -p tcp -s 127.0.0.0/8 --dport 25 -j ACCEPT
iptables -A INPUT -p tcp --dport 25 -j DROP

Sunday, August 21, 2016

some study

I decided to study in hackerrank these days. just for practice and think more. for this question

https://www.hackerrank.com/challenges/staircase

java 7 solution


 at least there is not two for loop :)

Sunday, August 14, 2016

google city are searches

I did not know this feature of google. I used to live in istanbul now in wroclaw. and I was wondering how small this city is. and search wroclow city are in google

https://www.google.pl/search?q=wroclaw+city+area


https://www.google.pl/search?q=istanbul+city+area


5343 km square is huge. population and traffic huge too. but I am happy with my small wroclaw :)

linux mint xiaomi redmi 3 pro upgrade to MIUI 8

I bought this phone around 3 months ago. first I had a lot of problems about menu and applications. some chinese some english. some utf problems in applications. anyway I was reading this miui 8 update

then I decided to upgrade mine too. but I am a new in this flashing rom or any adb commands.  first I downloaded recovery image then put the image in phone try to update from updater app inside phone it did not work. then I tried to use TWRP and fastboot method. I had problems about giving root access to twrp. then tried to use miflash but my machine is linux mint. so it did not work too.

I tried every online tutorial and could not upgrade my phone. at last I was reading shell scripts in fastboot package
flash_all.sh
flash_all_lock.sh
flash_all_lock.bat
flash_all_except_data_storage.sh
actually I was not sure about these commands
fastboot $* getvar product 2>&1 | grep "^product: ido"
if [ $? -ne 0 ] ; then echo "Missmatching image and device"; exit 1; fi
fastboot $* flash partition `dirname $0`/images/gpt_both0.bin
fastboot $* flash tz `dirname $0`/images/tz.mbn
fastboot $* flash sbl1 `dirname $0`/images/sbl1.mbn
fastboot $* flash rpm `dirname $0`/images/rpm.mbn
fastboot $* flash aboot `dirname $0`/images/emmc_appsboot.mbn
tried first line manually but fastboot command not found. I check apt repo and installed it with 
apt-get install android-tools-fastboot
then first line worked
ido_xhdpi_global_images_6.8.11_20160805.0000.29_5.1_global # fastboot $* getvar product
product: ido
finished. total time: 0.001s
then run the shell script
ido_xhdpi_global_images_6.8.11_20160805.0000.29_5.1_global # ./flash_all.sh
ido Fastboot Tool Ver 5.0
product: ido
target reported max download size of 268435456 bytes
sending 'partition' (33 KB)...
OKAY [  0.004s]
writing 'partition'...
OKAY [  0.024s]
finished. total time: 0.027s
target reported max download size of 268435456 bytes
sending 'tz' (504 KB)...
OKAY [  0.018s]
writing 'tz'...
OKAY [  0.012s]
finished. total time: 0.030s
target reported max download size of 268435456 bytes
sending 'sbl1' (286 KB)...
OKAY [  0.010s]
writing 'sbl1'...
OKAY [  0.009s]
finished. total time: 0.019s
target reported max download size of 268435456 bytes
sending 'rpm' (156 KB)...
OKAY [  0.007s]
writing 'rpm'...
OKAY [  0.008s]
finished. total time: 0.015s
target reported max download size of 268435456 bytes
sending 'aboot' (518 KB)...
OKAY [  0.018s]
writing 'aboot'...
OKAY [  0.012s]
finished. total time: 0.030s
target reported max download size of 268435456 bytes
sending 'hyp' (72 KB)...
OKAY [  0.005s]
writing 'hyp'...
OKAY [  0.005s]
finished. total time: 0.010s
target reported max download size of 268435456 bytes
sending 'tzbak' (504 KB)...
OKAY [  0.019s]
writing 'tzbak'...
OKAY [  0.013s]
finished. total time: 0.031s
target reported max download size of 268435456 bytes
sending 'sbl1bak' (286 KB)...
OKAY [  0.012s]
writing 'sbl1bak'...
OKAY [  0.007s]
finished. total time: 0.019s
target reported max download size of 268435456 bytes
sending 'rpmbak' (156 KB)...
OKAY [  0.008s]
writing 'rpmbak'...
OKAY [  0.007s]
finished. total time: 0.015s
target reported max download size of 268435456 bytes
sending 'abootbak' (518 KB)...
OKAY [  0.020s]
writing 'abootbak'...
OKAY [  0.012s]
finished. total time: 0.031s
target reported max download size of 268435456 bytes
sending 'hypbak' (72 KB)...
OKAY [  0.006s]
writing 'hypbak'...
OKAY [  0.006s]
finished. total time: 0.012s
erasing 'boot'...
OKAY [  0.023s]
finished. total time: 0.023s
target reported max download size of 268435456 bytes
sending 'modem' (53457 KB)...
OKAY [  1.712s]
writing 'modem'...
OKAY [  0.704s]
finished. total time: 2.416s
target reported max download size of 268435456 bytes
erasing 'system'...
OKAY [  0.332s]
sending sparse 'system' (259609 KB)...
OKAY [  8.568s]
writing 'system'...
OKAY [  3.559s]
sending sparse 'system' (260573 KB)...
OKAY [  8.617s]
writing 'system'...
OKAY [  4.170s]
sending sparse 'system' (255173 KB)...
OKAY [  8.511s]
writing 'system'...
OKAY [  4.840s]
sending sparse 'system' (256974 KB)...
OKAY [  8.565s]
writing 'system'...
OKAY [  3.978s]
sending sparse 'system' (262068 KB)...
OKAY [  8.773s]
writing 'system'...
OKAY [  4.573s]
sending sparse 'system' (260406 KB)...
OKAY [  8.674s]
writing 'system'...
OKAY [  4.561s]
sending sparse 'system' (28525 KB)...
OKAY [  0.980s]
writing 'system'...
OKAY [  0.466s]
finished. total time: 79.168s
target reported max download size of 268435456 bytes
erasing 'cache'...
OKAY [  0.030s]
sending 'cache' (5736 KB)...
OKAY [  0.186s]
writing 'cache'...
OKAY [  0.090s]
finished. total time: 0.306s
target reported max download size of 268435456 bytes
erasing 'userdata'...
OKAY [  3.322s]
sending 'userdata' (138958 KB)...
OKAY [  4.419s]
writing 'userdata'...
OKAY [  1.891s]
finished. total time: 9.632s
target reported max download size of 268435456 bytes
sending 'recovery' (10107 KB)...
OKAY [  0.339s]
writing 'recovery'...
OKAY [  0.136s]
finished. total time: 0.475s
target reported max download size of 268435456 bytes
sending 'boot' (9327 KB)...
OKAY [  0.301s]
writing 'boot'...
OKAY [  0.152s]
finished. total time: 0.453s
target reported max download size of 268435456 bytes
sending 'persist' (4720 KB)...
OKAY [  0.151s]
writing 'persist'...
OKAY [  0.072s]
finished. total time: 0.223s
target reported max download size of 268435456 bytes
sending 'misc' (8 KB)...
OKAY [  0.004s]
writing 'misc'...
OKAY [  0.003s]
finished. total time: 0.007s
target reported max download size of 268435456 bytes
sending 'splash' (5401 KB)...
OKAY [  0.174s]
writing 'splash'...
OKAY [  0.075s]
finished. total time: 0.249s
target reported max download size of 268435456 bytes
sending 'cust' (227494 KB)...
OKAY [  7.269s]
writing 'cust'...
OKAY [  3.279s]
finished. total time: 10.548s
rebooting...
finished. total time: 0.001s
it took around 20 minutes for my phone to reboot. now I have miui 8 and this time all google apps included in this rom. I start using it directly without installing google apps. normally google apps was not in xiaomi redmi 3 and took me a while to understand. because normally in lg or samsung I never had system like this without google play store it was really hard to use. btw I ran those commands with root. I did not want to configure usb related access rights.

odd string diff

 https://leetcode.com/problems/odd-string-difference/ Beats 19.92% of users with Java   class Solution { public String oddString ( S...