Skip to content

Instantly share code, notes, and snippets.

View OJ7's full-sized avatar
🦁
Woof!

Omair OJ7

🦁
Woof!
View GitHub Profile
@OJ7
OJ7 / Home-Assistant-Adhan-Automation.md
Last active April 18, 2024 18:55
Home Assistant Adhan Automation for Google Home/Nest (Updated 2024)

After installing Home Asssistant:

  • Install Islamic Prayer Times integration and configure its settings to your desired calculation method.
  • Place adhan files in www/adhan (www should be in the same directory as configuration.yaml).
    • Using File Editor addon: navigate to /homeassistant, create www directory, create adhan directory in there, upload adhan files.
  • Copy above files to your home assistant config directory.
  • Go to Settings -> Automations -> update the automations to use your desired device for playing adhan.

Optional for remote access:

  • Setup Dynamic DNS
  • Using DuckDNS addon: create an account/domain on duckdns.org, set domain and token in the addon's config.
@OJ7
OJ7 / psn-account-id.js
Created September 27, 2023 18:06
(WIP) JS conversion of psn-account-id.py
import axios, { AxiosRequestConfig } from "axios";
import PromptSync from "prompt-sync";
import endianess from 'endianness'
const CLIENT_ID = "ba495a24-81218c-472342b-b1122d-ff231c1b5745";
const CLIENT_SECRET = "mvai123ZkRsAsI1IBkY";
const LOGIN_URL = `https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/authorize?service_entity=urn:service-entity:psn&response_type=code&client_id=${CLIENT_ID}&redirect_uri=https://remoteplay.dl.playstation.net/remoteplay/redirect&scope=psn:clientapp&request_locale=en_US&ui=pr&service_logo=ps&layout_type=popup&smcid=remoteplay&prompt=always&PlatformPrivacyWs1=minimal&`;
const TOKEN_URL =
"https://auth.api.sonyentertainmentnetwork.com/2.0/oauth/token";
@OJ7
OJ7 / interactive-playwright.js
Created July 8, 2023 16:14
Open Interactive Playwright in Node session (run code in real time in browser)
/**
* Run the following in your terminal:
* npm i playwright-firefox
* npx playwright install --with-deps
* node --experimental-repl-await
*/
// Modify/paste the following in the interactive console:
@OJ7
OJ7 / atv-setup.sh
Last active July 3, 2023 22:39
Android/Google TV Setup (remove bloatware, install custom home launcher and apps)
#!/bin/bash
# HOWTO: Enable Developer Settings on device
# Go to Settings > About phone and tap on the "Build number" 7 times to enable Developer Options.
# Go to Settings > System > Developer Settings > 'enable' USB Debugging.
ipaddr="10.0.0.137" # Replace with IP address of Android TV device
directory="." # Replace with the directory path where the APK files are located
# Preloaded apps to remove (comment out the ones you want to keep)
@OJ7
OJ7 / readme.md
Created March 2, 2023 16:58
Reveal Humble Bundle Steam Codes For Redeeming

Batch Redeem Humble Bundle Keys on Steam

  1. Go to https://www.humblebundle.com/home/keys

  2. Check the Hide redeemed keys & entitlements checkbox

  3. Run the following script in DevTools console to reveal all keys (you may have to wait a little for all of them to be revealed):

    [...document.getElementsByClassName('js-keyfield')].forEach(a => a.click());

const orig = Array.from(document.getElementsByClassName('messageListItem-ZZ7v6g'));
setInterval(() => {
const curr = Array.from(document.getElementsByClassName('messageListItem-ZZ7v6g'));
const remaining = curr.filter(
(i) => {
return !orig.find(el => el.id === i.id) && i.outerText.toLowerCase().indexOf('tears') >= 0;
}
);
@OJ7
OJ7 / automations.yaml
Last active April 18, 2024 18:56
Home Assistant config for automatically playing Adhan on Google Home/Nest (updated 2022)
- id: '1660878281315'
alias: Play Adhan on Google Home
description: ''
trigger:
- platform: template
value_template: '{{ states.sensor.dhuhr.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.sensor.asr.state == states.sensor.time.state }}'
- platform: template
value_template: '{{ states.sensor.maghrib.state == states.sensor.time.state }}'
@OJ7
OJ7 / rclone-download-public-gdrive-folder.sh
Created February 23, 2022 09:04
Use rclone to download public Google Drive folder locally
# `drive-root-folder-id` - ending ID of Google Drive link (eg https://drive.google.com/drive/folders/1BWTX_E_jY3k1TDRvvkE-y1_PE9wgAaU5)
# `gdrive` - name of any remote google drive set up through rclone
rclone copy --drive-root-folder-id=1BWTX_E_jY3k1TDRvvkE-y1_PE9wgAaU5 gdrive: . -P
@OJ7
OJ7 / mailchimp-subscribe-to-archive-link.md
Last active January 24, 2022 15:04
Convert Mailchimp Subscribe Link to Past Issues Link
@OJ7
OJ7 / ynab-custom.css
Created January 11, 2021 13:30
Cleaner YNAB UI
:root {
--header_tbb_positive_background: #62D0A8 !important;
--inspector_message_positive_border: #22D0A8 !important;
--inspector_message_positive_background: #54B290 !important;
--inspector_message_positive_label: white !important;
--budget_balance_positive_background: #22D0A8 !important;
--budget_balance_positive_background_active: #54B290 !important;
--budget_balance_negative_background: #DF6D8C !important;