Skip to content

Instantly share code, notes, and snippets.

View Lissy93's full-sized avatar
:bowtie:
Stuck in an infinite loop

Alicia Sykes Lissy93

:bowtie:
Stuck in an infinite loop
View GitHub Profile
/**
* A quick and simple JS WHOIS lookup to return JSON
* Docs and usage instructions are below...
**/
import * as whois from 'whois';
import * as changeCase from 'change-case';
import { decodeEntity } from 'html-entities';
const DELIMITER = ':';
@Lissy93
Lissy93 / open-ai-assistant.js
Last active February 29, 2024 10:26
A REST API for fetching the repsponse from a custom GPT assistant via the OpenAI API. Runs as a Cloudflare Worker.
/**
* A REST API for fetching the repsponse from
* a custom GPT assistant via the OpenAI API
* Deployed as a simple Cloudflare Worker
* Licensed under MIT (C) Alicia Sykes 2024
*/
(() => {
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
@Lissy93
Lissy93 / github-discussion-comments.js
Created February 27, 2024 01:53
A simple REST API, to fetch all comments on a given GitHub discussion thread. Built as a Cloudflare Worker.
/**
* Fetch all comments on a given GitHub discussion
* A simple REST API, built for Cloudflare Workers
* Code licensed under MIT, (C) Alicia Sykes 2024
*/
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
@Lissy93
Lissy93 / github-sponsors-api.js
Created February 27, 2024 01:17
A quick and easy Cloudflare Worker, for fetching all the GitHub Sponsors of a given user
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
const { pathname } = new URL(request.url);
const username = pathname.split('/')[1];
if (!username) {
return new Response(
@Lissy93
Lissy93 / repo-info-cf-worker.js
Created February 27, 2024 00:19
A quick 'n dirty Cloudflare Worker, for fetching pertinent about a given GitHub repository
export default {
async fetch(request, env) {
// Extract username and repo from the URL path
const url = new URL(request.url);
const pathSegments = url.pathname.split('/').filter(Boolean);
if (pathSegments.length !== 2) {
return new Response('URL must be in the format /{username}/{repo}', { status: 400 });
}
const [username, repo] = pathSegments;
@Lissy93
Lissy93 / uk-food-images.js
Last active February 27, 2024 00:44
API for UK food product photos (via Cloudflare Workers)
/**
* Cloudflare Worker script for displaying UK food products
* Fetches given item from Tesco.com using search endpoint
* Optionally resizes to specified dimensions
* Implements caches recently requested images
* Swaers a little bit when an error happens
*/
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request, event))
@Lissy93
Lissy93 / cloud-backup-restore-worker.js
Last active February 27, 2024 00:46
CloudFlare Worker for Dashy Backup and Restore
/* Access control headers */
const headers = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, PUT, POST, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type',
'content-type': 'application/json;charset=UTF-8',
}
/* Listen for incoming requests, and call handler */
addEventListener('fetch', event => {
@Lissy93
Lissy93 / Example 1 - Getting Started - conf.yml
Last active October 10, 2024 22:17
Example Config Files for Dashy
---
# Page meta info, like heading, footer text and nav links
pageInfo:
title: Dashy
description: Welcome to your new dashboard!
navLinks:
- title: GitHub
path: https://github.com/Lissy93/dashy
- title: Documentation
path: https://dashy.to/docs
@Lissy93
Lissy93 / Credit-card-validator.py
Last active October 27, 2022 17:15
Simple Python script that can validate wheather a given credit/ debit card number is of a valid format
'''
Date : 22 Oct 2012
@author : Alicia Sykes
'''
#Remove Bad Characters
def validate(cardNumber):
validCardNumber = ""
for number in cardNumber:
if (ord(number)>=48 and ord(number)<=57): validCardNumber += str(number)
@Lissy93
Lissy93 / emoji-list.md
Last active November 28, 2022 11:32 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
  • 😄 :smile:
  • 😆 :laughing:
  • 😊 :blush:
  • 😃 :smiley:
  • 😀 :grinning:
  • 😏 :smirk:
  • 😍 :heart_eyes:
  • 😘 :kissing_heart:
  • 😚 :kissing_closed_eyes:
  • 😳 :flushed: