Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Loves programming languages

Steven Shaw steshaw

👨‍💻
Loves programming languages
View GitHub Profile
View pkg-versions.nix
# Usage:
#
# Find version:
#
# $ nix-instantiate --eval --expr '(import ./pkg-versions.nix {}).pandoc'
# { "1.13.1" = <CODE>; "1.16.0.2" = <CODE>; "1.17.1" = <CODE>; "1.19.2.1" = <CODE>; "1.19.2.4" = <CODE>; "2.0.6" = <CODE>; "2.2.1" = <CODE>; "2.7.1" = <CODE>; }
# $ nix eval '(builtins.attrNames (import ./pkg-versions.nix {}).pandoc)'
# [ "1.13.1" "1.16.0.2" "1.17.1" "1.19.2.1" "1.19.2.4" "2.0.6" "2.2.1" "2.7.1" ]
# $ nix-instantiate --eval --expr 'builtins.attrNames (import ./pkg-versions.nix {}).pandoc'
# [ "1.13.1" "1.16.0.2" "1.17.1" "1.19.2.1" "1.19.2.4" "2.0.6" "2.2.1" "2.7.1" ]
View sizes.c
#include <stdio.h>
int main() {
printf("sizeof(size_t) = %zu\n", sizeof(size_t));
printf("sizeof(short) = %zu\n", sizeof(short));
printf("sizeof(int) = %zu\n", sizeof(int));
printf("sizeof(long) = %zu\n", sizeof(long));
}
View shell.nix
let sources = import ./sources.nix;
in
{ pkgs ? import sources.nixpkgs { }
}:
/*
with
{ overlay = _: pkgs:
{ niv = import sources.niv {};
};
};
View shell.nix
let sources = import ./sources.nix;
in
{ pkgs ? import sources.nixpkgs { }
}:
/*
with
{ overlay = _: pkgs:
{ niv = import sources.niv {};
};
};
View foo.sh-session
$ nix-collect-garbage --delete-old # Delete all garbage and old generations.
[snip]
$ nix-env --list-generations
1007 2020-09-16 06:49:32 (current)
$ ls -alFh /home/steshaw/.nix-profile
lrwxrwxrwx 1 steshaw users 46 Jul 15 2019 /home/steshaw/.nix-profile -> /nix/var/nix/profiles/per-user/steshaw/profile/
View gdb1.out
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
View foo.hs
{-# LANGUAGE TypeApplications #-}
module Main where
fred :: IO Int
fred = do
pln $ show @Int mb1
pln $ show $ (mb1 :: Int)
pure $ foo1 + foo2
where
View hello.idr
module Main
foo : IO ()
foo = putStrLn "foo"
View repeated-contraints.hs
module Main where
myFunc
:: Functor m
=> Applicative m
=> Monad m
=> m a
-> Int
-> m a
myFunc m n = m
View EmbedFile.hs
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-}
module Foo.EmbedFile
( ourEmbedFile,
ourEmbedFileUtf8,
traceSplices,
relativeToProjectHome,
)
where
You can’t perform that action at this time.