Skip to content

Instantly share code, notes, and snippets.

View adamency's full-sized avatar

Benjamin Habié adamency

View GitHub Profile
@adamency
adamency / ssh_print_remote_history.template.sh
Last active February 3, 2025 04:19
Display History of Remote Machine through SSH
temp_hist_file="/tmp/remote-host.bash_history"
ssh <user>@<remote-host> -i <private_key_for_remote-host> "cat ~/.bash_history" > "$temp_hist_file"
(history -cr "$temp_hist_file" ; history)
#rm "$temp_hist_file"
# Original source: https://unix.stackexchange.com/a/316120
@adamency
adamency / shell
Last active January 15, 2025 23:11
Vim/Neovim Manpager Alias
alias vimman='vim +Man! -c "norm gO" -c "set nowrap" -c "%s/\v(-<\w>|--<\w+>)//n" -c "wincmd L" -c "vertical resize 60" -c "wincmd h"'
@adamency
adamency / Move Kubernetes Resource to other Namespace
Last active July 6, 2024 13:12
Move Kubernetes Resource from one namespace to another
kubectl get -n <old_namespace> <kind> <resource> -o json |\
jq '.metadata.namespace = "<new_namespace>"' |\
kubectl create -f - &&\
kubectl delete -n <old_namespace> <kind> <resource>
@adamency
adamency / checkkeys
Created November 6, 2023 09:30
CheckKeys: Pretty-Print Key Presses & Releases
#!/bin/bash
### DEPENDENCIES
# `rg`: https://github.com/BurntSushi/ripgrep/
# `awk`
# `xev`
# `--line-buffered` because ripgrep uses a block buffer in piped
# and so doesn't provide instant output by default when redirected
# after to stdout (related: https://unix.stackexchange.com/questions/200235/how-to-use-sed-to-manipulate-continuously-streaming-output)
@adamency
adamency / gourcevideo.sh
Last active October 13, 2023 16:48 — forked from Gnzlt/gourcevideo.sh
Gource video export command
#!/bin/bash
gource \
-1280x720 \
-c 4 \
--multi-sampling \
--stop-at-end \
--key \
--highlight-users \
--hide mouse,filenames \
@adamency
adamency / x_server_secondary_user.md
Last active January 3, 2023 03:27
Grant X server access to secondary user

Grant X server access to secondary user

These steps allows a secondary local user called <user> to use the local X server running on the machine that was launched by <main_user>. This will allow running graphical applications on a linux system (using X as the display server) from another user than the normal user.

User Values

  • <user>: user to be granted access
  • <main_user>: user that owns the X Server
+ create
Terraform will perform the following actions:
# azurerm_linux_web_app.REDACTED will be created
+ resource "azurerm_linux_web_app" "REDACTED" {
+ client_affinity_enabled = false
+ client_certificate_enabled = false
+ client_certificate_mode = "Required"
+ custom_domain_verification_id = (sensitive value)