Skip to content

Instantly share code, notes, and snippets.

View ASISBusiness's full-sized avatar
💭
I may be slow to respond.

ASISBusines's ASISBusiness

💭
I may be slow to respond.
View GitHub Profile

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.)

@pushmatrix
pushmatrix / sample.erb
Created October 30, 2012 01:37
Dashing Dashboard sample
<% content_for(:title) { "My super sweet dashboard" } %>
<div class="gridster">
<ul>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="karma" data-view="Number" data-title="Karma" style="background-color:#96bf48;"></div>
</li>
<li data-row="1" data-col="1" data-sizex="1" data-sizey="1">
<div data-id="valuation" data-view="Number" data-title="Current Valuation" data-prefix="$"></div>
</li>
@davehull
davehull / Resolve-KnownFolderGUID
Last active October 27, 2024 04:02
Need to resolve a Windows "known folder guid" to it's human-readable value?
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=0)]
[String]$GUID
)
function Resolve-KnownFolderGuid {
Param(
[Parameter(Mandatory=$True,Position=0)]
[String]$GUID
# See official docs at https://dash.plotly.com
# pip install dash pandas
from dash import Dash, dcc, html, Input, Output
import plotly.express as px
import pandas as pd
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv')
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@HarryR
HarryR / MiMCp.sol
Last active August 15, 2024 06:37
MiMC-p/p for Solidity
// Copyright (c) 2018 HarryR
// License: LGPL-3.0+
pragma solidity ^0.5.0;
/**
* Implements MiMC-p/p over the altBN scalar field used by zkSNARKs
*
* See: https://eprint.iacr.org/2016/492.pdf
*
@HaoyangLiu
HaoyangLiu / ABCToken.sol
Last active November 9, 2022 16:27
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.4+commit.1dca32f3.js&optimize=true&gist=
pragma solidity 0.6.4;
import "./Context.sol";
import "./IERC20.sol";
import "./SafeMath.sol";
import "./Ownable.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
@hzoo
hzoo / npm_error.md
Last active December 14, 2024 22:20
`No matching version found for` babel

You might of seen something like:

npm ERR! code ETARGET
npm ERR! notarget No matching version found for @babel/types@^7.9.6.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
> [VulnerabilityType Other]
>> Default Credentials
---------------------------------------------------------------
> [Affected Component]
>> Login page
---------------------------------------------------------------
> [Attack Type]
>> Remote
---------------------------------------------------------------
> [Impact Escalation of Privileges]
php-8.3.3.tar.bz2
SHA256 hash: aafb613ba79594a23fe722f8e90ad473300610bf80e74b8aa52da9cac2dc4e2a
PGP signature:
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEESx/A2d+SMhztn2FdvsVV4ioUNVMFAmXLjjAACgkQvsVV4ioU
NVPQQBAApLCR+GNYNKXfCo6nmEkteXBNNA/Bl/oJq2tURtmFOCn/w6Y0ugh/Pi1Z
XrV4zDEP1KBbNMOcpTA8kpJvjsHXs40donnBTwlRJzvhClaMDs0u2llBVynfp9VZ
VLHJjplMQVaONlMaT15cvBnCD+yu1dxWU+oPLr5DLLW0OSqYy3s80fX45RXbKphn
imIv52ZXT/dKWqvloBNY2z08c6eMQWgwjWV/e5ruf9xooVBCjvYh+wJnfelKLNq2