Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@dmalikov
dmalikov / wow
Created September 28, 2014 19:43
Trying to build some package with a latest nixpkgs and updated channels
> nix-build -A haskellPackages.liblastfm --dry-run
these derivations will be built:
/nix/store/030bhqpnza6xjr7x1ljyxijz96y3aqcx-byteable-0.1.1.tar.gz.drv
/nix/store/05dx9vjkqdg61886gjj0d4qd4gpvp7i2-haskell-cryptohash-ghc7.8.3-0.11.6-shared.drv
/nix/store/0dla3dkdijwwdazcmr3ngbr0w902sb0z-crypto-numbers-0.2.3.tar.gz.drv
/nix/store/0dyjz5fmwqy2cyvdg0nwnsfv4ywaxms5-bootstrap-glibc.drv
/nix/store/0g5wn1j1rnvv8mcswivw370y6c1j88ng-haskell-punycode-ghc7.8.3-2.0-shared.drv
/nix/store/0ikg161x1s06gr3n4k31qxbkkx5q5c6z-haskell-setenv-ghc7.8.3-0.1.1.1-shared.drv
/nix/store/0j2wgcfg3r6y2hhsywdzcjb5r67vwq4z-smallcheck-1.1.1.tar.gz.drv
/nix/store/0rixhgcs1nkdmfbpi7sdszb9gm2b1bx7-xz-5.0.5.tar.bz2.drv
@dmalikov
dmalikov / wut
Created September 8, 2014 18:52
nix-shell vs hdevtools
>> nix-shell -p myHaskellPackages.dotfiles
error: file `/home/yep/dmalikov/dotfiles/biegunka/.hdevtools.sock' has an unsupported type
(use `--show-trace' to show detailed location information)
@dmalikov
dmalikov / gist:0a5d7919378d6bcd1aae
Last active August 29, 2015 14:06
Meanwhile on a #bash interview (or even #zsh)
$ [[ -n "$(echo "string with word word" | grep -o word))" ]] && echo contains
contains
$ [[ -n "$(echo "string without it" | grep -o word))" ]] && echo contains
contains
@dmalikov
dmalikov / wut
Created September 6, 2014 19:23
you prolly should just add '.' to the end of the path to make nix happy, obv
cabal.mkDerivation (self: {
pname = "cabal2nix";
version = "0.1";
src = /home/yep/git/cabal2nix/;
isLibrary = true;
$ nix-shell -p myHaskellPackages.cabal2nix
error: syntax error, unexpected ';', at /home/yep/.nixpkgs/cabal2nix/default.nix:14:32
(use `--show-trace' to show detailed location information)
@dmalikov
dmalikov / README.markdown
Last active May 31, 2019 06:31
Nix / NixOS links

Various blog posts related to Nix and NixOS


General

@dmalikov
dmalikov / Eu.hs
Last active August 29, 2015 14:01
Groupping strings by multiple fileds in various languages (All Hail Powershell)
module Eu where
import Control.Applicative ((<$>))
import Data.Function (on)
import Data.List (groupBy, intercalate)
import Data.List.Split (splitOn)
import qualified Data.Map as M
import Data.Maybe (mapMaybe)
main :: IO ()
@dmalikov
dmalikov / wow
Created April 14, 2014 14:09
Wow so null very static such empty
$ powershell ./wut.ps1
String is null
String is null
String is empty
@dmalikov
dmalikov / such expected.ps1
Last active August 29, 2015 13:57
powershell wow so pure very functional
$ cat function.ps1
function f() {
{ param($x) "expected output" }.Invoke()
}
function g() {
{ param($x) "unexpected" }.Invoke()
return "output"
}
@dmalikov
dmalikov / !.ps1
Last active August 29, 2015 13:57
.GetNewClosure()
PS C:\> { param($x) { param($y) $x + $y } }.Invoke(10).Invoke(20)
20
PS C:\> { param($x) { param($y) $x + $y }.GetNewClosure() }.Invoke(10).Invoke(20)
30
PS C:\> ({ param($x) { param($y) $y * $x } }.Invoke(10).Invoke(20)) -eq 0
True
PS C:\> ({ param($x) { param($y) $x * $y } }.Invoke(10).Invoke(20)) -eq $null
True