Skip to content

Instantly share code, notes, and snippets.

@jclosure
jclosure / centos-install-syntax-highlighting-in-less.sh
Created August 1, 2017 16:26 — forked from textarcana/centos-install-syntax-highlighting-in-less.sh
How to enable syntax-highlighting in less. Use `less -N` (or type -N while in less) to enable line numbers. Based on the procedure described in http://superuser.com/questions/71588
# Enable syntax-highlighting in less.
# Last tested on CentOS 6.3.
#
# First, add these two lines to ~/.bashrc
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
# export LESS=" -R "
sudo yum -y install boost boost-devel ctags
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm
@jclosure
jclosure / llvm-update-alternatives
Last active August 20, 2017 17:01 — forked from jc00ke/llvm-update-alternatives
LLVM & clang alternatives
#!/usr/bin/env sh
sudo update-alternatives --install \
/usr/bin/llvm-config llvm-config /usr/bin/llvm-config-3.4 200 \
--slave /usr/bin/llvm-ar llvm-ar /usr/bin/llvm-ar-3.4 \
--slave /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.4 \
--slave /usr/bin/llvm-bcanalyzer llvm-bcanalyzer /usr/bin/llvm-bcanalyzer-3.4 \
--slave /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-3.4 \
--slave /usr/bin/llvm-diff llvm-diff /usr/bin/llvm-diff-3.4 \
--slave /usr/bin/llvm-dis llvm-dis /usr/bin/llvm-dis-3.4 \
@jclosure
jclosure / debug_live_elixir.md
Created October 28, 2017 04:13
How to debug a live elixir server

the app server must have been started with elixir --sname appname --cookie mycookie -S mix phoenix.server connect to the server via ssh

  1. start an iex Session with (important: cookies must match but can be freely chosen, names can be freely chosen too): iex --sname foo --cookie mycookie
foo@host> node = :"appname@host"

# appnames must match
@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
@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 / 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 [email protected] --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 [email protected] --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 [email protected]
@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 / jinja2.ipynb
Created March 27, 2019 06:18 — forked from bj0/jinja2.ipynb
IPython Custom Cell Magic for Rendering Jinja2 Templates
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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 / 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: