Skip to content

Instantly share code, notes, and snippets.

View bukzor's full-sized avatar
🌥️
learning google cloud

Buck Evan bukzor

🌥️
learning google cloud
  • google.com
  • Appleton, WI
  • 15:56 (UTC -06:00)
View GitHub Profile
#! /usr/bin/env bash
CONTROL_FILE="./bastion_control"
if [ -n "$1" ]; then CONTROL_FILE=$1; fi
ssh -S $CONTROL_FILE -O exit bastion
if exists(':terminal')
" Readline cheatsheet:
" ctrl-a - jump to start of line
" ctrl-e - jump to end of line
" ctrl-k - kill forwards to the end of line
" ctrl-u - kill backwards to the start of line
autocmd TermOpen * nnoremap <buffer> I I<C-a>
autocmd TermOpen * nnoremap <buffer> A A<C-e>
autocmd TermOpen * nnoremap <buffer> C A<C-k>
autocmd TermOpen * nnoremap <buffer> D A<C-k><C-\><C-n>
@bukzor
bukzor / gist:8746934
Last active May 30, 2019 00:44
Sierpinski Gasket, in sed
CMD='h;s/(.)/\1\1\1/g;x;s/(.)/\1 \1/g;H;s/(.) (.)/\1\1\2/g;H;x' sh -c 'echo "|" | sed -r "$CMD" | sed -r "$CMD" | sed -r "$CMD" | sed -r "$CMD"'
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| || || || || || || || || || || || || || || || || || || || || || || || || || || |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||| |||||| |||||| |||||| |||||| |||||| |||||| |||||| |||||| |||
| | | || | | || | | || | | || | | || | | || | | || | | || | | |
||| |||||| |||||| |||||| |||||| |||||| |||||| |||||| |||||| |||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| || || || || || || || || || || || || || || || || || || || || || || || || || || |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@bukzor
bukzor / gist:8738932
Last active February 22, 2022 18:49
Sierpinksi Triangle, in sed
# Sierpinksi Triangle, in sed:
$ f() { sed -r 'h;s/(.)/\1\1/g;x;s/(.)/\1 /g;H;x'; }
$ echo o|f
oo
o
$ echo o|f|f
oooo
# Cantor's dust, in sed
$ CMD='h;H;H;x;s/\n//g;h;s/./ /g;H;x;h;H;x;s/\n *$//' sh -c 'echo o | sed "$CMD"'
ooo
ooo
$ CMD='h;H;H;x;s/\n//g;h;s/./ /g;H;x;h;H;x;s/\n *$//' sh -c 'echo o | sed "$CMD" | sed "$CMD"'
ooooooooo
ooooooooo
@dergachev
dergachev / squid-deb-proxy_on_docker.md
Last active May 25, 2023 03:55
Caching debian package installation with docker

TLDR: I now add the following snippet to all my Dockerfiles:

# If host is running squid-deb-proxy on port 8000, populate /etc/apt/apt.conf.d/30proxy
# By default, squid-deb-proxy 403s unknown sources, so apt shouldn't proxy ppa.launchpad.net
RUN route -n | awk '/^0.0.0.0/ {print $2}' > /tmp/host_ip.txt
RUN echo "HEAD /" | nc `cat /tmp/host_ip.txt` 8000 | grep squid-deb-proxy \
  && (echo "Acquire::http::Proxy \"http://$(cat /tmp/host_ip.txt):8000\";" > /etc/apt/apt.conf.d/30proxy) \
  && (echo "Acquire::http::Proxy::ppa.launchpad.net DIRECT;" >> /etc/apt/apt.conf.d/30proxy) \
  || echo "No squid-deb-proxy detected on docker host"