This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
print_usage() { | |
echo "usage: compress_video <input_file>" | |
echo "supported formats: mp4, webm, mkv, mov, avi, flv" | |
} | |
get_extension() { | |
f="${1##*/}" | |
case "$f" in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import logging | |
import time | |
from typing import Dict, Any | |
import requests | |
from bs4 import BeautifulSoup | |
from openai import OpenAI | |
from requests.exceptions import RequestException | |
from tenacity import retry, stop_after_attempt, wait_random_exponential |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handler(webhook) { | |
const {data: user} = webhook.payload; | |
// Extract relevant details | |
const emailAddress = user.email_addresses?.[0]?.email_address || 'Unknown user'; | |
const firstName = user.first_name || ''; | |
const lastName = user.last_name || ''; | |
const fullName = `${firstName} ${lastName}`.trim() || emailAddress; | |
const profileImageUrl = user.profile_image_url || 'https://www.gravatar.com/avatar?d=mp'; | |
const createdAt = new Date(user.created_at).toLocaleString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string firstLastName = "KarenPayne"; | |
var separated = firstLastName.SplitByCase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"messages": [ | |
{ | |
"content": "You are an advanced, reliable, candid AI system that takes user search queries, converts them into questions, and answers them, using specific facts and details sourced from webpages to prove your answer. You admit when you're unsure or don't know, and you never make a statement without providing a fact or instance to back it up. You answer questions directly and clearly, then provide more detail later. You follow the JSON schema exactly.", | |
"role": "system" | |
}, | |
{ | |
"content": "# CONTEXT\nCurrent date: #{DATE_TIME}.\n\nHere are result from a web search for '#{QUERY}':\nBEGIN WEB PAGE #{HOST_1} #{MARKDOWN_1}END WEB PAGE\nBEGIN WEB PAGE #{HOST_2} #{MARKDOWN_2}END WEB PAGE\nBEGIN WEB PAGE #{HOST_3} #{MARKDOWN_3}END WEB PAGE\nBEGIN WEB PAGE #{HOST_4} #{MARKDOWN_4}END WEB PAGE\nBEGIN WEB PAGE #{HOST_5} #{MARKDOWN_5}END WEB PAGE\nBEGIN WEB PAGE #{HOST_6} #{MARKDOWN_6}END WEB PAGE", | |
"role": "system" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum BookCategories | |
{ | |
[Description("Options")] | |
[Display(Name = "Select")] | |
Select = 0, | |
[Description("Space Travel")] | |
[Display(Name = "Space Travel")] | |
SpaceTravel = 1, | |
[Description("Adventure")] | |
[Display(Name = "Adventure")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Custom setting for presenting runtime exceptions using AnsiConsole.WriteException. | |
/// | |
/// The idea here is to present different types of exceptions with different colors while | |
/// one would be for all exceptions and the other(s) for specific exception types. | |
/// </summary> | |
public class ExceptionHelpers | |
{ | |
/// <summary> | |
/// Provides colorful exception messages in cyan and fuchsia |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This script will iterate over all of your ChatGPT sessions and archive them one-by-one. | |
// | |
// 1. Go to https://chat.openai.com/ | |
// 2. Open Chrome devtools (see https://developer.chrome.com/docs/devtools/open) or equivalent in your browser | |
// 3. Open the console tab | |
// 4. Paste the code below and press enter | |
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); | |
const history = document.querySelector('[aria-label="Chat history"]'); | |
while (true) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Result | |
{ | |
protected internal Result(bool isSuccess, Error error) | |
{ | |
if (isSuccess && error != Error.None) | |
{ | |
throw new InvalidOperationException(); | |
} | |
if (!isSuccess && error == Error.None) |
NewerOlder