Skip to content

Instantly share code, notes, and snippets.

View jml's full-sized avatar

Jonathan Lange jml

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jml on github.
  • I am jml (https://keybase.io/jml) on keybase.
  • I have a public key whose fingerprint is D3B6 604B 81B4 C7D4 43F5 3D5D AA23 EC3C 2A72 7997

To claim this, I am signing this object:

# XXX: Make an HTML-level cleaner that converts:
# - <span style="font-family: Courier New, Courier, monospace;"> to <code>
# - <span style="font-family: Helvetica Neue, Arial, Helvetica, sans-serif;"> to nothing
# - &nbsp; to a literal space
# - <div> or <p> containing only <code> & <br> into a <pre>
#
# See if that cleans up ~ & $ escaping.
#
# If not, do a post-import Markdown cleanup
$ pip install ggplot
Downloading/unpacking ggplot
Downloading ggplot-0.5.8.tar.gz (5.7MB): 5.7MB downloaded
Running setup.py (path:/Users/jml/envs/notebooks/build/ggplot/setup.py) egg_info for package ggplot
Requirement already satisfied (use --upgrade to upgrade): six in ./lib/python2.7/site-packages (from ggplot)
Downloading/unpacking statsmodels (from ggplot)
Downloading statsmodels-0.5.0.tar.gz (5.5MB): 5.5MB downloaded
Running setup.py (path:/Users/jml/envs/notebooks/build/statsmodels/setup.py) egg_info for package statsmodels
Traceback (most recent call last):
@jml
jml / gist:25166ff19edc724a2964
Created August 3, 2014 13:17
Two very similar quickcheck properties
type Transformation a = (TodoFile -> a -> (TodoFile, [TodoEvent]))
-- XXX: If there were something that was like 'map f' but when given a
-- non-list would lift to a list and return a singleton, that would make this
-- more generic.
prop_emptyUnchanged_multiple :: Transformation [Int] -> Property
prop_emptyUnchanged_multiple transformation =
property $ \items -> transformation emptyFile items `shouldBe` (emptyFile, map NoSuchTask (nub items))
$ python
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(x):
... return x + a
...
>>> f.func_code.co_names
('a',)
>>> f.func_code.co_varnames
$ echo $PATH
~/Library/Haskell/bin:~/.cabal/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/MacGPG2/bin
$ ls -l ~/Library/Haskell/bin/cabal
-rwxr-xr-x 1 jml staff 19475336 Aug 16 16:06 /Users/jml/Library/Haskell/bin/cabal
$ which cabal
/usr/bin/cabal
$
@jml
jml / gist:a15415b26b9209d5e570
Created December 10, 2014 10:19
rust cloning & ownership

(edited conversation from #rust, featuring jml, reem, and Yurume).

I have a value type Foo, implemented as a struct with methods that return Foo such that the struct is never mutated but only new ones returned. If I want one of those to return the value unchanged, do I have to clone? e.g. http://is.gd/rm4gmY

#[deriving(Eq, PartialEq, PartialOrd, Ord, Show, Clone)]
struct Foo {
  x: int,
[nix-shell:~/src/haverer-api]$ cabal build -v
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
/nix/store/psk32g0fz8rz1wcchcrkwldmljh7whq6-ghc-7.8.4-wrapper/bin/ghc --numeric-version
looking for tool ghc-pkg near compiler in
/nix/store/psk32g0fz8rz1wcchcrkwldmljh7whq6-ghc-7.8.4-wrapper/bin
found ghc-pkg in
/nix/store/psk32g0fz8rz1wcchcrkwldmljh7whq6-ghc-7.8.4-wrapper/bin/ghc-pkg
/nix/store/psk32g0fz8rz1wcchcrkwldmljh7whq6-ghc-7.8.4-wrapper/bin/ghc-pkg --version
/nix/store/psk32g0fz8rz1wcchcrkwldmljh7whq6-ghc-7.8.4-wrapper/bin/ghc --supported-languages
@jml
jml / cabal test output
Created February 28, 2015 18:34
nix-shell for system-fileio
[nix-shell:~/src/haskell-filesystem/system-fileio]$ cabal test
Preprocessing library system-fileio-0.3.16...
lib/Filesystem.hs:82:18:
Could not find module ‘Data.Text’
Perhaps you haven't installed the profiling libraries for package ‘text-1.2.0.3’?
Use -v to see a list of the files searched for.
lib/Filesystem.hs:83:18:
Could not find module ‘Data.Text.IO’
@jml
jml / gist:661db09e76157acf4265
Created February 28, 2015 18:48
ghc-pkg list
/Users/jml/.nix-profile/bin/../lib/ghc-7.8.4/package.conf.d/aeson-0.8.0.2.installedconf:
aeson-0.8.0.2
/Users/jml/.nix-profile/bin/../lib/ghc-7.8.4/package.conf.d/aeson-0.8.0.2.installedconf:
aeson-0.8.0.2
/Users/jml/.nix-profile/bin/../lib/ghc-7.8.4/package.conf.d/ansi-terminal-0.6.2.1.installedconf:
ansi-terminal-0.6.2.1
/Users/jml/.nix-profile/bin/../lib/ghc-7.8.4/package.conf.d/ansi-terminal-0.6.2.1.installedconf: