Skip to content

Instantly share code, notes, and snippets.

@bfontaine
bfontaine / README.md
Created October 10, 2017 09:08
Sort lines by some command

sort-by

Usage

cat ... | sort-by your command ...

Example

$ cat toto.jsons 

{"a": 1, "b": 2}

#! /bin/bash
# meq = multi-line eq
# See https://github.com/jonase/eq#eq-edn-query
EQ=eq
while read line; do echo "$line" | $EQ $@ ; done
@bfontaine
bfontaine / matplotlib-frameworkpython
Last active February 9, 2016 13:00
PYTHONHOME script from http://matplotlib.org/faq/virtualenv_faq.html (I’m not the author; I’m posting here so it’s easier to `curl`).
#!/bin/bash
# what real Python executable to use
PYVER=2.7
PATHTOPYTHON=/usr/local/bin/
PYTHON=${PATHTOPYTHON}python${PYVER}
# find the root of the virtualenv, it should be the parent of the dir this script is in
ENV=`$PYTHON -c "import os; print os.path.abspath(os.path.join(os.path.dirname(\"$0\"), '..'))"`
@bfontaine
bfontaine / gephi-for-osx.md
Last active October 25, 2020 20:21
Install Gephi on OS X
  1. Install Homebrew:

     ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    
  2. Download Java 6 on this page and install it

  3. Install Gephi:

     brew cask install gephi
    
package main
import "fmt"
func main() {
p := rune(96)
s := `package main
import "fmt"
@bfontaine
bfontaine / rm-brew-doc.sh
Last active August 29, 2015 14:16
Remove docs from installed Homebrew formulae. I ran short of disk space while installing something, and this little command got me 600MB back. Use at your own risk.
\ls -1 /usr/local/Cellar/*/*/share/doc | grep doc: | cut -d: -f1 | xargs rm -rf; brew prune
@bfontaine
bfontaine / pixel-dungeon-jar2app.sh
Last active August 29, 2015 14:10
Install Pixel Dungeon as a Mac .app
#! /usr/bin/env bash
#
# Usage:
# curl -sL http://bit.ly/pixeldungeon2app-sh | bash -e
#
echo "Creating a temporary directory..."
mkdir -p pd_tmp
cd pd_tmp
echo "Downloading a JDK build..."
curl -L# -o jdk.zip https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u60-unofficial-macosx-x86_64-image.zip
@bfontaine
bfontaine / install-rogue.sh
Last active August 29, 2015 14:09
Install the original Rogue on Ubuntu
echo "==> retrieving the source"
wget http://rogue.rogueforge.net/files/rogue5.4/rogue5.4.4-src.tar.gz
echo "==> unpacking"
tar xzf rogue5.4.4-src.tar.gz && cd rogue5.4.4
echo "==> configuring"
./configure --disable-debug --disable-dependency-tracking
echo "==> patching"
@bfontaine
bfontaine / ipython_config.py
Created April 27, 2014 18:26
Import your ~/.bashrc aliases in IPython
# Configuration file for ipython.
import re
import os.path
c = get_config()
with open(os.path.expanduser('~/.bashrc')) as bashrc:
aliases = []
for line in bashrc:
@bfontaine
bfontaine / LICENSE.txt
Last active December 22, 2015 14:18 — forked from 140bytes/LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Baptiste Fontaine <bfontaine.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE