build.gradle

dependencies {
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
}

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
        android:id="@+id/swipe"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <WebView
            android:id="@+id/webView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="gone"/>
    </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</RelativeLayout>

MainActivity.java

public class MainActivity extends AppCompatActivity {
    private WebView webView;
    private SwipeRefreshLayout swipeRefreshLayout;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        webView = findViewById(R.id.webView);
        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {
                swipeRefreshLayout.setRefreshing(true);
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        swipeRefreshLayout.setRefreshing(false);
                        webView.reload();
                    }
                },3000);
            }
        });
        swipeRefreshLayout.setColorSchemeColors(
                getResources().getColor(R.color.orange)
        );
    }
}
Categories: Android Tags:
public class MainActivity extends AppCompatActivity {
    private WebView webView;
    @Override
    public void onBackPressed(){
        if(webView.canGoBack()){
            webView.goBack();
        }
        else{
            super.onBackPressed();
        }
    }
}
Categories: Android Tags:
28 февраля 2023 Нет комментариев
cat access.log | cut -d'"' -f 6 | grep bot | sort | uniq

Заблокировать лишних в .htaccess

SetEnvIfNoCase User-Agent "AhrefsBot|DotBot|SemrushBot|PetalBot" bad_bot
<Limit GET POST HEAD>
Order Allow,Deny
Allow from all
Deny from env=bad_bot
</Limit>
Categories: Linux Tags:
22 февраля 2023 Нет комментариев
find . -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn

Второй вариант:

du -a . | cut -d/ -f2 | sort | uniq -c | sort -rn
Categories: Linux Tags:
26 января 2023 Нет комментариев
if(str_ireplace($array,'',$str)!=$str){
	echo 'found';
}
Categories: PHP Tags:
23 января 2023 Нет комментариев

В примере нужен для работы эквайринга от СберБанка.
Проверить работу:

curl -I https://securepayments.sberbank.ru/

Загрузить сертификаты

wget --no-check-certificate https://securepayments.sberbank.ru/wiki/lib/exe/fetch.php/certificates:add:cert.rar

Распаковать

yum install unar
unar certificates:add:cert.rar

или

yum install unrar
unrar x certificates:add:cert.rar

Установка

update-ca-trust enable
cp Cert_CA.pem /etc/pki/ca-trust/source/anchors/
update-ca-trust extract
Categories: Linux Tags:
10 ноября 2022 Нет комментариев
$mail->SMTPOptions=array(
	'ssl'=>array(
		'verify_peer'=>false,
		'verify_peer_name'=>false,
		'allow_self_signed'=>true
	)
);
Categories: PHP Tags: