Skip to content

Instantly share code, notes, and snippets.

Ivan Kozik ivan

Block or report user

Report or block ivan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fonts.conf.xml
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<!-- Don't use embedded bitmap in Cambria and other fonts: -->
<match target="font">
<edit mode="assign" name="embeddedbitmap">
<!-- Use the correct antialiasing and hinting settings -->
ivan / discord_userscript.js
Last active Apr 27, 2019
Increase contrast on Discord light theme
View discord_userscript.js
// ==UserScript==
// @name Discord: fix some styling problems
// @namespace discord_styles
// @include*
// @version 7
// @grant GM_addStyle
// @run-at document-start
// ==/UserScript==
// Only for use with the light theme.
ivan /
Last active Apr 24, 2019
Japan travel notes

I visited Japan for the first time March 13-28 2019, here are some general notes from the trip.

  • Trip duration: I walked a lot (sometimes 19 km/day for several days) up and down hills, to and from train stations; this was tiring enough that it was a mistake to stay for 14 days; I should not have stayed for longer than 9-10 days; this would have saved money on the JR pass (7 days instead of 14 days) and hotels.

  • seemed to have the best prices and largest selection of hotels. Book at least two months early for good+inexpensive options.

  • I did not have a problem with smoke in any of my non-smoking hotel rooms in Henn na Hotel Tokyo Akasaka (100% non-smoking), Hotel IL Verde Kyoto, Hotel Intergate Hiroshima, Hotel Trend Kanazawa Ekimae, or Fudo-in in Koyasan.

  • There are a lot of smokers (sometimes in areas where it is forbidden to smoke), but their smoke was never a real problem for me.

View gist:5ae6b9bff56623e0b80bec66889714fa
services.xserver = {
videoDrivers = [ "ati" ];
deviceSection = ''
# We don't need TearFree to avoid tearing in Chrome and mpv; TearFree also
# has the disadvantage of making switches to text VTs take 2 seconds.
#Option "TearFree" "on"
# Use exa because glamor causes subtle but visible triangular tearing when
# used without TearFree.
Option "AccelMethod" "exa"
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: ..."
You can’t perform that action at this time.