Skip to content

Instantly share code, notes, and snippets.

View numkem's full-sized avatar

Sébastien Bariteau numkem

View GitHub Profile
@numkem
numkem / screenshot-ocr.nix
Last active May 31, 2023 14:33
NixOS module to run an OCR on a region of your screen
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.screenshot-ocr;
mkOcr = lang:
pkgs.writeScriptBin "ocr-${lang}" ''
#!/bin/sh
set -euo pipefail
@numkem
numkem / ugrep.nix
Created July 15, 2020 16:53
Nix package for ugrep
{ lib, fetchFromGitHub, stdenv, pcre2, boost, zlib, lzham }:
stdenv.mkDerivation rec {
pname = "ugrep";
version = "2.4.1";
src = fetchFromGitHub {
owner = "Genivia";
repo = pname;
rev = "v${version}";
@numkem
numkem / espanso.nix
Created June 7, 2020 17:31
NixOS module for espanso
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.espanso;
in {
options = {
services.espanso = {
enable = mkOption {
type = types.bool;
@numkem
numkem / foreman_organization.py
Last active August 29, 2015 14:17
This is an ext_pillar for Salt that will go though paths looking for a folder matching the minon's Organization already set in Foreman.
#!/usr/bin/env python2
"""
foreman_organization: This is an ext_pillar for Salt that will go though paths
looking for a folder matching the minon's
Organization already set in Foreman.
By default it will look for a file named 'init.sls' inside the organization's
folder but it will also look for any files in the pillar named 'roles'
by it's role name.
@numkem
numkem / hosts.sls
Last active August 29, 2015 14:17
This sls will look and include a file named by the minion's grain 'host' value from a directory specified. If the file doesn't exists, it will try to create it while leaving it empty.
#!py
import logging
import yaml
import sys
import os
PILLAR_HOST_DIR = "/srv/salt/hosts"
log = logging.getLogger(__name__)