Skip to content

Instantly share code, notes, and snippets.

View pschyska's full-sized avatar
🤔
Aber das geht doch besser‽

Paul Schyska pschyska

🤔
Aber das geht doch besser‽
View GitHub Profile
==120669== Memcheck, a memory error detector
==120669== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==120669== Using Valgrind-3.20.0 and LibVEX; rerun with -h for copyright info
==120669== Command: /nix/store/49xfkzxyq84x18pl4jwy9ariciyfak01-systemd-252.1/lib/systemd/systemd-udevd -D
==120669==
Set children_max to 24
Not invoked by PID1.
==120669== Warning: noted but unhandled ioctl 0x894c with no size/direction hints.
==120669== This could cause spurious value errors to appear.
==120669== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
# ./bupstash-testdata | RETENTION_BUCKETS="1H:24 1D:14 1W:8 4W:24 52W:100" ./bupstash-retention > /dev/null
id="0" timestamp="2021/06/01 02:02:17" retained=[]
id="1" timestamp="2021/06/01 04:04:54" retained=[]
id="2" timestamp="2021/06/01 06:03:12" retained=[]
id="3" timestamp="2021/06/01 08:05:52" retained=[]
id="4" timestamp="2021/06/01 10:07:56" retained=[]
id="5" timestamp="2021/06/01 12:06:02" retained=[]
id="6" timestamp="2021/06/01 14:07:50" retained=[]
id="7" timestamp="2021/06/01 16:05:48" retained=[]
id="8" timestamp="2021/06/01 18:06:25" retained=[]
@pschyska
pschyska / nix_example_upgrade_terraform.txt
Last active October 23, 2023 15:22
Example: Upgrading a nixpkgs package with a new version - terraform
# acquire nix-prefetch
$ cat > default.nix <<-"EOF"
with import <nixpkgs> { };
pkgs.mkShell rec { nativeBuildInputs = [ pkgs.nix-prefetch ]; }
EOF
$ nix-shell
# N.B.: in nix-shell my PS1 changes to (impure) *
# override terraform derivation with new source, but without sha256 and vendorSha256
(impure) * cat > terraform.nix <<-"EOF"
let lfopen = substituteAll {
src = ./files/lfopen;
isExecutable = true;
dir = "bin";
path = makeBinPath [ coreutils lf config.programs.alacritty.package ];
};
@pschyska
pschyska / q.sh
Last active March 4, 2021 11:58
resolve executable in PATH to nix store
# $ q bash
# /nix/store/8wbyyhschvbg0r3p6lh6vpvys6zk4ivc-bash-interactive-4.4-p23/bin/bash
q() {
readlink -e "$(type -a -p "$@")"
}
# $ qr bash
# /nix/store/8wbyyhschvbg0r3p6lh6vpvys6zk4ivc-bash-interactive-4.4-p23
qr() {
@pschyska
pschyska / lib.test.ts
Last active December 15, 2020 16:41
“Pattern matching” with Typescript
// Inspired by: https://medium.com/@fillopeter/pattern-matching-with-typescript-done-right-94049ddd671c
import { match, None } from "./lib";
const A = Symbol("A");
interface A {
readonly _tag: typeof A;
num: number;
}
@pschyska
pschyska / designer.html
Last active August 29, 2015 14:13
designer
<link rel="import" href="../google-map/google-map-search.html">
<link rel="import" href="../google-map/google-map.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
@pschyska
pschyska / 0_pw_hash.rb
Last active July 6, 2021 12:30
PW hashing with puppet parser function
# lib/puppet/parser/functions/pw_hash.rb
module Puppet::Parser::Functions
newfunction(:pw_hash, type: :rvalue) do |args|
raise Puppet::ParseError, "pw_hash takes exactly two arguments, #{args.length} provided" if args.length != 2
# SHA512 ($6), default number of rounds (5000)
# rounds could be specified by prepending rounds=<n>$ parameter before the salt, i.e.
# args[0].crypt("$6$rounds=50000$#{args[1]}")
args[0].crypt("$6$#{args[1]}")
end
@pschyska
pschyska / spotify-client.spec
Created May 22, 2014 08:20
spotify-client.spec
#These refer to the installer, not the main package:
%global commit 095c05612000e571634997c5b0e44e828abb44bc
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global repo http://repository.spotify.com/pool/non-free/s/spotify
%global github_repo https://github.com/pschyska/spotify-make/archive/%{commit}
# We cannot strip this binary (licensing restrictions).
%global debug_package %{nil}
%global __os_install_post \
def role_and_tier_names(user)
role_name = I18n.t("backend.users.index.role.#{user.account.role}")
res = if user.tiers
tier_names = user.tiers.map(&:name).join(", ")
I18n.t("backend.role_and_tier_names", role: role_name, tier_names: tier_names)
else
role_name
end
content_tag(:span, res, class: "role-and-tier-names").html_safe