Skip to the relevant sections if needed.
package com.github.therapi.apidoc; | |
import java.util.List; | |
import com.fasterxml.jackson.databind.JavaType; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.module.jsonSchema.JsonSchema; | |
import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper; | |
import com.fasterxml.jackson.module.jsonSchema.factories.VisitorContext; |
{ pkgsPath ? <nixpkgs> }: | |
let | |
pkgs = import pkgsPath {}; | |
pkgsAarch64 = import pkgsPath { system = "aarch64-linux"; }; | |
iso = (pkgsAarch64.nixos { | |
imports = [ (pkgsPath + "/nixos/modules/installer/cd-dvd/installation-cd-base.nix") ]; | |
users.users.root.openssh.authorizedKeys.keyFiles = [(builtins.fetchurl https://github.com/lheckemann.keys)]; | |
}).config.system.build.isoImage; |
As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!
to learn more abot ghostscript (gs): https://www.ghostscript.com/
What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.
credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the\
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
# Adapted from @ryanorendorff's gist: https://gist.github.com/ryanorendorff/f5c96d9f363a0e390425c2d9588bbb9d | |
{ pkgs ? import <nixos> {} }: | |
let | |
# The standard library in nixpkgs does not come with a *.agda-lib file, so we | |
# generate it here. | |
standard-library-agda-lib = pkgs.writeText "standard-library.agda-lib" '' | |
name: standard-library | |
include: ${pkgs.AgdaStdlib}/share/agda |
# Module for configuring libvirt with static NixOS networking | |
# instead of using libvirt managed bridge. | |
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.virtualisation.libvirtd.networking; | |
v6Enabled = cfg.ipv6.network != null; | |
v6PLen = toInt (elemAt (splitString "/" cfg.ipv6.network) 1); |
// example solution to remove comments from HTML. | |
// re: http://groups.google.com/group/jsoup/browse_thread/thread/419b5ac4be88b086 | |
import org.jsoup.Jsoup; | |
import org.jsoup.nodes.Document; | |
import org.jsoup.nodes.Node; | |
public class RemoveComments { | |
public static void main(String... args) { | |
String h = "<div><!-- no --><p>Hello<!-- gone --></div>"; |