Skip to content

Instantly share code, notes, and snippets.

@stpr-dev
stpr-dev / makepkg.conf
Created March 17, 2021 19:42 — forked from mratsim/makepkg.conf
Makepkg config for Archlinux
#
# /etc/makepkg.conf
#
#########################################################################
# SOURCE ACQUISITION
#########################################################################
#
#-- The download utilities that makepkg should use to acquire sources
# Format: 'protocol::agent'
@stpr-dev
stpr-dev / systemDAsUser.service
Created August 30, 2020 18:59 — forked from torch2424/systemDAsUser.service
Run a systemd service as a user
# How to create systemd services: http://neilwebber.com/notes/2016/02/10/making-a-simple-systemd-file-for-raspberry-pi-jessie/
# Digital ocean on a mongodb service: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-16-04
[Unit]
Description=Run SystemD as users
After=network.target
[Service]
Type=simple
User=[USER HERE]
WorkingDirectory=[USER HOME]
@stpr-dev
stpr-dev / 50-udisks.rules
Created March 3, 2020 03:33 — forked from Scrumplex/50-udisks.rules
Polkit rules for udisks, and udisks2. Compatible with udiskie and Dolphin.
// Original rules: https://github.com/coldfix/udiskie/wiki/Permissions
// Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin.
polkit.addRule(function(action, subject) {
var YES = polkit.Result.YES;
// NOTE: there must be a comma at the end of each line except for the last:
var permission = {
// required for udisks1:
"org.freedesktop.udisks.filesystem-mount": YES,
"org.freedesktop.udisks.luks-unlock": YES,
@stpr-dev
stpr-dev / Arch Linux btrfs install.md
Created February 27, 2020 02:28 — forked from mikroskeem/Arch Linux btrfs install.md
Arch Linux installation on btrfs subvolumes

Arch Linux btrfs install

0. Prerequisites

  • Plenty of storage - snapshots will take (sort of) a lot of space
  • Latest Arch Linux install iso because those have newer kernels and more bugfixes in btrfs.
  • Have previous experience with installing Arch (like you can install arch with a blind fold).
  • Read everything through

1. Parititions

Pick a partition scheme fitting your needs, GPT for UEFI and MBR for BIOS based systems.

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

@stpr-dev
stpr-dev / gist:10a5ef26c75dbf9eca161ca4d0d594b3
Created January 19, 2019 04:52 — forked from radupotop/gist:4013294
PolKit rules to allow mounting, rebooting and network management without a password
// /etc/polkit-1/rules.d/10-rules.rules
// PolKit rules to allow mounting, rebooting and network management without a password.
// User needs to be in storage, power and network groups.
polkit.addRule(function(action, subject) {
if (action.id.match("org.freedesktop.udisks2.") && subject.isInGroup("storage")) {
return polkit.Result.YES;
}
});
@stpr-dev
stpr-dev / GitHub-API.md
Created August 8, 2018 01:54 — forked from nicolas-g/GitHub-API.md
Clone all repos from a GitHub organization

https://developer.github.com/v3/oauth/#create-a-new-authorization

I'm using Github API to ge the list of public repos , just change type=private or all . The results are paginated ,by 30 by default, you can specify further pages with the ?page parameter : curl -u "$USER:$PASSWORD" -H 'X-GitHub-OTP: $TWOFACTORCODE' https://api.github.com/orgs/magnetic/repos\?type\=public\&page\=1 | jq '.[] | .full_name '

Clone all curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'

@stpr-dev
stpr-dev / ARCH_INSTALL.MD
Created August 2, 2018 18:04 — forked from heppu/ARCH_INSTALL.MD
Installing Arch with GPT, dm-crypt, LUKS, LVM and systemd-boot

Create bootable USB

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync

Boot from USB and set prepare system

loadkeys <your-keymap>