Skip to content

Instantly share code, notes, and snippets.

@jclosure
jclosure / monad.py
Created September 25, 2019 05:56 — forked from unthingable/monad.py
from abc import abstractmethod
from itertools import chain, imap
from typing import Any, Iterable
from typing import Callable, Generic, List
from typing import TypeVar
A = TypeVar('A')
B = TypeVar('B')
C = TypeVar('C')
@jclosure
jclosure / terminals.txt
Created August 2, 2019 02:54 — forked from KevinGoodsell/terminals.txt
The Trouble With Terminals
The Trouble With Terminals
Thu, 16 Dec 2010 16:43:20 -0800
Copyright 2010 Kevin Goodsell
0. License
This work is licensed under a Creative Commons
Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a
@jclosure
jclosure / system-wide-clipboard.zsh
Created July 31, 2019 06:43 — forked from welldan97/system-wide-clipboard.zsh
Zsh copy & paste system wide for OS X, like in emacs
pb-kill-line () {
zle kill-line
echo -n $CUTBUFFER | pbcopy
}
pb-kill-whole-line () {
zle kill-whole-line
echo -n $CUTBUFFER | pbcopy
}
@jclosure
jclosure / ssh-forward-clipboard.md
Created July 29, 2019 00:19 — forked from dergachev/ssh-forward-clipboard.md
Forward your clipboard via SSH reverse tunnels

Exposing your clipboard over SSH

I frequently administer remote servers over SSH, and need to copy data to my clipboard. If the text I want to copy all fits on one screen, then I simply select it with my mouse and press CMD-C, which asks relies on m y terminal emulator (xterm2) to throw it to the clipboard.

This isn't practical for larger texts, like when I want to copy the whole contents of a file.

If I had been editing large-file.txt locally, I could easily copy its contents by using the pbcopy command:

@jclosure
jclosure / init.el
Last active July 6, 2019 16:09
Hacking on lsp-elixir--get-root
;; ...
(require-package 'elixir-mode)
(require-package 'lsp-mode)
(require-package 'company-lsp)
(require 'lsp-elixir)
(add-hook 'elixir-mode-hook #'lsp-elixir-enable)
(require 'company)
@jclosure
jclosure / jinja2.ipynb
Created March 27, 2019 06:18 — forked from bj0/jinja2.ipynb
IPython Custom Cell Magic for Rendering Jinja2 Templates
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jclosure
jclosure / es_scrolling_search.py
Last active May 31, 2018 10:46 — forked from drorata/gist:146ce50807d16fd4a6aa
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})
@jclosure
jclosure / remoteobserver.sh
Created April 23, 2018 15:30 — forked from ulve/remoteobserver.sh
Connect to remote phoenix node with observer
# On the phoenix node
# if production mode
MIX_ENV=prod PORT=4001 elixir --name phoenix@127.0.0.1 --cookie 123 --erl "-kernel inet_dist_listen_min 9001 inet_dist_listen_m 9001" -pa _build/prod/consolidated -S mix phoenix.server
# if debug mode
elixir --name phoenix@127.0.0.1 --cookie 123 --erl "-kernel inet_dist_listen_min 9001 inet_dist_listen_m 9001" -S mix phoenix.server
# On the observing node
# Terminal 1, start SSH tunnel
ssh -N -L 9001:localhost:9001 -L 4369:localhost:4369 pi@192.168.1.31
@jclosure
jclosure / profile-svg.sh
Created February 27, 2018 05:02 — forked from jms/profile-svg.sh
pytest profile-svg
FLASK_CONFIG=test pytest --profile-svg
for i in $(ls *.prof); do gprof2dot -f pstats $i | dot -Tsvg -o $i.svg ; done
@jclosure
jclosure / async_no_link.ex
Created November 10, 2017 05:42 — forked from ignacy/async_no_link.ex
Example of using Task.Supervisor.async_nolink with Elixir Tasks