Skip to content

Instantly share code, notes, and snippets.

@mattiasghodsian
mattiasghodsian / readme.md
Last active May 7, 2024 08:13
How to create a Windows application Installer with NSIS

Nullsoft Scriptable Install System is also known as NSIS open-source system to create Windows application installers. NSIS is a script-based system allowing you to create the logic behind your installer/setup file in a complex way to install tasks. NSIS offers plug-ins and other scripts, for example, to download/install 3rd-party files or communicate with Windows.

The tutorial application

This tutorial will guide you through installing and creating your first Windows installer with Nullsoft Scriptable Install System and how to compile your project. Captura Portable will be used as "our application" for the sake of this tutorial.

Installation

Head to NSIS official site and download the latest release and install it. Run NSIS and you will be welcomed with a menu like below, It's always a good practice to read the Documentation before jumping in t

@KaneCheshire
KaneCheshire / AnyTask.swift
Last active May 7, 2024 08:13
Type-erased Swift Task that cancels itself on deinit
/// A type-erased task that you can store in a collection
/// to allow you to cancel at a later date.
///
/// Upon deinit of the task, the task will be cancelled
/// automatically. Similar to Combine's AnyCancellable.
final class AnyTask {
/// Call this cancellation block to cancel the task manually.
let cancel: () -> Void
/// Checks whether the task is cancelled.
@berkorbay
berkorbay / github_desktop_ubuntu.md
Last active May 7, 2024 08:11
To install Github Desktop for Ubuntu

IMPORTANT

See the following links for further updates to Github Desktop for Ubuntu. These are official instructions. (also mentioned by fetwar on Nov 3, 2023)

For the sake of "maintaining the tradition" here is the updated version.

@borcean
borcean / t480-fedora-fingerprint.md
Last active May 7, 2024 08:11
ThinkPad T480 fingerprint reader on Fedora Linux

ThinkPad T480 fingerprint reader on Fedora Linux

Background

The Synaptics fingerprint sensor (06cb:009a) present on my T480 is not supported by libfprint and fprintd as it requires a non-free binary blob. uunicorn created open-fprintd, a replacement for fprintd, that allows for loading of binary blobs. In conjunction with their python-validity driver we are able to make use of the inbuilt fingerprint reader. The following instructions were tested against Fedora Linux 35.

Installing open-fprintd and python-validity

sudo dnf copr enable tigro/python-validity
sudo dnf install open-fprintd fprintd-clients fprintd-clients-pam python3-validity
@enginefeeder101
enginefeeder101 / auth_provider.py
Last active May 7, 2024 08:10 — forked from sidoh/auth_provider.py
Custom HomeAssistant auth provider
import logging
import jwt
from urllib.parse import urlparse
import urllib.request
from collections import OrderedDict
from typing import Any, Dict, Optional, cast
import voluptuous as vol
@R0GGER
R0GGER / _hsts.conf
Last active May 7, 2024 08:09
Workaround - Security Headers @ NGINX Proxy Manager
{% if certificate and certificate_id > 0 -%}
{% if ssl_forced == 1 or ssl_forced == true %}
{% if hsts_enabled == 1 or hsts_enabled == true %}
# HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
add_header Strict-Transport-Security "max-age=63072000;{% if hsts_subdomains == 1 or hsts_subdomains == true -%} includeSubDomains;{% endif %} preload" always;
add_header Referrer-Policy strict-origin-when-cross-origin;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options SAMEORIGIN;
add_header Content-Security-Policy upgrade-insecure-requests;
@Tapanhaz
Tapanhaz / abcd.py
Last active May 7, 2024 08:08
Custom logging formatter with colored console outputs and logging to file.
import logging
logger = logging.getLogger(__name__)
def func1():
logger.warning("This is a warning message")
logger.info("This is a info message")
@spali
spali / 10-wancarp
Last active May 7, 2024 08:07
Disable WAN Interface on CARP Backup
#!/usr/local/bin/php
<?php
require_once("config.inc");
require_once("interfaces.inc");
require_once("util.inc");
$subsystem = !empty($argv[1]) ? $argv[1] : '';
$type = !empty($argv[2]) ? $argv[2] : '';
@kmobs
kmobs / DampingRatio.md
Last active May 7, 2024 08:07
Calculating the damping ratio for your hardware:

Prerequisite - Outdated. I don't use the resonance testing branch or pulses method anymore.

I recommend running Dmitry’s latest resonance testing branch and using the pulses method outlined below:

https://github.com/Klipper3d/klipper/issues/4560
https://github.com/dmbutyugin/klipper/tree/resonance-test-methods

I would only go down this path if you're getting ghosting with really high speed prints. On the Annex Engineering K3 for example, no matter how perfect the graphs looked, I was still getting some ghosting. That prompted me to go down this path. I'm now able to print at 20-30k acceleration, 250-350mm/s, and 15scv with perfect quality that can usually only be seen at significantly slower speeds.

The default settings in Klipper have the damping ratio set to .1. This should be fine for most people with sane settings. I like to go for the insane.

@Jonalogy
Jonalogy / handling_multiple_github_accounts.md
Last active May 7, 2024 08:06
Handling Multiple Github Accounts on MacOS

Handling Multiple Github Accounts on MacOS

The only way I've succeeded so far is to employ SSH.

Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config file in a .ssh directory. The config file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh directory by default. You can navigate to it by running cd ~/.ssh within your terminal, open the config file with any editor, and it should look something like this:

Host *
 AddKeysToAgent yes

> UseKeyChain yes