Skip to content

Instantly share code, notes, and snippets.

Avatar
😪

Pete Doherty ethagnawl

😪
View GitHub Profile
View .tmux.conf
# tmux config file
# the rest of your config file ...
# This example creates a variable named `custom_pane_title` which will be
# displayed if and only if it has been set -- in this case by by your
# tmuxinator pane commands.
# This feature doesn't seem to be documented, otherwise I'd provide a link.
# I _believe_ this feature requires tmux >= 3.0
set -g pane-border-format "#{pane_index}#{?@custom_pane_title,:#{@custom_pane_title},}:#{pane_title}"
@ethagnawl
ethagnawl / gist:78c1d0945400987b29d8a0b281ecea0a
Created Apr 14, 2020
Find Raspberry Pi IP using arp-scan
View gist:78c1d0945400987b29d8a0b281ecea0a
sudo arp-scan --localnet 2> /dev/null | grep Pi | awk '{print $1}'
View gist:027c030167555f171567974783fe6f71
# https://www.postgresqltutorial.com/postgresql-indexes/postgresql-list-indexes/
SELECT
tablename,
indexname,
indexdef
FROM
pg_indexes
WHERE
schemaname = 'public'
ORDER BY
View pg_stat_activity.sql
select pid as process_id,
usename as username,
datname as database_name,
client_addr as client_address,
application_name,
backend_start,
state,
state_change
from pg_stat_activity;
@ethagnawl
ethagnawl / break.py
Created Sep 6, 2019 — forked from obfusk/break.py
python equivalent of ruby's binding.pry
View break.py
import code; code.interact(local=dict(globals(), **locals()))
View reverse-tunnel.service
[Unit]
Description=Reverse SSH Tunnel
After=network.target
[Service]
ExecStart=/usr/bin/ssh -N -R 27276:localhost:22 -o "ExitOnForwardFailure yes" server
KillMode=process
Restart=always
[Install]
@ethagnawl
ethagnawl / sort-dir-size-recursive.sh
Created Jun 14, 2019
list/sor directories by content size
View sort-dir-size-recursive.sh
du -s * | sort -k 1,1 -V
@ethagnawl
ethagnawl / .tmux.conf
Created May 8, 2019
tmux hook examples
View .tmux.conf
set-hook after-split-window 'run "echo split > ~/tmux.log'
set-hook before-new-window 'run "date >> ~/tmux.log"'
@ethagnawl
ethagnawl / foo.yml
Created Mar 27, 2019
dynamic tmux_options
View foo.yml
# /home/peter/.config/tmuxinator/foo.yml
name: foo
root: ~/
tmux_options: -f <%= args[0] %>
windows:
- one:
- echo logs
- two:
- echo left
@ethagnawl
ethagnawl / gist:a65e5b0f43f182a34cc432624325f6dd
Created Feb 28, 2019
Django Reverse for ... with arguments not found
View gist:a65e5b0f43f182a34cc432624325f6dd
You may see the following (confusing) error message when using trying to create an entity URL for an entity which uses an `AutoField` primary key
`Reverse for 'foo_update' with arguments '('',)' not found. 1 pattern(s) tried: ['foos/(?P<pk>[0-9]+)/edit/$']`
So, in your view:
`<a href="{% url 'foo_update' foo.id %}">edit</a>`
... should be:
`<a href="{% url 'foo_update' foo.foo_id %}">edit</a>`
You can’t perform that action at this time.