Skip to content

Instantly share code, notes, and snippets.

View AhmedThahir's full-sized avatar

Ahmed Thahir AhmedThahir

View GitHub Profile
@AhmedThahir
AhmedThahir / list-files-in-folders.gs
Last active March 14, 2024 11:42 — forked from sparkalow/list-files-in-folders.gs
Google Apps Script to recursively list files in a folder
/*
Recusrsively add a list of files from a named foler to a sheet
*/
function main() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var searchMenuEntries = [{
name: "List Folder Content Recursively",
functionName: "start"
}];
@AhmedThahir
AhmedThahir / sgd-for-scipy.py
Last active December 22, 2023 08:29 — forked from jcmgray/sgd-for-scipy.py
Stochastic gradient descent functions compatible with ``scipy.optimize.minimize(..., method=func)``.
import numpy as np
from scipy.optimize import OptimizeResult
"""
scipy.optimize.minimize(..., method=func)
where func = one of the functions below
"""
def sgd(
@AhmedThahir
AhmedThahir / background.js
Last active March 29, 2023 07:55 — forked from danharper/background.js
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
@AhmedThahir
AhmedThahir / service-worker.js
Created March 26, 2023 13:12 — forked from JMPerez/service-worker.js
An example of a service worker for serving network first, cache second
// the cache version gets updated every time there is a new deployment
const CACHE_VERSION = 10;
const CURRENT_CACHE = `main-${CACHE_VERSION}`;
// these are the routes we are going to cache for offline support
const cacheFiles = ['/', '/about-me/', '/projects/', '/offline/'];
// on activation we clean up the previously registered service workers
self.addEventListener('activate', evt =>
evt.waitUntil(
<link rel='manifest' href='/manifest.json'>
<script>
// Check compatibility for the browser we're running this in
if ("serviceWorker" in navigator) {
if (navigator.serviceWorker.controller) {
console.log("[PWA Builder] active service worker found, no need to register");
} else {
// Register the service worker
navigator.serviceWorker