Skip to content

Instantly share code, notes, and snippets.

@larryyangsen
larryyangsen / agent loop
Created March 12, 2025 03:39 — forked from jlia0/agent loop
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
import { youtube } from './youtube.mjs'
import { searchYoutubeWithInSubtitles } from './searchYoutubeWithInSubtitles.mjs'
import { readYoutubeTxt, sleep } from './lib.mjs';
const isSearchYoutube = process.argv.includes('--search');
const downloadYoutubeFromUrls = async (urls) =>
urls.reduce(async (promise, url) => {
await promise;
await youtube(url);
@larryyangsen
larryyangsen / findNotCherryPicked.sh
Created October 19, 2023 07:22
find not cherry picked commits
git log --format="%h %s" --cherry-pick --oneline --left-only --no-merges develop...master |
while read cmt_log
do
cmt_msg=`echo "${cmt_log}" | awk '{ $1=""; print }'`
git log --format=" %s" develop..master | grep --fixed-string -s "${cmt_msg}" > /dev/null || echo ${cmt_log}
done
@larryyangsen
larryyangsen / sortJsonKeys.js
Created February 19, 2021 03:48
Sort Json Keys by alphabet
const ao = {
g: 3,
acd: 3,
a: 1,
b: 2,
ddd:6,
delete: 1,
d: 3,
ccc: 1,
};
@larryyangsen
larryyangsen / createCtx-noNullCheck.tsx
Created March 3, 2020 01:38 — forked from swyxio/createCtx-noNullCheck.tsx
better createContext APIs with setters, and no default values, in Typescript. this is documented in https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/blob/master/README.md#context
// create context with no upfront defaultValue
// without having to do undefined check all the time
function createCtx<A>() {
const ctx = React.createContext<A | undefined>(undefined)
function useCtx() {
const c = React.useContext(ctx)
if (!c) throw new Error("useCtx must be inside a Provider with a value")
return c
}
return [useCtx, ctx.Provider] as const
@larryyangsen
larryyangsen / proxy.go
Last active August 14, 2018 03:52
golang add http proxy, use mitmweb (https://mitmproxy.readthedocs.io/en/v2.0.2/mitmweb.html), mitmweb -p 9999
os.Setenv("HTTP_PROXY", "http://127.0.0.1:9999")
baseURL := "http://google.com"
resp, err := http.Get(baseURL)
@larryyangsen
larryyangsen / userMedia.html
Created August 4, 2018 11:42
html get user media
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Recording</title>
</head>
@larryyangsen
larryyangsen / download.js
Created May 28, 2018 14:41
axios download audio file
const { data } = await axios.get(url, {
responseType: 'arraybuffer',
headers: {
'Content-Type': 'audio/wav'
}
});
const blob = new Blob([data], {
type: 'audio/wav'
});
const partial = (fn, ...args) => fn.bind(null, ...args);
const add3 = (a, b, c) => a + b + c;
const inc = partial(add3, 1, 2);
const result = inc(3);
console.log(result) //6
func groupArray(array []int, length int) [][]int {
var group [][]int
if length > len(array) {
return nil
}
for len(array) > length {
var newArray []int
newArray = append(newArray, array[:length]...)
group = append(group, newArray)
array = append(array[:0], array[length:]...)