Skip to content

Instantly share code, notes, and snippets.

@pabloasanchez
pabloasanchez / gcc-security.txt
Created November 14, 2024 06:54 — forked from jrelo/gcc-security.txt
GCC security related flags reference.
Source material:
http://security.stackexchange.com/questions/24444/what-is-the-most-hardened-set-of-options-for-gcc-compiling-c-c
https://wiki.gentoo.org/wiki/Hardened_Gentoo
https://wiki.debian.org/Hardening
================================================================================================================>
GCC Security related flags and options:
CFLAGS="-fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2"
LDFLAGS="-Wl,-z,now -Wl,-z,relro"
@pabloasanchez
pabloasanchez / hide-show-all-layers.py
Created November 11, 2024 11:08
hide-show-all-layers.py
#!/usr/bin/env python
# A simple plugin for hiding/showing all layers.
from gimpfu import *
def hide_show_all_layers(origin, hide):
layers = origin.layers
pdb.gimp_undo_push_group_start(origin)
@pabloasanchez
pabloasanchez / byobu-ssh-cheatsheet.md
Created May 29, 2024 07:13 — forked from PackeTsar/byobu-ssh-cheatsheet.md
Byobu (over SSH) Cheat Sheet

Byobu (over SSH) Cheat Sheet

I often find myself using Byobu on a Linux machine when connected to it over SSH. In doing so, I've noticed that many of the documented keyboard shortcuts don't work. This can be due to the native PC's OS intercepting certain keys, or possibly other reasons.

Below is a cheatsheet with Byobu features I have found usually work when run over a SSH connection.

Action Windows + Putty to Ubuntu MacOS + Terminal to Ubuntu
Help menu BASH: byobu-config FN-F1
Create new window CTRL-a c CTRL-a c or FN-F2
@pabloasanchez
pabloasanchez / nvim_open_win
Last active December 31, 2023 04:41
Neovim: Open buffer in a floating window
:lua vim.api.nvim_open_win(0, true, {relative='win', width=200, height=200, row=16, col=16})
@pabloasanchez
pabloasanchez / fish2bash
Last active October 13, 2023 19:44
Taking a few things from my fish cfg back to bash
# Taking a few things from my fish cfg back to bash: vi keys, branch name in prompt, custom prompt, completion (with fzf)
# Custom prompt
# Vi keys
# History
# Completion (Using fzf & fzf-tab-completion)
# Tip: Install bashmarks and fasd for faster directory browsing
# Custom prompt: Add to .bashrc
# Helps reset prompt when tty crashes
@pabloasanchez
pabloasanchez / to-netscape-bookmarks.sh
Created July 27, 2023 18:35
Generate a Netscape format Bookmarks.html from a file with a list of URLs
#!/usr/bin/env node
/*
Usage: ./to-netscape-bookmarks.sh urls | tee bookmarks.html
urls is a simple textfile with urls separated by breakline
Titles are pulled with pup tool
*/
const { exec } = require('child_process'), fs = require('fs'), readline = require('readline')
const file = process.argv[2]
@pabloasanchez
pabloasanchez / copy_layers.py
Created May 22, 2023 09:33
A simple GIMP plugin for copying layers.
#!/usr/bin/env python
# A simple plugin for copying layers.
# The layers can be copied in normal or reverse order,
# and can be placed at the top or bottom of the destination's layers,
# or above the selected layer in the destination.
from gimpfu import *
def copy_layers(origin, dest, order, position):
@pabloasanchez
pabloasanchez / gimp-script.py
Created May 22, 2023 08:24
GIMP Python plug-in template from gimpbook.com with additional notes
#!/usr/bin/env python
# GIMP Python plug-in template.
# To run the plugin, place it in .config/GIMP/plug-ins/PLUG_DIR/PLUG_NAME.py
# Where PLUG_DIR and PLUG_NAME are the name of your script e.g. myscript/myscript.py
# Note for AppImage version replace GIMP with GIMP-AppImage
# make the script executable (chmod +x myscript.py)
from gimpfu import *
@pabloasanchez
pabloasanchez / CycleReplace.vim
Last active March 1, 2021 17:07
Vimscript for replacing word under cursor from a provided list
" Call the function with the cursor under a word in normal mode.
" The word will be replaced with the next word of a provided list.
"
" For example, passing a list like this ['true', 'false', 'undefined', 'null']...
"
" // Example code
" let myBool = true
"
" ...and pressing CTRL+L over the word "true" will replace it with the next word on the list: That is, "false".
"
@pabloasanchez
pabloasanchez / Tab Context.sublime-menu
Last active December 21, 2020 23:20
Sublime Text 3 Plugin: Close all saved tabs
[
{ "caption": "-" },
{ "command": "close_saved", "caption": "Close Saved Files" }
]