Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Kahlenberg 573

View GitHub Profile
@573
573 / readme.md
Last active Apr 14, 2021
pandoc tricks with nix
View readme.md

Question was how to create fillable pdf using pandoc: https://np.reddit.com/r/haskell/comments/mj7kv5/monthly_hask_anything_april_2021/gt8pcsk/
Source: https://github.com/NixOS/nixpkgs/issues/14463#issue-145858361

NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell --pure -p "(texlive.combine { inherit (texlive) scheme-small hyperref; })" pandoc
NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell --pure -E 'with import <nixpkgs> { }; stdenv.mkDerivation {name = "otf"; buildInputs = [pandoc (texlive.combine { inherit (texlive) scheme-small hyperref; })];}'

(both work)

So to create Forms PDF from the markdown file, do:

View generate-versions.nix
{ channels ? [ "unstable" "20.09" "20.03" "19.09" "19.03" "18.03" "17.03" "16.03" "15.09" "14.12" "14.04" ]
, attrs ? builtins.attrNames (import <nixpkgs> {})
, system ? builtins.currentSystem
, args ? { inherit system; }
}: let
getSet = channel: (import (builtins.fetchTarball "channel:nixos-${builtins.toString channel}") args).pkgs;
getPkg = name: channel: let
pkgs = getSet channel;
@573
573 / readme.md
Created Apr 14, 2021
pdf tricks with nix
View readme.md

Version: GPL Ghostscript 9.53.3 (2020-10-01)

NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix run nixpkgs.ghostscript -c gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f encrypted.pdf

Use https://matthewbauer.us/blog/all-the-versions.html for gs version selection.

@573
573 / readme.md
Created Apr 8, 2021
nix and bash tricks get sha256 for certain package version
View readme.md

See https://discourse.nixos.org/t/eval-nix-expression-from-the-command-line/8993/3

NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-instantiate --eval -E '(import <nixpkgs> {}).vscode.version'
# with version retrieved, 1.55.0 here
(version="1.55.0"; url=$(NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix eval -f '<nixpkgs>' 'vscode.src.urls'); nix-prefetch-url $(echo "${url[0]}" | awk -F'[][]' -F'"'
'{print $2}'))
@573
573 / readme.md
Created Apr 8, 2021
clojure lein repl powershell pro tip
View readme.md

And attempting: lein update-in :dependencies conj "[nrepl \`"0.5.3\`"]" -- repl Just prints the help banner.

I encountered the same issue. You also have to quote the dashes:

lein.ps1 update-in :dependencies conj '[nrepl \"0.5.5\"]' '--' repl
@573
573 / readme.md
Created Apr 6, 2021
On archlinux the network printer doesn't work
View readme.md

It fails with a suggestion to run "/usr/bin/cups-genppdupdate"
start or at least check cups service
Via http://localhost:631/printers/ (root) choose "Printers > Brother_HL-2250DN_series > Administration > Modify Printer" and when the model dialog page comes just use the uptodate version i. e. "Brother HL-2250DN - CUPS+Gutenprint v5.3.4 (en)" and click "Modify Printer".

@573
573 / readme.md
Created Apr 6, 2021
nix.dev avoid channel with sub shell
View readme.md
# https://github.com/srid/browsersync-nix
$(NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-build --no-out-link -A nodeDependencies)/bin/browser-sync
@573
573 / readme.md
Created Apr 6, 2021
kotlin-shell via leiningen and nix-shell
View readme.md
# https://github.com/igrishaev/etaoin/issues/206
NIX_PATH=nixpkgs=http://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz nix-shell -p leiningen --run 'lein update-in :dependencies conj '"'"'[org.jetbrains.kotlinx/ki-shell "0.3.2"]'"'"' -- repl'
@573
573 / data-wrangling.ipynb
Created Mar 30, 2021 — forked from Alexon-Abreu/data-wrangling.ipynb
Created on Skills Network Labs
View data-wrangling.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@573
573 / readme.md
Created Mar 30, 2021
syncthing showing a blank page for web gui ?
View readme.md

Double-check that your browser has no JS-Disabler extension active !