Skip to content

Instantly share code, notes, and snippets.

View s3va's full-sized avatar

Vsevolod Semenov s3va

  • Seva's studio apartment
  • Moskva (Moscow)
View GitHub Profile
@s3va
s3va / EncryptedSharedPreferences.java
Created July 24, 2020 00:00
EncryptedSharedPreferences
final String userNameShPr="userNameShPr";
final String passwordShPr="passWordShPr";
final String checkBoxShPr="checkBoxShPr";
final String SHARED_PREFERENCES_FNAME = "secret_shared_prefs";
MasterKey masterKey = new
MasterKey.Builder(this,MasterKey.DEFAULT_MASTER_KEY_ALIAS).
setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build();
SharedPreferences sharedPreferences = EncryptedSharedPreferences
.create(
@s3va
s3va / gradient_btn.xml
Created July 23, 2020 23:52
Background for button with round corners and gradient color
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<!--make a gradient background-->
<gradient
android:type="linear"
android:startColor="#060"
android:endColor="#060"
android:centerColor="#4d4"
@s3va
s3va / SuperMarket.php
Created July 22, 2020 19:59
Super Market For SeyKo2. Currency cources and metall prices from cbr.ru by SOAP.
<?php
session_start();
error_log("!!hph://input!! ".file_get_contents("php://input")." !!!!!!!!!!!!!");
error_log("!!\$_POST!!!!!!! ".print_r($_POST,TRUE)." !!!!!!!!!!!!!");
error_log("NNNNNN ".print_r($_SESSION,TRUE)." NNNN");
if(isset($_POST['val'])){
if($_POST['val']=='USD')
$_SESSION['val']='USD';
@s3va
s3va / index.php
Created July 20, 2020 01:17
Super Market With OAuth2.0 from Google
<?php
include ('config.php');
require_once 'mysqlini.php';
$login_button = '';
if (isset($_GET["code"])) {
$token = $google_client->fetchAccessTokenWithAuthCode($_GET["code"]);
if (! isset($token['error'])) {
$google_client->setAccessToken($token['access_token']);
$_SESSION['access_token'] = $token['access_token'];
$_SESSION['token'] = $token;