Skip to content

Instantly share code, notes, and snippets.

View jessarcher's full-sized avatar

Jess Archer jessarcher

View GitHub Profile
@jessarcher
jessarcher / ThankYouCommand.php
Created August 8, 2023 22:56
The `artisan thankyou` command from my Laracon US 2023 talk.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class ThankYouCommand extends Command
{
/**
* The name and signature of the console command.
@jessarcher
jessarcher / ValidationServiceProvider.php
Created March 8, 2021 08:11
Laravel prohibited_if validation rule
<?php
namespace App\Providers;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
class ValidationServiceProvider extends ServiceProvider
@jessarcher
jessarcher / NavLink.vue
Created August 6, 2020 23:26
Hacky solution to set router-link class when not active
@jessarcher
jessarcher / main.js
Last active February 9, 2020 23:41
Storybook config to replace the loader for SVG files
module.exports = {
webpackFinal: async config => {
// Remove 'svg' from the existing regex covering all images
const svgRule = config.module.rules.find(rule => typeof rule.test.test === 'function' && rule.test.test('.svg'));
svgRule.test = new RegExp(svgRule.test.source.replace('svg|', ''))
// Add a new rule for svg files only
config.module.rules.push({
test: /\.svg$/,
use: [
@jessarcher
jessarcher / dslr-webcam.md
Last active March 10, 2024 17:25
Using my Canon 70D DSLR camera as a web cam on Linux

You'll need:

  1. Video 4 Linux loopback device kernel module (v4l2loopback) - Source: https://github.com/umlaeute/v4l2loopback (You might find builds in your distro's repos - I'm using Fedora so had to build it myself using https://github.com/danielkza/v4l2loopback-fedora/)
  2. gPhoto2 - this is what allows you to access your cameras live feed over USB - this was available in Fedora's repos.
  3. GStreamer or ffmpeg - this is what lets you stream the output from gPhoto2 into the loopback device.

It's been a little while since I set it all up so I can't remember all of the installation details, which will probably be different for your distro anyway unless you're using Fedora. Apologies if I have forgotten something as wel.

Running the stream