Skip to content

Instantly share code, notes, and snippets.

View iffa's full-sized avatar
☀️
Sun is shining and so are you

Santeri Elo iffa

☀️
Sun is shining and so are you
View GitHub Profile
@aleksasiriski
aleksasiriski / proxmoxlxcjellyfin.md
Last active October 15, 2024 19:02
Proxmox LXC Alpine Docker Jellyfin

How to setup VA-API within Proxmox LXC Unprivileged container

Proxmox configuration

No drivers need to be installed on the proxmox, from now called host.

Find GIDs of video and render group on host:

cat /etc/group | grep video

cat /etc/group | grep render

@iffa
iffa / better-scroll-restoration-logic-angular.ts
Last active May 16, 2024 20:48
Custom scroll position restoration logic for Angular 2+, that doesn't consider query parameter changes in route as forward navigation, thus preventing certain scenarios where you don't want query parameter changes to scroll-to-top as they would with 'scrollPositionRestoration: enabled'.
export class AppModule {
constructor(private router: Router, private viewportScroller: ViewportScroller) {
// Disable automatic scroll restoration to avoid race conditions
this.viewportScroller.setHistoryScrollRestoration('manual');
this.handleScrollOnNavigation();
}
/**
* When route is changed, Angular interprets a simple query params change as "forward navigation" too.
@iffa
iffa / NewTabRouterLinkDirective.ts
Last active July 11, 2019 11:55
Modified RouterLinkWithHref directive for Angular, that triggers normally for new tab/window but emits an event for normal left click. For cases where you need custom logic only when staying on the current open tab. Tested with Angular 6+
import { ActivatedRoute, NavigationEnd, Router, RouterEvent, RouterLinkWithHref, UrlTree } from '@angular/router';
import {
Directive,
EventEmitter,
HostBinding,
HostListener,
Input,
isDevMode,
OnChanges,
OnDestroy,
// based on Алексей Сердюков's answer at Stackoverflow (https://stackoverflow.com/a/50837219/1143392)
import {
Directive,
Input,
OnDestroy,
OnInit
} from '@angular/core';
import { MediaObserver } from '@angular/flex-layout';
import { MatGridList } from '@angular/material';
@tavinus
tavinus / rem_proxmox_popup.sh
Last active February 27, 2024 22:47
Remove PROXMOX 5.x / 6.x / 7.3-4 subscription message popup
#!/bin/sh
#######################################################
#
# Edits the proxmox Subscription file to make it
# think that it has a Subscription.
#
# Will disable the annoying login message about
# missing subscription.
#
@Uninen
Uninen / packages.md
Created April 25, 2018 13:19
Python Packages

Python Packages

Here's a curated list of interesting and useful Python packages. You can install any package with pip by saying pip install <package-name>. All of the packages on the list are open source.

This list has been collected spesifically for Anders Python Workshop evening. For more comprehensive list of interesting Python packages, take a look at https://github.com/vinta/awesome-python and for all 130k+ packages, search PyPI at https://pypi.org/

Development Tools

  • faker - A package for generating fake data (for example testing purposes)
@xameeramir
xameeramir / default nginx configuration file
Last active November 17, 2024 15:13
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@thomasdarimont
thomasdarimont / App.java
Last active October 27, 2023 07:44
Secure REST API Example with Spring Security, Spring Session, Spring Boot
package demo;
import java.io.Serializable;
import java.security.Principal;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@antic183
antic183 / remove-utf8-bom.js
Last active March 13, 2024 08:45
remove utf-8 bom with javascript
// remove utf-8 BOM from ressource "res"
// res.charCodeAt(0) === 0xFEFF | res.charCodeAt(0) === 65279
if (res.charCodeAt(0) === 0xFEFF) {
res = res.substr(1);
}