Instantly share code, notes, and snippets.

Ivan Kozik ivan

View GitHub Profile
@ivan
ivan / freerdp-dpi-help.md
Last active Jan 31, 2019
Use FreeRDP with non-standard DPI
View freerdp-dpi-help.md
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."

https://msdn.microsoft.com/en-us/library/cc240510.aspx

@ivan
ivan / grab-anchor-episode.sh
Last active Jan 31, 2019
Download a podcast episode from anchor.fm
View grab-anchor-episode.sh
#!/usr/bin/env bash
# Download a podcast episode from anchor.fm
#
# Usage:
# grab-anchor-episode https://anchor.fm/emerge/episodes/Robert-MacNaughton---Learnings-from-the-Life-and-Death-of-the-Integral-Center-e31val
#
# anchor.fm serves a list of m4a files that need to be concatenated with ffmpeg.
set -eu -o pipefail
View .zshrc
#!/bin/zsh
# This is meant to be sourced; shebang line is for editors
# Undo nixos programs.zsh damage
unsetopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
umask 027
# Let me type a ! in a filename without escaping it
set +o histexpand
@ivan
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 <ivan@ludios.org>
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
https://github.com/icetan/dot-nixpkgs/blob/8867ed07f78d7632ffefa1a3aceb8136a8c46a03/overlays/pkgs/signal-cli.nix
@ivan
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/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 8c3a4691ca5b..1bf4c4eabb7c 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -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
ivan / nixos-mbr-dhcp.md
Last active Jan 17, 2019
Replace Debian install with NixOS on MBR/DHCP machine e.g. on SoYouStart
View nixos-mbr-dhcp.md

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
ivan / remote-luks-unlock.nix
Created Jan 16, 2019
remote-luks-unlock.nix
View remote-luks-unlock.nix
{ config, lib, ... }:
with lib;
let
cfg = config.modules.remoteLuksUnlock;
in
{
@ivan
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 <ivan@ludios.org>
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
ivan / instructions.md
Last active Jan 16, 2019
Replace Debian with NixOS on scaleway
View instructions.md

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.

Run: