Skip to content

Instantly share code, notes, and snippets.

View deifos's full-sized avatar

Vlad deifos

  • Montreal
View GitHub Profile
@andrasbacsai
andrasbacsai / firewall.sh
Last active January 27, 2025 14:01
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.
#################
@devalade
devalade / coverflow-animation.tsx
Created October 28, 2024 14:58
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",
},
@soulbliss
soulbliss / setUpStripeSubscription.js
Created June 10, 2024 13:20
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;
// ==UserScript==
// @name Hide Links From Mainstream Media
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hides all links from mainstream media websites on news.ycombinator
// @match https://news.ycombinator.com/*
// @grant none
// ==/UserScript==
(function() {
@keesiemeijer
keesiemeijer / youtube-remove-ads.js
Last active October 19, 2022 20:57
Youtube skip ads and remove overlay ads after 3 seconds
// ==UserScript==
// @name Youtube SkipAd
// @namespace keesiemeijer
// @version 0.1
// @description Automatically skips ads after 5 seconds
// @author keesiemeijer
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
@Rich-Harris
Rich-Harris / service-workers.md
Last active March 4, 2025 14:48
Stuff I wish I'd known sooner about service workers

Stuff I wish I'd known sooner about service workers

I recently had several days of extremely frustrating experiences with service workers. Here are a few things I've since learned which would have made my life much easier but which isn't particularly obvious from most of the blog posts and videos I've seen.

I'll add to this list over time – suggested additions welcome in the comments or via twitter.com/rich_harris.

Use Canary for development instead of Chrome stable

Chrome 51 has some pretty wild behaviour related to console.log in service workers. Canary doesn't, and it has a load of really good service worker related stuff in devtools.

@McKinneyDigital
McKinneyDigital / share-twitter.js
Created June 6, 2012 20:21
Share to Twitter from a link using Javascript
// Opens a pop-up with twitter sharing dialog
var url = "http://google.com";
var text = "Replace this with your text";
window.open('http://twitter.com/share?url='+encodeURIComponent(url)+'&text='+encodeURIComponent(text), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');