Skip to content

Instantly share code, notes, and snippets.

View tatocaster's full-sized avatar
🇺🇦

Merab Tato Kutalia tatocaster

🇺🇦
View GitHub Profile
@tatocaster
tatocaster / RealPathUtil.java
Last active April 3, 2024 00:27
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
@tatocaster
tatocaster / recommendation.py
Last active August 15, 2023 09:20
based on Nintendo game data, cluster by features and get similar games
import pandas as pd
from sklearn.cluster import KMeans
# Read the video games dataset into a DataFrame
data = pd.read_json('../data/nintendo-games.json')
features = data[['meta_score', 'esrb_rating', 'genres']]
# convert categorical features to numerical using one-hot encoding
features = pd.get_dummies(features, columns=['meta_score', 'esrb_rating', 'genres'])
@tatocaster
tatocaster / nintendo.ts
Created August 15, 2023 09:04
get Nintendo EShop games and metacritics score
import { getGamesAmerica, GameUS, EshopError } from 'nintendo-switch-eshop';
import * as fs from 'fs';
import { HTMLElement, parse } from "node-html-parser";
import fetch from 'node-fetch';
const dest = './nintendo-games.json';
const allowedLettersInTitle = /[^a-zA-Z0-9 ]+/g;
const PAGE_SIZE = 25
@tatocaster
tatocaster / nintendo.go
Last active August 15, 2023 08:09
Download Nintendo Game data for my account
package main
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"os"
"regexp"
"os/exec"
invoke-static {p0}, Landroidx/preference/e;->a(Landroid/content/Context;)Landroid/content/SharedPreferences;
move-result-object v0
const-string v1, "preferencePremium"
const/4 v2, 0x1
invoke-interface {v0}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;
move-result-object v0
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->apply()V
@tatocaster
tatocaster / quick_approve.js
Created September 30, 2022 07:08 — forked from lamp/quick_approve.js
Mark All Issues on codeclimate as wontfix
$('li[data-issue-status-name="wontfix"]').each((i, e) => { e.click() })
$('input[name="commit"]').each((i, e) => { e.click() })
@tatocaster
tatocaster / dependencies.txt
Last active October 5, 2021 21:02
gradle dependencies. Snippet
+--- androidx.databinding:viewbinding:4.1.2
| \--- androidx.annotation:annotation:1.0.0 -> 1.2.0
+--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32
| \--- org.jetbrains:annotations:13.0
+--- com.squareup.leakcanary:leakcanary-android:2.7
| +--- com.squareup.leakcanary:leakcanary-android-core:2.7
| | +--- com.squareup.leakcanary:shark-android:2.7
| | | \--- com.squareup.leakcanary:shark:2.7
| | | \--- com.squareup.leakcanary:shark-graph:2.7
@tatocaster
tatocaster / PermissionUtils.java
Created May 15, 2016 11:18
Utility class for access to runtime permissions.
/**
* Utility class for access to runtime permissions.
*/
public abstract class PermissionUtils {
/**
* Requests the fine location permission. If a rationale with an additional explanation should
* be shown to the user, displays a dialog that triggers the request.
*/
public static void requestPermission(AppCompatActivity activity, int requestId,
@tatocaster
tatocaster / detekt.gradle
Created February 25, 2021 15:09
Detekt gradle tasks for multi-module project
// add classpath dependency before
// classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion"
def configFile = files("$rootDir/config/detekt/detekt.yml")
def baselineFile = file("$rootDir/config/detekt/baseline.xml")
def analysisDir = file(projectDir)
def kotlinFiles = "**/*.kt"
def javaFiles = "**/*.java"
def resourceFiles = "**/resources/**"
@tatocaster
tatocaster / EspressoTest.kt
Last active August 9, 2020 20:02
Espresso Test
@Test
fun labelsAreDisplyed_SameFragment() {
// some other assertions
onView(withId(R.id.tvAccountNumberLabel))
.perform(nestedScrollTo())
.check(matches(isDisplayed()))
// here as well
}