Skip to content

Instantly share code, notes, and snippets.

View arvidkahl's full-sized avatar
🏠
Working from home

Arvid Kahl arvidkahl

🏠
Working from home
View GitHub Profile
@arvidkahl
arvidkahl / CardStack.vue
Created February 3, 2024 14:24
Podscan's Card Stack
<template>
<div class="bg-white">
<div
@mouseenter="paused = true"
@mouseleave="paused = false"
@mouseover="paused = true"
@click="continueRotation()"
class="cardstack mt-24 xs:mt-28 sm:mt-24 mb-24 m-auto max-w-screen-sm grid grid-cols-1 grid-rows-1 select-none">
<article v-for="card in cards"
@arvidkahl
arvidkahl / cuda_11.7_installation_on_Ubuntu_22.04
Created January 27, 2024 18:23 — forked from primus852/cuda_11.7_installation_on_Ubuntu_22.04
Instructions for CUDA v11.7 and cuDNN 8.5 installation on Ubuntu 22.04 for PyTorch 1.12.1
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@arvidkahl
arvidkahl / square.sh
Created January 9, 2023 20:20
Convert non-square videos into squares
#!/bin/bash
# Loop through all MP4 files in the current directory
for file in *.mp4
do
# Extract the file name without the .mp4 extension
filename=$(basename "$file" .mp4)
# Run the ffmpeg command for the current file
ffmpeg -i "$file" -filter_complex "scale=960:960:force_original_aspect_ratio=increase,crop=960:960" "${filename}_square.mp4"
@arvidkahl
arvidkahl / socials.css
Created June 22, 2022 16:44
ConvertKit Signup Form Social Icons integration
a[href^="https://socialscri.be/to/"] {
font-family: "Inter", Arial, Verdana, sans-serif;
text-rendering: geometricPrecision;
font-weight: bold;
background-color: white !important;
color: black !important;
font-size: 14px !important;
}
a[href="https://socialscri.be/to/the-bootstrapped-founder/with/twitter"] {
@arvidkahl
arvidkahl / index.php
Created May 31, 2022 16:48
Image Grid List
<doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-black">
@arvidkahl
arvidkahl / README.md
Last active July 3, 2021 11:46
Twitter Giveaway bash+js script

This is a script picking winners for a contest where:

  • every winning entry has to mention one other twitter account in a reply
  • double winners are allowed

You'll need a few things installed:

  • jq
  • twarc
  • boxes
@arvidkahl
arvidkahl / puppeteer_demo.js
Created March 26, 2021 16:08
How to grab a high-res Tweet using Puppeteer
// using https://try-puppeteer.appspot.com/
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({width: 1500, height: 3000, deviceScaleFactor: 4});
await page.goto('https://twitter.com/arvidkahl/status/1375476092853743621?s=20');
await page.waitForNavigation({ waitUntil: 'networkidle2' })
console.log(await page.content());
await page.screenshot({path: 'screenshot.png'});
@arvidkahl
arvidkahl / titleize_APA.js
Created August 23, 2020 16:08
Zero to Published: Automator Workflow to correctly titleize with APA rules ("this is a good title" -> "This Is a Good Title")
const stopwords = 'a an and at but by for in nor of on or so the to up yet'
const defaults = stopwords.split(' ')
function titleCase1(str, options) {
const opts = options || {}
if (!str) return ''
const stop = opts.stopwords || defaults
const keep = opts.keepSpaces
@arvidkahl
arvidkahl / amazon-wishlist-summation.js
Last active February 22, 2019 19:17
Sum up the prices in an Amazon Wish List Print View
// Make sure to pass the correct currency symbol, three-letter-name and your locale
(function(currency='$', currencyName='USD', locale='en-US'){return (Math.ceil(100*Array.prototype.slice.call(document.getElementsByTagName('span')).reduce((acc,item,index,src)=>{if(item.innerText.indexOf(currency)>-1){return acc+parseFloat(item.innerText.replace(/,/g,'.').replace(RegExp(currency, "g"),''))}else{return acc}}, 0.0))/100).toLocaleString(locale,{style: 'currency',currency: currencyName,});})("€", "EUR", "de-DE")
@arvidkahl
arvidkahl / jtw-md.js
Created February 18, 2017 09:26
jtw-maxdepth
Vue.component("tree-view-item", Vue.extend({
name: "tree-view-item",
props: ["data", "max-depth", "current-depth"],
data: function(){
return {
open: this.currentDepth < this.maxDepth
}
},
methods: {
isOpen: function(){