Skip to content

Instantly share code, notes, and snippets.

@umutbasal
umutbasal / main.go
Created May 8, 2022 00:57
prefix executed commands output
package main
import (
"bufio"
"context"
"fmt"
"io"
"os/exec"
)
alias pastesafsata='curl -s https://api.openai.com/v1/engines/text-davinci-002/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer !!!!!!!! ENTER YOUR TOKENNN" \
-d "{
\"prompt\": \"Tweet: $(pbpaste)\n\n/\/\What kinda logical fallcy this tweet includes? Why?\n\",
\"temperature\": 0.5,
\"max_tokens\": 60,
\"top_p\": 1,
\"frequency_penalty\": 0,
\"presence_penalty\": 0
all=*/
for i in $all
do
if [ -d $i ]; then
cd $i
git pull
cd ..
fi
done
let override = (name, func, callback) => {
return (...args) => {
let ret = func(...args);
callback(name, func, args, ret)
return ret;
};
};
console.error = override("console.error", console.error, (name, func, args, ret)=>{
let storage = {};
let get = function (key) {
return storage[key];
}
let put = function (key, value) {
storage[key] = value;
}
import { serve } from "https://deno.land/[email protected]/http/server.ts";
interface ERequest extends Request {
params: any;
}
function routes(req: ERequest): Response {
const handlers = [
{
pattern: new URLPattern({ pathname: "/books" }),
function logFromTraversal(object, match_string) {
function* traverse(o, path = []) {
for (var i in o) {
const itemPath = path.concat(i);
yield [i, o[i], itemPath, o];
if (o[i] !== null && typeof (o[i]) == "object") {
yield* traverse(o[i], itemPath);
}
}
}
const _with = (v) => eval(`({${Object.getOwnPropertyNames(eval(v)).join(',')}} = ${v});`)
_with("Math"), (
console.log(cos(PI))
)
const words = require('./words.json');
const countVowels = ([...word]) => word.filter(l => l.match(/[aeiou]/i)).length;
const all = words.filter(([...word]) => {
return word.length == [...new Set([...word])].length;
}).sort((a, b) => countVowels(b) - countVowels(a));
console.log("most vowels: ",
all[0]
const axios = require('axios');
const api = axios.create({
baseURL: 'https://api.themoviedb.org/3/',
params: {
api_key: `${process.argv.slice(2)[0]}`,
}
});
const main = async () => {