Skip to content

Instantly share code, notes, and snippets.

View OJ7's full-sized avatar
🦁
Woof!

Omair OJ7

🦁
Woof!
View GitHub Profile
@OJ7
OJ7 / OpenFileWithSublimeText3.bat
Created April 4, 2016 17:57
Add "Open with Sublime Text 3" to Windows Explorer Context Menu (only files)
@echo off
SET st3fqfn=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3fqfn%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3fqfn% \"%%1\"" /f
pause
@OJ7
OJ7 / salat_times.py
Last active September 14, 2021 17:56
Home Assistant Islamic Prayer Times
import json
from datetime import datetime, timedelta
try:
from urllib.request import Request, urlopen # Python 3
except ImportError:
from urllib2 import Request, urlopen # Python 2
def convertTime(salatTime, offset):
salatTime = datetime.strptime(salatTime, '%I:%M %p')
@OJ7
OJ7 / automations.yaml
Last active March 21, 2024 19:08
Automate Playing Adhan on Google Home (using Home Assistant)
# Automation for Dhuhr, Asr, Maghrib, and Isha Adhan
- action:
- alias: ''
data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
media_content_id: https://www.youtube.com/watch?v=ADLO-Hm_nCQ # replace with your choice of Adhan
media_content_type: audio/youtube
service: media_extractor.play_media
- data:
entity_id: media_player.family_room_speaker # replace with your Google Home's id
@OJ7
OJ7 / dummy-migration.html
Created October 15, 2019 21:56
Migrate Android IndexedDB from Ionic 3 to Ionic 4
<!-- This file goes in 'src/assets/migration.html' -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Migration Example</title>
<base href="/" />
@OJ7
OJ7 / extractText.js
Last active December 5, 2019 21:53
Extract Article Texts
// Scripts to extract the text of article body for various websites
// gematsu.com
[...[...document.getElementsByClassName("post_content")][0].children].map(p => p.innerText).join('\n\n')
// venturebeat.com
[...[...document.getElementsByClassName("article-content")][0].children].map(p => p.innerText).join('\n\n')
// ign.com (partially working, some texts are not enclosed in any tags/elements and are not caught by below)
[...[...document.getElementsByClassName("article-page")][0].children].map(p => p.innerText).join('\n\n')
@OJ7
OJ7 / web-whatsapp.css
Last active June 10, 2020 17:35
Blur WhatsApp Web message preview (left-hand side chat list)
// Persistently apply using an extension like Styler Pro
// https://chrome.google.com/webstore/detail/styler-pro/hbhkfnpodhdcaophahpkiflechaoddoi
// Blur text in message preview
._3tBW6 {
color: transparent;
text-shadow: 0 0 4px rgba(0,0,0,0.5);
}
// Blur emojis in message preview
@OJ7
OJ7 / xbgp-dekudeals.js
Created June 10, 2020 17:30
Parse Xbox GamePass availability and display on DekuDeals
/* XBOX GAME PASS LIST PAGE
https://www.xbox.com/en-US/xbox-game-pass/games
*/
// Scrape XBGP Data (run on each page)
var titles = [...document.getElementsByClassName("x1GameName")].map(a => a.innerText.replace(/( - Windows 10 Edition)|( - Xbox One Edition)|( - Windows 10)|( for Windows 10)|( \(Windows\))/, ''));
var availability = [...[...[...document.getElementsByClassName("availability")]].map(a => a.getElementsByClassName("c-glyph"))].map(a => [...a].map(b => b.ariaLabel));
var gpMap = JSON.parse(window.localStorage.getItem("xbgp", gpMap) || '{}');
for(var i = 0; i < titles.length; i++) {
@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;
@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 / 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