Skip to content

Instantly share code, notes, and snippets.

View p32929's full-sized avatar

Fayaz Bin Salam p32929

View GitHub Profile
@p32929
p32929 / ManufacturerBatteryOptimization.java
Last active March 29, 2023 13:08
Many Android manufacturers cause trouble by implementing battery optimizations that cause apps to behave unexpectedly at runtime. This util class allows you to show a dialog to users having such phones and sends them to the settings screen where they can turn of battery optimizations for your app.
/*
MIT License
Copyright (c) 2018 Fayaz Bin Salam
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@p32929
p32929 / Colors
Last active May 2, 2019 07:10
Just some material design colors that I mostly try to use :/
<color name="red">#D32F2F</color>
<color name="pink">#C2185B</color>
<color name="purple">#7B1FA2</color>
<color name="deep_purple">#512DA8</color>
<color name="indigo">#303F9F</color>
<color name="blue">#1976D2</color>
<color name="light_blue">#0288D1</color>
<color name="cyan">#0097A7</color>
<color name="teal">#00796B</color>
<color name="green">#388E3C</color>
@p32929
p32929 / browser_history.md
Created May 6, 2019 07:15 — forked from dropmeaword/browser_history.md
Playing around with Chrome's history

Browser histories

Unless you are using Safari on OSX, most browsers will have some kind of free plugin that you can use to export the browser's history. So that's probably the easiest way. The harder way, which seems to be what Safari wants is a bit more hacky but it will also work for other browsers. Turns out that most of them, including Safari, have their history saved in some kind of sqlite database file somewhere in your home directory.

The OSX Finder cheats a little bit and doesn't show us all the files that actually exist on our drive. It tries to protect us from ourselves by hiding some system and application-specific files. You can work around this by either using the terminal (my preferred method) or by using the Cmd+Shft+G in Finder.

Finder

Once you locate the file containing the browser's history, copy it to make a backup just in case we screw up.

import 'package:flutter/material.dart';
void main() {
runApp(const StartingPoint());
}
class StartingPoint extends StatelessWidget {
const StartingPoint({Key? key}) : super(key: key);
@override
@p32929
p32929 / FayFetch.js
Last active January 23, 2021 12:41
A helper class for easier Node Fetch
Moved to https://www.npmjs.com/package/fayfetch
Thanks to everyone for using it
@p32929
p32929 / ADB_Backup.md
Last active December 21, 2021 15:23
Adb backup restore APK + Data

List

List all installed apps

adb shell pm list packages -f -3

You might also use grep altogether

 adb shell pm list packages -f -3 | grep "anybooks"
@p32929
p32929 / Question.ts
Last active December 4, 2022 09:58
Simple way to ask prompts in a shell/terminal/cmd in nodejs typescript
// @ts-ignore
const readline = require("readline")
export class Question {
static ask(questionTexts: string, callback?: (answer: string) => void): Promise<string> {
return new Promise((resolve) => {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
})
@p32929
p32929 / GetUser.Decorator.ts
Created December 7, 2022 14:07
GetUser.Decorator.ts
// import { User } from '@interfaces/user.interface';
import { User } from '@interfaces/user.interface';
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
export const GetUser = createParamDecorator(
(data, ctx: ExecutionContext): User => {
const req = ctx.switchToHttp().getRequest();
return req.user;
},
);
@p32929
p32929 / siin_p32929.json
Last active July 27, 2023 16:43
List of apps to Silently install - p32929
[
{
"title": "Vscode",
"url": "https://code.visualstudio.com/sha/download?build=stable&os=win32-x64-user"
}
]
@p32929
p32929 / Chrome.ts
Last active September 7, 2024 15:44
Playwright utility functions
// v0.0.7
import { Page, BrowserType, BrowserContext, chromium, firefox } from "playwright";
class ChromeConstants {
static SHOULD_CRASH_AFTER_URL_RETRY = true
static dbPath = "./data/database.json"
static defaultChromeTimeout = 1000 * 60 * 5
static defaultMaxWaitMs = 1000 * 5