Skip to content

Instantly share code, notes, and snippets.

View dmalikov's full-sized avatar
🥞
!

Dmitry Malikov dmalikov

🥞
!
View GitHub Profile
@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
#!/usr/bin/perl
$_='
$q ="\ 47"; wh
ile ($ ;=
$z += .5 ){
%c= $r=0;$/ ="";whi le(2
0+ $z>($;+=.05)){$c{int$ _+ 2
6+ 2*($ r+= .0 2) *
s in$ ;}{1 -$_
+1 0+ int $r*c o s