Skip to content

Instantly share code, notes, and snippets.

View Avi-E-Koenig's full-sized avatar
🎯
Focusing

Avi E. Koenig Avi-E-Koenig

🎯
Focusing
View GitHub Profile
@Avi-E-Koenig
Avi-E-Koenig / saveAttachmentsFromSender.gs
Last active November 17, 2025 15:24
google get all attachments
function saveAttachmentsFromSender() {
const SENDER = "******";
const FOLDER_ID = "*******";
const folder = DriveApp.getFolderById(FOLDER_ID);
const threads = GmailApp.search(`from:${SENDER} has:attachment`);
let savedCount = 0;
threads.forEach(thread => {
const messages = thread.getMessages();
{
"currencies": {
"AED": {
"code": "AED",
"number": "784",
"digits": 2,
"currency": "United Arab Emirates dirham",
"countries": [
"United Arab Emirates"
],
@Avi-E-Koenig
Avi-E-Koenig / useLocalStorage.ts
Created October 30, 2025 21:04
NextJS localstorage hook
import { useCallback, useEffect, useRef, useState } from 'react'
import loggerClient from '@/lib/logger-client'
const useLocalStorage = <T>(
key: string,
defaultValue: T,
): [T, (value: T | ((prev: T) => T)) => void] => {
const [value, setValue] = useState<T>(defaultValue)
const [isHydrated, setIsHydrated] = useState(false)
@Avi-E-Koenig
Avi-E-Koenig / MarkdownDisplay.vue
Last active August 29, 2025 18:33
MarkdownDisplay.vue
<!-- eslint-disable vue/no-v-html -->
<template>
<div
ref="root"
:class="['markdown-display', containerClass]"
v-bind="$attrs"
v-html="safeHtml"
/>
</template>
import Dexie from "dexie";
import helpers from "./helpers";
// Constants
const CACHE_CONSTANTS = {
DB_NAME: "ProgressCacheDB",
// TTL Settings
HISTORICAL_TTL: 7 * 24 * 60 * 60 * 1000, // 7 days
TODAY_TTL: 2 * 60 * 60 * 1000, // 2 hours
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import { FlatCompat } from '@eslint/eslintrc'
import prettier from 'eslint-plugin-prettier'
import jsxA11y from 'eslint-plugin-jsx-a11y'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const compat = new FlatCompat({ baseDirectory: __dirname })
-- =========================================
-- Create a read-only SQL Server login/user for all databases
-- Usage: Set @username and @password as needed
-- =========================================
-- Step 1: Declare variables for username and password
DECLARE @username NVARCHAR(128) = N'USERNAME';
DECLARE @password NVARCHAR(128) = N'PASSWORD';
-- Step 2: Create the login at the server level (if not already created)
'use client';
import React, { createContext, JSX, useCallback, useContext, useEffect, useState } from "react";
import { useLocalStorage } from "@/hooks/useLocalStorage";
import { THEME, LOCALE } from "@/theme";
// import type { ThemeMode, LocaleType } from '@/theme';
interface ApplicationConfigsProps {
children: JSX.Element;
}
# Check if script is running as Administrator
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Error "This script must be run as Administrator. Exiting..."
exit 1
}
# Step 1: Backup and remove NODE_ENV from system environment
$originalNodeEnv = [System.Environment]::GetEnvironmentVariable("NODE_ENV", "Machine")
[System.Environment]::SetEnvironmentVariable("NODE_ENV", $null, "Machine")
// React and types
import * as React from 'react';
import type { Dayjs } from 'dayjs/esm';
// Dayjs and locales
import 'dayjs/locale/he';
import 'dayjs/locale/en';
// MUI X Date Pickers
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';