Skip to content

Instantly share code, notes, and snippets.

View deifos's full-sized avatar

Vlad deifos

  • Montreal
View GitHub Profile
@deifos
deifos / setUpStripeSubscription.js
Created January 30, 2025 12:52 — forked from soulbliss/setUpStripeSubscription.js
Code to setup stripe subscriptions. Code credits to @marc_louvion
// app > api > webhook > stripe > js route.js -->
import { NextResponse } from 'next/server';
import { headers } from 'next/headers';
import Stripe from 'stripe';
import connectMongo from '@/libs/mongoose';
import User from '@models/User';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET;
@deifos
deifos / firewall.sh
Created October 30, 2024 11:39 — forked from andrasbacsai/firewall.sh
Update a Hetzner Firewall rule with your IP address
#!/bin/bash
# Script to update a firewall rule in a Hetzner Firewall with your current IP address.
# Good if you would like to restrict SSH access only for your current IP address (secure).
#################
# WARNING: This script will overwrite all rules in the firewall rules, so make sure you
# added all the required rules.
# I use a separate firewall rule just for SSH access.
#################
@deifos
deifos / coverflow-animation.tsx
Created October 29, 2024 13:28 — forked from devalade/coverflow-animation.tsx
Coverflow animation
import { PropsWithChildren, useEffect, useState } from "react";
import { Container } from "~/components/container";
import { ArrowLeft, ArrowRight } from "lucide-react";
import { range } from "~/utils/range";
const IMAGES = [
{
id: 1,
url: "https://images.pexels.com/photos/1366919/pexels-photo-1366919.jpeg",
},
@deifos
deifos / gist:9d144f822921d9e93e7cee72d4de4eda
Created October 19, 2024 10:25
Service to send events to a Telelelgram bot
import TelegramBot from "node-telegram-bot-api";
//TODO: Add a way to track events in a database right now I'm lazy.
export interface TelegramEventTrackerConfig {
botToken: string;
chatId: string;
}
type PrimitiveType = string | number | boolean;
@deifos
deifos / .py
Last active February 1, 2023 14:53
Take pictures from a folder that has pictures and txt files with the same name holding the ALT text, tweet one picture every 60 minutes and moving the photo and .txt file to another folder
import os
import tweepy
import time
#setting up twitter API authentication
consumer_key = 'xxx'
consumer_secret = 'xxx'
access_token = 'xxx'
access_token_secret = 'xxx'
@deifos
deifos / command line
Last active April 28, 2020 11:09
Invalid Host Header when using ngrok
ngrok http port# -host-header="localhost:port#"