Skip to content

Instantly share code, notes, and snippets.

View motyar's full-sized avatar
🟢
I may be slow to respond.

Motyar motyar

🟢
I may be slow to respond.
View GitHub Profile
@motyar
motyar / db.php
Created February 2, 2024 09:07
SQLite class PHP
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
class db
{
public $file;
public $res;
public $query;
public $statement;
@motyar
motyar / podsearch.html
Created March 19, 2023 16:31
Podcast search
<html>
<head>
<!-- Add TailwindCSS stylesheet -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css">
</head>
<body class="bg-gray-100 min-h-screen flex flex-col justify-center items-center">
<div class="bg-white p-4 rounded-md shadow-md max-w-lg w-full">
<!-- create a form to get user search input -->
<form id="searchForm">
<label for="searchInput" class="block font-medium text-gray-700 mb-2">Search for a podcast:</label>
import sleekxmpp
import requests
# Replace CHATGPT_API_KEY with your own ChatGPT API key
CHATGPT_API_KEY = 'YOUR_CHATGPT_API_KEY'
class ChatGptBot(sleekxmpp.ClientXMPP):
def __init__(self, jid, password):
sleekxmpp.ClientXMPP.__init__(self, jid, password)
<!DOCTYPE html>
<html>
<head>
<title>SVG Generator</title>
<script>
function generateSVG() {
var text = document.getElementById("inputText").value;
var svg = document.getElementById("svgContainer");
svg.innerHTML = "";
svg.innerHTML = '<svg width="300" height="300" viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg">' +
@motyar
motyar / p5js-mp4-export-1.html
Created March 29, 2022 09:31 — forked from erraticgenerator/p5js-mp4-export-1.html
Video export from p5.js sketch 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://unpkg.com/h264-mp4-encoder/embuild/dist/h264-mp4-encoder.web.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.js"></script>
<style>
html { font-family: sans-serif; font-size: 12px; }

Test

This is just an test, remove.

@motyar
motyar / client.js
Last active March 6, 2022 07:53
Signed url nodejs
var http, crypto, sharedSecret, query, signature;
http = require("http");
crypto = require("crypto");
sharedSecret = "super-secret";
query = "key=value";
signature = crypto.createHmac("sha256", sharedSecret).update(query).digest("hex");
http.get({
@motyar
motyar / main.py
Created March 2, 2022 07:04
Generate images with Python and Bruzu API. Image generation API
import requests
import urllib
data = {'bg':'#ff00ff', 'a.t':'Hello there'}
data['apiKey'] = "YOUR_API_KEY"
apiUrl = 'https://img.bruzu.com/?'+urllib.parse.urlencode(data)
r = requests.get(apiUrl, allow_redirects=True)
@motyar
motyar / index.html
Created September 22, 2021 16:40
Bruzu Button embed demo
<span class="bruzu-btn bruzu-btn-theme-light bruzu-btn-size-l">
<span class="bruzu-btn-i"></span>Design With Bruzu</span>
<script src="https://bruzu.com/button/api.js?time" data-onPublish="show"></script>
<script>
function show(data){
result.src=data;
async function handleRequest(request) {
var inputUrl = request.url.replace("https://meta.motyar.workers.dev/", "")
// return error if the url is not passed
if(!inputUrl){
return new Response(JSON.stringify({"error":"Input URL missing! Pass it like https://meta.motyar.workers.dev/example.com"}), {
headers: {
"content-type": "application/json;charset=UTF-8"
}
})