Skip to content

Instantly share code, notes, and snippets.

@3v1n0
3v1n0 / sssd-gdm-smartcard-pam-auth-tester.sh
Last active September 7, 2023 17:53
Some crazy automated tests to get Smartcard authentication with SSSD, simiulating various setups via software via softhsm2 and a test tool to verify usage with GDM
#!/usr/bin/env bash
# Copyright 2023 - Marco Trevisan
# Released under the GPLv3 terms
#
# A simple tool to simulate PAM authentication using GDM smartcard settings.
#
# This can also be used in interactive mode to test GDM login from the UI, by
# setting the environment variable `WAIT`, so that the script will restart the
# gdm service and will allow the user to login it using its name and a provided
# `PIN` (123456 by default).
@3v1n0
3v1n0 / pam_conv_example.c
Created June 15, 2023 15:45
PAM module conv tests
#include <glib.h>
#include <json-glib/json-glib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
/* expected hook */
PAM_EXTERN int
#!/usr/bin/env bash
#
# Use
# eval $(prefix-builder.sh [add|rm|prepend|append] folder)
#
# or Alias such as:
# function eval_cmd() { eval $($*); }
# alias build-prefix="eval_cmd prefix-builder.sh"
# alias add-build-prefix="eval_cmd prefix-builder.sh add"
# alias rm-build-prefix="eval_cmd prefix-builder.sh rm"
@3v1n0
3v1n0 / fattura-elettronica-xml-lint.sh
Last active November 30, 2021 16:33
Linter script for the Italian electronic invoice (Fattura Elettronica)
#!/bin/bash
SCHEMA_URI="https://www.fatturapa.gov.it/export/documenti/fatturapa/v1.2.1/Schema_del_file_xml_FatturaPA_versione_1.2.1.xsd"
IMPORTED_SCHEMAS=(xmldsig-core-schema.xsd)
IMPORTED_SCHEMAS_BASE_URI="https://raw.githubusercontent.com/italia/fatturapa-testsdi/master/core/schemas/"
tmp_dir=$(mktemp -d -t fe-xml-lint-XXXXXXXXXX)
schemas=("$SCHEMA_URI")
@3v1n0
3v1n0 / pynchos.py
Created November 4, 2021 18:05
Pynchos
# Initial commit
@3v1n0
3v1n0 / nextcloud-client-qt-shared.yaml
Last active May 1, 2021 00:43
Snapcraft QT builds examples (shared, static...)
name: nextcloud-client
version: 2.2.4+git
icon: ../nextcloudtheme/theme/colored/Nextcloud-icon.svg
summary: Nextcloud Desktop Client
description: |
The Nextcloud Desktop Client is a tool to synchronize files from Nextcloud
Server with your computer.
grade: stable
confinement: strict
@3v1n0
3v1n0 / pulse-audio-hdmi-switch.sh
Last active February 11, 2021 12:05
Script to automatically switch audio to HDMI using PulseAudio in Linux
#!/bin/bash
USER_NAME=$(who | grep tty$(sudo fgconsole) | cut -f1 -d' ')
USER_ID=$(id -u "$USER_NAME")
HDMI_STATUS=$(</sys/class/drm/card0/*HDMI*/status)
HDMI_CARD="pci-0000_00_03.0"
HDMI_PROFILE="hdmi-stereo-extra1"
INTERNAL_CARD="pci-0000_00_1b.0"
@3v1n0
3v1n0 / python.vapi
Created October 12, 2011 22:55
A simple test to use python code from Vala
[CCode (lower_case_cprefix = "Py_", cheader_filename = "Python.h")]
namespace Python
{
public void Initialize ();
public void Finalize ();
[CCode (lower_case_cprefix = "PyRun_")]
namespace Run
{
public void SimpleString (string @string);
@3v1n0
3v1n0 / fitbit-svg-to-grayscale-magic-png.sh
Last active January 6, 2021 13:05
Simple script to convert SVG icons to fitbit Grayscale Magic compatible PNGs
#!/bin/bash
# Simple script to convert SVG icons to fitbit grayscale magic compatible PNGs
# Usage: convert-svg.sh [icons-path]
#
# Author: Marco Trevisan (Treviño) <mail@3v1n0.net>
# Licensed under GPLv3
PNG_SIZE=${PNG_SIZE:-80}
icons_path=${1:-$(dirname "$0")}
@3v1n0
3v1n0 / vscode-keybindings-alt+hjkl-zation.py
Last active December 9, 2020 09:22
Make VSCode default key-bindings more HJLK friendly using Alt to alternate to them
#/usr/bin/python3
import json
import sys
import os
import re
import copy
input = sys.argv[1]