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 / 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 / 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 / tawkToTrigger.py
Created August 29, 2025 19:26
Automation for Tawk.to in order to automatically add triggers based on translation for different languages
# Automation for Tawk.to in order to automatically add triggers based on translation for different languages
# Lines 338 and 339 should contain the username and password of your tawk.to account
# Since localization and internationalization aren't supported, you can use this as a workaround
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
@saamerm
saamerm / YouTubeCaptionSubtitleExtractor.html
Created May 14, 2025 09:58
YouTube Caption or Subtitle Extractor from the Timed Text API JSON displayed here https://codepen.io/saamerm/pen/OPPdprB
<!-- View the sample here https://codepen.io/saamerm/pen/OPPdprB -->
<html>
<head>
<meta charset="UTF-8">
<title>YouTube Timed Text Extractor</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
}
@saamerm
saamerm / OllamaContentView.swift
Last active April 1, 2025 23:24
Ollama + SwiftUI in a ContentView
//
// OllamaContentView.swift
//
// Created by Saamer Mansoor on 4/1/25.
//
import SwiftUI
import Foundation
struct OllamaContentView: View {
@State var prompt: PromptModel = .init(prompt: "", model: "", system: "")
@saamerm
saamerm / yc-jobs-salary-filter.js
Last active March 3, 2025 17:44
You can use this code to extract & filter the upper limits of the salaries on the ycombinator jobs https://youtu.be/MlbEel7bB8o
// YouTube Video link : https://youtu.be/MlbEel7bB8o
// Pre-reqs: Scrape the Data from the YCombinator job board (https://www.workatastartup.com/. Clean (Lint) the data to ensure it's ready for analysis.
// Code to display job listings and their corresponding salaries.
const fs = require('fs').promises;
async function printFileContents() {
const filePath = 'yc-jobs.json';
try {
@saamerm
saamerm / ImageDownloader.py
Last active October 22, 2024 18:06
Python code to download images from the internet using URLs in a CSV/Google Sheet and resize them selectively
# Create a table with 7 rows in Google Sheets and Copy the data with the headers and paste it in here: https://codepen.io/saamerm/pen/NWVZyEm
# Then get the json from that codepen and replace the variable in line 8 with the new json
import os
import requests
import json
# Sample JSON data
hotels = [
{
"HotelId": "1085",
@saamerm
saamerm / imageResizer.py
Last active October 21, 2024 19:28
Python Image Resizer AspectFit, using `brew install pillow`
import os
from PIL import Image
# Folder containing your images
folder_path = os.getcwd()
# Desired output size
target_size = (450, 180)
# Iterate over files in the folder
@saamerm
saamerm / PostGetAndPrintMultipleAPI.sh
Last active July 16, 2024 20:09
Perform an Salesforce Marketing Cloud Post API call, then wait 2 seconds and take the response to Get the status of the email sent and Print, while using multiple bodies within your powershelgl code
function Invoke-EmailAPI {
param (
[hashtable]$body
)
# Define the API endpoint
$url = "{URL}"
# Define the authorization token
$token = "afasfa23414"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.