Skip to content

Instantly share code, notes, and snippets.

View Lamercho's full-sized avatar

/dev/null Lamercho

View GitHub Profile
@Lamercho
Lamercho / secure_link.php
Created March 17, 2025 20:25 — forked from bftanase/secure_link.php
generate URL for nginx secure_link
@Lamercho
Lamercho / fix-macos-python.md
Created October 30, 2024 07:08 — forked from MuhsinFatih/fix-macos-python.md
How to recover from messed up python installation on mac, and never have to mess with apple's shitty python confusion factory

I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.

What the hell?

Here is what I had messed up, which you also probably did:

  • I had too many different python interpreters
  • Too many different symlinks which I lost track of
  • almost no package I installed with pip worked without a headache
  • any attempt to fix using online resources made it worse.
@Lamercho
Lamercho / renew_ssl_cert.yaml
Created November 25, 2023 11:03 — forked from mdeweerd/renew_ssl_cert.yaml
Homeassistant Blueprint for SSL-Certificate renewal
---
blueprint:
name: Renew Let's Encrypt Certificate
description: Renew Certificate when due date is below given value
domain: automation
input:
cert_expiry_sensor:
name: Certificate Expiry Sensor
description: Sensor from the Certificate Expiry Integration (https://www.home-assistant.io/integrations/cert_expiry)
selector:
@Lamercho
Lamercho / README.md
Created April 8, 2023 00:13 — forked from zoilomora/README.md
How to disable systemd-resolved in Ubuntu

How to disable systemd-resolved in Ubuntu

Stages

  • Disable and stop the systemd-resolved service:

      sudo systemctl disable systemd-resolved.service
      sudo systemctl stop systemd-resolved
    
  • Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

@Lamercho
Lamercho / README.md
Created January 23, 2023 11:59 — forked from jasco/README.md
ARM64 Raspberry Pi 4 Unifi Controller Setup

Background

The instructions for setting up the Unifi Controller on ARM do not cover ARM64. The documentation states that ARM64 is not supported but hints it can be setup manually. The documentation also states that Java 8 is currently required. The following is therefore clearly in unsupported territory but so far seems to work fine. The internet has numerous references and resources but they weren't all easy to find and the ones I read required some modification for my configuration.

Note for the future: double check versions and source documentation if these instructions are dated. Also these instructions are specifically tailored for Ubuntu. See original references for other platforms.

Last update March 25, 2021

Base configuration

  1. check installation logs:
cat /var/log/install.log
  1. find the issue:
...
2022-04-26 22:50:21+03 tsarenkotxt installd[1641]: PackageKit: Extracting file:///var/folders/8x/_h18ksqn64dgswlstgcd_fw40000gn/C/com.apple.appstoreagent/com.apple.appstore/0C4C5EA3-A445-4CF0-9E44-37938052A4D9/kwb3255311556092828694.pkg#Xcode.pkg (destination=/Library/InstallerSandboxes/.PKInstallSandboxManager/7A629BA6-7537-469C-8C19-C74DD52245A1.activeSandbox/Root, uid=0)
2022-04-26 23:03:05+03 tsarenkotxt installd[1641]: PackageKit: Removing client PKInstallDaemonClient pid=3827, uid=501 (/System/Library/PrivateFrameworks/AppStoreDaemon.framework/Support/appstoreagent)
@Lamercho
Lamercho / odbc_on_mac.md
Last active April 14, 2023 17:10 — forked from erikvw/odbc_on_mac.md
mysql, ODBC, STATA 16 on MAC (M1 Silicon)
@Lamercho
Lamercho / ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
Created August 15, 2022 09:47 — forked from Brainiarc7/ffmpeg-livestream-to-streaming-sites-vaapi-nvenc.md
ffmpeg livestreaming to youtube via Nvidia's NVENC and Intel's VAAPI on supported hardware

Streaming your Linux desktop to Youtube and Twitch via Nvidia's NVENC and VAAPI:

Considerations to take when live streaming:

The following best practice observations apply when using a hardware-based encoder for live streaming to any platform:

  1. Set the buffer size (-bufsize:v) equal to the target bitrate (-b:v). You want to ensure that you're encoding in CBR mode.

  2. Set up the encoders as shown:

@Lamercho
Lamercho / ffmpeg-hevc-encode-nvenc.md
Created August 15, 2022 09:46 — forked from jbboehr/ffmpeg-hevc-encode-nvenc.md
This gist shows you how to encode specifically to HEVC with ffmpeg's NVENC on supported hardware, with a two-pass profile and optional CUVID-based hardware-accelerated decoding.

Encoding high-quality HEVC content in a two-pass manner with FFmpeg - based NVENC encoder on supported hardware:

If you've built ffmpeg as instructed here on Linux and the ffmpeg binary is in your path, you can do fast HEVC encodes as shown below, using NVIDIA's NPP's libraries to vastly speed up the process.

Now, to do a simple NVENC encode in 1080p, (that will even work for Maxwell Gen 2 (GM200x) series), start with:

ffmpeg  -i <inputfile> -pass 1 \
-filter:v hwupload_cuda,scale_npp=w=1920:h=1080:format=nv12:interp_algo=lanczos,hwdownload,format=nv12 \

-c:v hevc_nvenc -profile main -preset slow -rc vbr_2pass \

@Lamercho
Lamercho / mount_qcow2.md
Created May 12, 2022 23:11 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8