Skip to content

Instantly share code, notes, and snippets.

View saamerm's full-sized avatar
💭
Answering Questions, & Questioning Answers

Saamer Mansoor saamerm

💭
Answering Questions, & Questioning Answers
View GitHub Profile
@saamerm
saamerm / autorestart.sh
Last active October 3, 2025 21:13
Shell script to auto-restart your app on MacOs
#!/bin/bash
# To use this with any app, just change line 14 to your app's name.
# Works for if your app crashes or computer restarts
# Shell script to stop this functionality is here https://gist.github.com/saamerm/010215ab8c207cc4d7e96a7b09d9e130
PLIST=~/Library/LaunchAgents/com.confcap.autorestart.plist
cat > "$PLIST" <<EOL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@saamerm
saamerm / automator-disable.sh
Created October 3, 2025 21:12
Shell script to stop the auto restart functionality on Mac OS for any app
#!/bin/bash
# Shell script to stop the auto start functionality as shown here https://gist.github.com/saamerm/f83a6573776c696e6539ae4432542746
PLIST=~/Library/LaunchAgents/com.confcap.autorestart.plist
cat > "$PLIST" <<EOL
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
@saamerm
saamerm / translate.sh
Last active January 29, 2026 20:02
Shell script that takes a json file and generates translations of the index.html file!
#!/usr/bin/env bash
# Shell script that takes a json file and generates translations of the index.html file!. Json file format used is created by pasting the string from here https://codepen.io/saamerm/pen/NWVZyEm
# Run by placing this file in the same folder as the index.html and the json file using `sh translate.sh`
# Comment out section below line 36 if not using gsed!
set -euo pipefail
TRANSLATIONS_FILE="translations.json"
languageCodes=("ES" "FR" "PT" "AR" "RU" "DE" "UK" "HI" "UR" "YO" "ID" "IT" "JA" "SW" "PL" "VI" "RO" "zh-Hant" "ZH" "HR" "FA" "NL" "KO" "SV" "HU" "SQ")
@saamerm
saamerm / hisense-online-remote.js
Last active July 1, 2026 14:43
Use this code to Control your Hisense TV with In-built Fire TV remotely. This is the server code, needed for the front end code https://gist.github.com/saamerm/df3e08e9564c5a65b1cbf41b6c5be6ea
// You need a server in order to prevent CORS errors from allowing you to communicate with the TV
// Steps to get started: Make sure you have node installed, then download this file (or create a new file and put it in a blank directory and then run the commands below in your terminal
// npm init -y
// npm install express cors adbkit wakeonlan
// node hisense-online-remote.js
const express = require('express');
const cors = require('cors');
const adb = require('adbkit');
const wol = require('wakeonlan');
@saamerm
saamerm / hisense-online-remote.html
Created July 1, 2026 14:42
This is the front end code for an online remote control for your Hisense with in-built Fire TV. The server code is here: https://gist.github.com/saamerm/e0fc57906a31535fea6591a8650e92b2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hisense Fire TV Controller</title>
<style>
body { font-family: 'Segoe UI', system-ui, sans-serif; display: flex; flex-direction: column; align-items: center; background: #121214; color: #fff; margin: 0; padding: 20px; }
.grid-container { display: grid; grid-template-columns: repeat(3, 90px); gap: 12px; margin-top: 20px; justify-content: center;}
button { font-size: 1rem; font-weight: 600; padding: 16px; border-radius: 12px; border: none; cursor: pointer; background: #202024; color: #fff; transition: background 0.2s; }
button:hover { background: #2a2a30; }