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/bash | |
ancestor_branch=${1:-"origin/develop-sdk"} | |
# Find the latest common ancestor commit | |
joint_commit=$(git merge-base HEAD $ancestor_branch) | |
echo $joint_commit | |
# Get the list of commit hashes from current HEAD to the joint commit | |
commit_hashes=$(git rev-list --ancestry-path ${joint_commit}..HEAD) |
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 { useState, useEffect } from 'react'; | |
function useDebouncedValue<T>(value: T, delay: number): T { | |
const [debouncedValue, setDebouncedValue] = useState(value); | |
useEffect(() => { | |
const handler = setTimeout(() => { | |
setDebouncedValue(value); | |
}, delay); |
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
class extends Generator { | |
writing() { | |
// enable force overwrite | |
this.conflicter.force = true; | |
this.fs.copyTpl( | |
this.templatePath('_package.json'), | |
this.destinationPath('package.json'), | |
{ appname: 'your_appname' } | |
); |
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 readline from 'node:readline'; | |
function printProgress(text: string) { | |
readline.clearLine(process.stdout, 0); | |
readline.cursorTo(process.stdout, 0, undefined); | |
process.stdout.write(text); | |
}; |
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
/** | |
* Test given url availability in browser wiht fetch HTTP HEAD and specific timeout | |
* @param url | |
*/ | |
export function probe(url: string, opt?: RequestInit & { timeout: number }) { | |
const ctrl = new AbortController(); | |
const timeout = (opt || {}).timeout || 5000; | |
const timer = setTimeout(() => ctrl.abort(), timeout); | |
return new Promise(resolve => { | |
const promise = fetch(url, { signal: ctrl.signal, method: 'HEAD', ...opt }) |
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
on ShowTabWitePrefix(targetDomain) tell application "Google Chrome" set windowList to every window repeat with aWindow in windowList set tabList to every tab of aWindow set tabCount to count of tabList set currentTabIndex to 0 set targetTabs to {} -- Collect all the tabs matching the targetDomain prefix repeat with i from 1 to tabCount set aTab to item i of tabList considering case set tabURL to URL of aTab if tabURL starts with targetDomain then set end of targetTabs to {index:i, tab:aTab} end if end considering end repeat -- If there are any matching tabs, activate the next one in the list if (count of targetTabs) > 0 then set currentIndex to 0 repeat with i from 1 to count of targetTabs if active tab index of aWindow is (index of item i of targetTabs) then set currentIndex to i exit repeat end if end repeat -- if the current tab is the last matching one, activate the first one, else activate the next one |
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
const uuidRegex = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(--[0-9a-f]{5})?$/i; | |
function isUuid(str: string) { | |
if (typeof str !== 'string') return false; | |
return uuidRegex.test(str); | |
} |
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 maybeJson(arrayBuffer: ArrayBuffer) { | |
const firstDelimiter = '{'.charCodeAt(0); | |
const lastDelimiters = ['}\n'.charCodeAt(0), '}\n'.charCodeAt(1), '}\r\n'.charCodeAt(0), '}\r\n'.charCodeAt(1)]; | |
const uint8View = new Uint8Array(arrayBuffer); | |
const firstByte = uint8View[0]; | |
const lastTwoBytes = [uint8View[uint8View.length - 2], uint8View[uint8View.length - 1]]; | |
return (firstByte === firstDelimiter) && (lastDelimiters.includes(lastTwoBytes[0]) && lastDelimiters.includes(lastTwoBytes[1])); | |
} |
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
on ShowTabWitePrefix(targetDomain) tell application "Google Chrome" set windowList to every window repeat with aWindow in windowList set tabList to every tab of aWindow set tabCount to count of tabList set currentTabIndex to 0 set targetTabs to {} -- Collect all the tabs matching the targetDomain prefix repeat with i from 1 to tabCount set aTab to item i of tabList considering case set tabURL to URL of aTab if tabURL starts with targetDomain then set end of targetTabs to {index:i, tab:aTab} end if end considering end repeat -- If there are any matching tabs, activate the next one in the list if (count of targetTabs) > 0 then set currentIndex to 0 repeat with i from 1 to count of targetTabs if active tab index of aWindow is (index of item i of targetTabs) then set currentIndex to i exit repeat end if end repeat -- if the current tab is the last matching one, activate the first one, else activate the next one |
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 replicate | |
model = replicate.models.get("prompthero/openjourney") | |
version = model.versions.get("9936c2001faa2194a261c01381f90e65261879985476014a0a37a334593a05eb") | |
PROMPT = "mdjrny-v4 style 360 degree equirectangular panorama photograph, Alps, giant mountains, meadows, rivers, rolling hills, trending on artstation, cinematic composition, beautiful lighting, hyper detailed, 8 k, photo, photography" | |
output = version.predict(prompt=PROMPT, width=1024, height=512) | |
# %% | |
# download the iamge from the url at output[0] | |
import requests |