Skip to content

Instantly share code, notes, and snippets.

View teyfix's full-sized avatar

Halil Teyfik teyfix

  • Istanbul, Turkey
View GitHub Profile
@teyfix
teyfix / README.md
Last active June 20, 2024 06:44
Copy latest backup preserving folder structure over SSH with rsync
@teyfix
teyfix / Blueprint.ts
Created April 8, 2024 19:47
Blueprint for exposing every possible path of an TypeScript interface
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/ban-types */
import { Document } from 'mongoose';
/**
* Forbidden keys from mongoose Document type except _id.
*/
type _Forbidden = Exclude<keyof Document, '_id'>;
/**
@teyfix
teyfix / jitsi-meet.config.js
Created February 1, 2024 09:42
Jitsi Meet Branding Configuration
const branding = {
// The domain url to apply (will replace the domain in the sharing conference link/embed section)
"inviteDomain": "example-company.org",
// The hex value for the colour used as background
"backgroundColor": "#fff",
// The url for the image used as background
"backgroundImageUrl": "https://example.com/background-img.png",
// The anchor url used when clicking the logo image
"logoClickUrl": "https://example-company.org",
// The url used for the image used as logo
@teyfix
teyfix / tokens.md
Last active January 12, 2024 01:27
JSON Web Token (JWT) authentication Prosody plugin

Original File

JSON Web Token (JWT) authentication Prosody plugin

This plugin implements a Prosody authentication provider that verifies a client connection based on a JWT described in [RFC7519]. It allows use of an external form of authentication with lib-jitsi-meet. Once your user authenticates you need to generate the JWT as described in the RFC and pass it to your client app. Once it connects with a valid token, it is considered authenticated by the jitsi-meet system.

During configuration, you can choose between two JWT validation methods:

@teyfix
teyfix / ticTacToeWinner.ts
Created July 2, 2023 14:52
Check the winner of a Tic Tac Toe game
export class InvalidBoardError extends Error {}
export default function ticTacToeWinner<T extends number | string>(
board: T[][],
): T | "Tie" {
// Check if the board is a valid game board
for (let i = 0; i < board.length; i++) {
if (board.length !== board[i].length) {
throw new InvalidBoardError();
}
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDTqbtbKy4wMumNni0IYvKT2RN2j1i8dGMZMae0RODE0/9MC4gFlylk7PERMgWIfRXZqIiBoJngw6/WPHjRGJ82jth0J1s0u6crNRONmUb+CLxwEBef6qkBpeMvpCrW85nRs72fQUpiLEbtXUNa4OWQTMsxbTR1G8aPhufXSygJtUZ2T08FgGhCd9MNHww06v19J6LSrZqmQ1/FJtd7bEwRCC+BRVPswkXnmlWKhLJxh7asCImA8cW6iQrhMZBVmB/F2esaQQR5MD246EB41clqJLM64WDKmY5ynnJDGkwj4zTcWeC1XclMMyXPT98tZKWun34iNtHJF2fLE05eVRntdN/MMAPvDKoYtcfe2380oTWGbKeBJQqwuKArRCIOMb6TroX0lLJEyfhiLGpFbfODJPGe6RlDgcp0qKTWSkWMyJnfYqU288tHDRzvnSiDRD/WRpZGuWxwyKg8bskKAHyz/OQNX6HXgszfSVhNMsUxgDOuf4BJADfehM/xalse0Yc= pensive@DESKTOP-NT67T2B
@teyfix
teyfix / bh_ranked.js
Created September 29, 2022 05:59
User Scripts/Brawlhalla - Calculates the winrate of the users in ranked list on https://www.brawlhalla.com/rankings
setTimeout(() => {
const domain = 'https://www.brawlhalla.com/rankings';
if (!window.location.href.startsWith(domain)) {
return;
}
const input = document.querySelector("input[name=p]");
if (input) {
@teyfix
teyfix / steam.js
Created September 29, 2022 05:57
User Scripts/Steam History - Calculates the payment history at https://store.steampowered.com/account/history
(() => {
const pattern = new RegExp("https://store.steampowered.com/account/history");
if (!pattern.test(window.location.href)) {
return;
}
let last;
const content = (item) =>
(item.querySelector("div") ?? item).innerText.replace(/\s+/g, " ").trim();
@teyfix
teyfix / api.js
Created June 23, 2021 06:10
react - json placeholder api helper
const api = async (endpoint) => {
const url = new URL(
endpoint,
'https://jsonplaceholder.typicode.com',
).toString();
const response = await fetch(url);
if (response.status === 200) {
return response.json();
}
@teyfix
teyfix / props.jsx
Created June 23, 2021 05:32
react - using props
const HelloWorld = () => {
const [show, setShow] = useState(false);
return (
<section>
<h1>Merhaba dünya!</h1>
<GoodMorning show={show} />
<button onClick={() => setShow(!show)}>Merhaba!</button>
</section>
);