Skip to content

Instantly share code, notes, and snippets.

View qrilka's full-sized avatar
🖥️
as always

Kirill Zaborsky qrilka

🖥️
as always
  • FP Complete
  • Arkhangelsk, Russia
View GitHub Profile
qrilka@qdesktop ~ $ ghci
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
λ> let divisors1 n ds = if null subds then [n] else subd:(divisors1 (n `div` subd) (dropWhile (< subd) ds)) where subds = [i| i <- takeWhile (\x->x*x<n) ds, n `rem` i == 0];subd = head subds
λ> :set +s
λ> divisors1 93819012551 [2..]
[11,9539,894119]
(0.01 secs, 0 bytes)
{-# LANGUAGE BangPatterns #-}
import Data.List
import Control.Monad.ST
import Control.Monad
import Data.Array.ST
import Data.Array.Unboxed
import Data.Foldable(foldlM)
data Exp = IfGt Int Int Block Block -- if a[i] > a[j] then blk1 else blk2
| Swap Int Int -- a[i] <-> a[j] (i,j < 8)

Keybase proof

I hereby claim:

  • I am qrilka on github.
  • I am qrilka (https://keybase.io/qrilka) on keybase.
  • I have a public key whose fingerprint is 481B 3AA7 29E0 AC04 3E6E 612E 6C62 2CCF 1792 4AD2

To claim this, I am signing this object:

@qrilka
qrilka / httpc-test.escript
Last active August 29, 2015 14:00
httpc and chunked
#!/usr/bin/env escript
main(_Args) ->
application:start(sasl),
inets:start(),
R = httpc:request(get, {"http://www.csm-testcenter.org/cgi-bin/eicar.com?transfer=chunked",
[]}, [], [{sync, false}, {receiver, self()},{stream,self}]),
loop().
loop() ->
@qrilka
qrilka / gist:11038169
Created April 18, 2014 11:08
scrapinghub through tinyproxy
$ http_proxy=http://localhost:8080 curl -v http://scrapinghub.com/ 2>&1 | head -100
* Hostname was NOT found in DNS cache
* Trying ::1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connect to ::1 port 8080 failed: В соединении отказано
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET http://scrapinghub.com/ HTTP/1.1
> User-Agent: curl/7.36.0
@qrilka
qrilka / httpc-test.escript
Created April 4, 2014 14:19
httpc error in R16B03-1
#!/usr/bin/env escript
main(_Args) ->
application:start(sasl),
inets:start(),
BadAddress = "http://10.255.255.1:8000/ru/",
spawn(fun()-> io:format("Res1:~P~n",
[httpc:request(get, {BadAddress,[]},[
{connect_timeout,1000}
],[]%,P
qrilka@qdesktop ~/ws/erl/meck_test $ rebar skip_deps=true eunit
==> Entering directory `/home/qrilka/ws/erl/meck_test/apps/app'
==> app (eunit)
module 'b'
*** context setup failed ***
**in function meck:check_expect_result/1 (src/meck.erl, line 663)
**error:{undefined_function,{a,b,0}}
=======================================================
@qrilka
qrilka / state-test.hs
Created December 20, 2013 20:49
multiple state modifications
$ runhaskell ~/state-test.hs
Funky {_name = "Chuck sucks", _coordinates = (0,1)}
@qrilka
qrilka / gist:6006305
Created July 16, 2013 06:39
cabal-dev ghci problems
qrilka@qdesktop ~/ws/h/ghci-test $ rm -rf cabal-dev
qrilka@qdesktop ~/ws/h/ghci-test $ cabal-dev install --enable-tests
Warning: The package list for 'hackage.haskell.org' is 39 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Configuring ghci-test-0.1.0.0...
Building ghci-test-0.1.0.0...
Preprocessing library ghci-test-0.1.0.0...
In-place registering ghci-test-0.1.0.0...
Preprocessing test suite 'ghci-tests' for ghci-test-0.1.0.0...
@qrilka
qrilka / gist:5981650
Last active December 19, 2015 16:09
Testing multiple build-depends with cabal-dev ghci
qrilka@qdesktop ~/ws/h $ mkdir ghci-test
qrilka@qdesktop ~/ws/h $ cd ghci-test
qrilka@qdesktop ~/ws/h/ghci-test $ cabal-dev init
Package name? [default: ghci-test]
Package version? [default: 0.1.0.0]
Please choose a license:
* 1) (none)
2) GPL-2
3) GPL-3
4) LGPL-2.1