Skip to content

Instantly share code, notes, and snippets.

View benjick's full-sized avatar
🌱
🅱enjick

Max Malm benjick

🌱
🅱enjick
  • Sweden
View GitHub Profile
@benjick
benjick / authelia+npm.md
Last active April 12, 2024 11:55
Nginx proxy manager + Authelia + Sonarr/Radarr/Lidarr/Bazarr (websockets)

When using Nginx proxy manager with Authelia (specifically the location block) the checkboxes under Details are ignored so we need to enable websockets manually where needed.

💡 On Unraid, I've placed the snippets in /mnt/user/appdata/NginxProxyManager/nginx/snippets

Advanced settings

# Authelia https://www.authelia.com/integration/proxies/nginx-proxy-manager/
include /config/nginx/snippets/authelia-location.conf;
@benjick
benjick / README.md
Last active September 24, 2023 18:13
Trakt.tv - remove all items in Watchlist

Trakt watchlist remover

This script will remove everything* in your Trakt watchlist.
(* = tested with movies, shows, seasons, and episodes)

  1. Go to https://trakt.tv/users/me/watchlist (or any other list you want to empty out)
  2. Open the browser console. Easiest way is to right-click somewhere on the page and clicking "inspect" then selecting "console" in the menu.
  3. Paste the code attached in this gist and wait until the scripts says it is complete

The output should look something like this:

function Post({id}) {
const [post, setPost] = useState(null)
const [hasLiked, setHasLiked] = useState(false)
useEffect(() => {
const unsubscribe = db.collection('posts').doc(id).onSnapshot((doc) => {
const data = doc.data();
setPost(data);
setHasLiked(data.likedBy[myUserID] === true)
});
return () => unsubscribe()
import * as pulumi from '@pulumi/pulumi';
import * as awsx from '@pulumi/awsx';
import * as k8s from '@pulumi/kubernetes';
import * as docker from '@pulumi/docker';
// Get kubeconfig from main repository
const env = pulumi.getStack();
const cluster = new pulumi.StackReference(`user/infrastructure/${env}`);
const kubeconfig = cluster.getOutput('kubeconfig');
const baseDomain = cluster.getOutput('baseDomain');
@benjick
benjick / Dockerfile
Last active June 7, 2020 11:09
vue-storefront in Docker and Kubernetes
FROM mhart/alpine-node:12
EXPOSE 3000
ENV VS_ENV prod
WORKDIR /var/www
RUN apk add --no-cache make gcc g++ python links bash
COPY . .
RUN yarn install --no-cache
@benjick
benjick / cleanup-magento.sql
Last active May 14, 2020 09:22 — forked from mrkhoa99/Clean up database Magento 2
Clean up database Magento 2 for local enviroment
# Orders, Invoices, Shipments
DELETE FROM sales_order;
DELETE FROM sales_creditmemo_comment;
DELETE FROM sales_creditmemo_item;
DELETE FROM sales_creditmemo;
DELETE FROM sales_creditmemo_grid;
DELETE FROM sales_invoice_comment;
DELETE FROM sales_invoice_item;
DELETE FROM sales_invoice;
DELETE FROM sales_invoice_grid;
@benjick
benjick / beforeEach.ts
Created June 18, 2019 18:28
Wanted to intercept and force a storeCode in Vue Storefront
import { Route } from 'vue-router'
import store from '@vue-storefront/core/store'
import { isServer } from '@vue-storefront/core/helpers'
import { storeCodeFromRoute, localizedRoute } from '@vue-storefront/core/lib/multistore'
import Vue from 'vue'
export function beforeEach(to: Route, from: Route, next) {
if (isServer) {
const { storeViews } = store.state.config
const storeCode = storeCodeFromRoute(to)
import React from 'react';
import Site from './models/Site';
export const Context = React.createContext();
export function useSite() {
return React.useContext(Context);
}
export function SiteWrapper(props) {
const { send, text } = require('micro')
const post = require('micro-post')
const redirect = require('micro-redirect')
const qs = require('qs');
const mailgun = require('mailgun.js');
const fetch = require('node-fetch');
const cheerio = require('cheerio');
const domain = process.env.MAILGUN_DOMAIN;
const sender = process.env.MAILGUN_SENDER;
@benjick
benjick / router.js
Last active June 20, 2017 11:41
mobx router
import Route from 'route-parser';
import {extendObservable, computed} from 'mobx';
class Router {
constructor(routes, notFound) {
extendObservable(this, {
routes: [],
currentPath: window.location.pathname,
notFound: null,
current: computed(() => this.computeCurrent()),