Skip to content

Instantly share code, notes, and snippets.

These are only examples, for a few very common actions. You are expected to write your own rules for the rest. The syntax is regular JavaScript, but see the polkit(8) manpage for the object structure and available API. These examples are for polkit versions 106 and later, with the JS interpreter. They won't work with Debian's polkit v105.

  • If you don't know the action name, run pkaction:

    pkaction | grep cups
    
  • The possible results are YES, AUTH_SELF(_KEEP), AUTH_ADMIN(_KEEP), NO. Returning a result is final. Returning null will continue checking other rules.

  • Put your rules in /etc/polkit-1/rules.d/*.rules. (You can check everything in one giant addRule, or you can have a separate file and separate addRule for each program; it doesn't matter.)

Home/Core TX9XD-98N7V-6WMQ6-BX7FG-H8Q99
Home/Core (Country Specific) PVMJN-6DFY6-9CCP6-7BKTT-D3WVR
Home/Core (Single Language) 7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH
Home/Core N 3KHY7-WNT83-DGQKR-F7HPR-844BM
Professional W269N-WFGWX-YVC9B-4J6C9-T83GX
Professional N MH37W-N47XK-V7XM9-C7227-GCQG9
Professional Enterprise
Professional Workstation
Enterprise NPPR9-FWDCX-D2C8J-H872K-2YT43
Enterprise N DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4
@reinvanoyen
reinvanoyen / terminal-prompt-git-branch-zsh.md
Last active April 26, 2024 03:05
Add Git Branch Name to Terminal Prompt (MacOS zsh)

Add Git Branch Name to Terminal Prompt (zsh)

Updated for MacOS with zsh

  • Catalina
  • Big Sur
  • Monterey
  • Ventura
  • Sonoma

screenshot

import * as Http from "@effect/platform/HttpClient"
import { Schema } from "@effect/schema"
import { Array, Config, Context, Data, Effect, Layer, flow } from "effect"
import { Inngest as Inngest_ } from "inngest"
class InngestRun extends Schema.Class<InngestRun>("InngestRun")({
run_id: Schema.String,
status: Schema.Literal("Running", "Completed", "Failed", "Cancelled"),
}) {
static decodeArray = Http.response.schemaBodyJsonScoped(
@ericreeves
ericreeves / active_border.ahk
Last active April 26, 2024 02:58
AHK Script for Active Window Border in Windows 11 22H2
;
; Inspiration / Code Jacked from the following resources:
; https://www.reddit.com/r/windowsporn/comments/x6299x/a_small_effect_on_window_switching/
; https://superuser.com/questions/1190658/fine-tune-this-red-border-around-active-window-ahk-script/1191059#1191059?newreg=d3acdcdab8714e76a5efeca9996e792f
; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=110505
; https://discord.com/channels/898554690126630914/898556726108901386/1053662963585781760 # Komorebi Discord
;
#NoEnv
#SingleInstance, Force
@fuji246
fuji246 / tcp_cubic_memo.md
Last active April 26, 2024 02:54
TCP cubic memo

Paper

use a cubic function to replace the linear window growth to improve performance in high BDP network, also achieved RTT fairness.

tcp-cubic is succssor of tcp-bic, tcp-bic use binary search to find the avialble bandwidth when congestion happens, and MAY enter an lieaner increasing state (Additive Increase)if it dropped too low, if it passed the maximum window, it goes into max probing state and will do the reverse and grow slowly initially and switch to additive increase if it can't find new maximum window nearby.

@thecodingcod
thecodingcod / dbeaver_sqlcipher.md
Last active April 26, 2024 02:53
Setting up Dbeaver (The Universal DBMS) to work with SqlCipher Databases

Setting up Dbeaver (The Universal DBMS) to work with SqlCipher Databases

I’ve tried multiple solutions to browse SqlCipher Databases and the only one that seemed to work properly was [DB Sqlite Browser](DB Browser for SQLite (sqlitebrowser.org)) with easy GUI to get into the db. but … the overall experience of that application didn’t really satisfy me!

I knew DBeaver from long time ago, and i wondered if i can use it with SQLCipher, but it was surprisingly a shock that it doesn’t work directly, but with a couple of hours of researching and trying different methods i finally came up with a way to configure it Out-of-the box to make it work!

The reason I wrote this gist was to help others who have the same issue as it seems there is no guide to show how to do so!

@Haythamasalama
Haythamasalama / laravel-spa-authentication.md
Last active April 26, 2024 02:46
Setting Up Authentication for Laravel Single Page Applications (SPA)

Setting Up Authentication for Laravel Single Page Applications (SPA)

Suppose you have two websites that require authentication:

  1. localhost:8000 (backend)
  2. localhost:3000 (frontend)

Configuration Steps:

  1. Allow origins for https://localhost:3000/
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active April 26, 2024 02:45
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example