Instantly share code, notes, and snippets.

Ivan Kozik ivan

View GitHub Profile
ivan /
Last active Jan 31, 2019
Use FreeRDP with non-standard DPI
xfreerdp /dynamic-resolution +decorations +fonts +aero +window-drag +multitransport /bpp:16 /rfx /codec-cache:rfx /video /scale-desktop:172 /scale-device:100

172% is the scaling factor we want.

/scale-device:100 is required because fucking Microsoft: "desktopScaleFactor (4 bytes): A 32-bit, unsigned integer. The requested desktop scale factor. This value MUST be ignored if it is less than 100% or greater than 500% or deviceScaleFactor is not 100%, 140%, or 180%. If this field is present, then the desktopOrientation and deviceScaleFactor fields MUST also be present."

ivan /
Last active Jan 31, 2019
Download a podcast episode from
#!/usr/bin/env bash
# Download a podcast episode from
# Usage:
# grab-anchor-episode
# serves a list of m4a files that need to be concatenated with ffmpeg.
set -eu -o pipefail
View .zshrc
# This is meant to be sourced; shebang line is for editors
# Undo nixos programs.zsh damage
umask 027
# Let me type a ! in a filename without escaping it
set +o histexpand
ivan / nixpkgs-qbittorrent.patch
Last active Jan 22, 2019
NixOS: patch qBittorrent a bit
View nixpkgs-qbittorrent.patch
--- a/pkgs/applications/networking/p2p/qbittorrent/default.nix
+++ b/pkgs/applications/networking/p2p/qbittorrent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkgconfig
+{ stdenv, fetchFromGitHub, pkgconfig, perl
, boost, libtorrentRasterbar, qtbase, qttools, qtsvg
, debugSupport ? false # Debugging
, guiSupport ? true, dbus ? null # GUI (disable to run headless)
@@ -22,12 +22,31 @@ stdenv.mkDerivation rec {
# NOTE: 2018-05-31: CMake is working but it is not officially supported
View signal-cli-init-at-0.6.2.patch
From a6c60518a87fe1b3bf2d86d8ca407c576b382436 Mon Sep 17 00:00:00 2001
From: Ivan Kozik <>
Date: Mon, 21 Jan 2019 03:15:18 +0000
Subject: [PATCH] signal-cli: init at 0.6.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This commit is based on work by Christopher Fredén in
ivan / ignore-pdf-permissions.patch
Created Jan 21, 2019
Chromium: ignore PDF permissions that restrict copying text and printing
View ignore-pdf-permissions.patch
diff --git a/pdf/pdfium/ b/pdf/pdfium/
index 8c3a4691ca5b..1bf4c4eabb7c 100644
--- a/pdf/pdfium/
+++ b/pdf/pdfium/
@@ -2299,35 +2299,7 @@ std::string PDFiumEngine::GetLinkAtPosition(const pp::Point& point) {
bool PDFiumEngine::HasPermission(DocumentPermission permission) const {
- // PDF 1.7 spec, section 3.5.2 says: "If the revision number is 2 or greater,
- // the operations to which user access can be controlled are as follows: ..."
ivan /
Last active Jan 17, 2019
Replace Debian install with NixOS on MBR/DHCP machine e.g. on SoYouStart

This is based on nixos-infect.

These instructions assume you have a machine using MBR to boot and DHCP for networking, and that /boot already exists as a separate partition.

Run manually:

mkdir -p -m 0755 /nix

# Add nix build users
groupadd nixbld -g 30000 || true
ivan / remote-luks-unlock.nix
Created Jan 16, 2019
View remote-luks-unlock.nix
{ config, lib, ... }:
with lib;
cfg = config.modules.remoteLuksUnlock;
ivan / okular_zoom_factors.patch
Created Jan 15, 2019
okular: use chromium's zoom factors
View okular_zoom_factors.patch
From 64e83c7326c9cbb4d41158aebe08c228490470cb Mon Sep 17 00:00:00 2001
From: Ivan Kozik <>
Date: Tue, 15 Jan 2019 21:36:28 +0000
Subject: [PATCH] okular: use chromium's zoom factors
pkgs/applications/kde/okular.nix | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pkgs/applications/kde/okular.nix b/pkgs/applications/kde/okular.nix
ivan /
Last active Jan 16, 2019
Replace Debian with NixOS on scaleway

Replace Debian install with NixOS on Scaleway

This is based on nixos-infect.

These instructions assume you have x86 scaleway machines that use UEFI and DHCP. You have may have to change /dev/vda15 if your machines are partitioned differently.

First, rsync your configuration to /root/configuration.