tips and tricks for everything but emacs

Forum rules
Share your brain ;)
User avatar
wuxmedia
Grasshopper
Posts: 6445
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: tips and tricks for everything but emacs

Unread post by wuxmedia » Fri Apr 20, 2018 8:22 pm

http://www.hsluv.org/syntax/

for those that like random - yet well behaved vim syntax colours.
"Seek, and Ye shall find"
"Github | Chooons | Site"

User avatar
franksinistra
Ivana Fukalot
Posts: 1093
Joined: Mon Jan 27, 2014 2:03 am
Location: 印尼国

Re: tips and tricks for everything but emacs

Unread post by franksinistra » Tue May 08, 2018 8:02 pm

We finally ditched iptables and switched to nftables at work, neat!

For tips or tricks, for those of you who likes this kind of stuff can use sets (much like ipset) to simplify rules, for instance, a snippet:

Code: Select all

      set 
       set tcp_svc {
                type inet_service; flags interval;
                elements = {
                        ssh, domain, 443,
                        netbios-ssn, microsoft-ds,
                }
        }
        set udp_svc {
                type inet_service; flags interval;
                elements = {
                        domain,
                        60000-61000, #mosh
                }
        }
        chain service_checks {
                # accept established
                ct state {established, related} counter accept
                # drop invalid
                ct state invalid counter drop
        }
       chain input {
                 .......
                 tcp dport @tcp_svc accept
                 udp dport @udp_svc accept
       }


You could also use that to do something silly like blocking whole country for instance:

Code: Select all

    set blocked_country4 {
            type ipv4_addr; flags interval;
            element = { insert_Jiangsu_or_China_address_range_here }
     }
     set blocked_country6 {
              type ipv6_addr; flags interval;
              element = { insert_vietcongs_address_range_here }
     }
     chain input {
              ....
              ip saddr.@cblock_country4 counter packets 0 bytes 0 drop
      }


Which you can then further populate from ipdeny lists, using python or perl or shell scripts, or whatever floats your boat. Could do the same with fail2ban (new table for a cleaner management for instance).
rice no more.

bikerboy
Distrowatcher
Posts: 1
Joined: Sun Jul 07, 2019 5:07 pm

Re: tips and tricks for everything but emacs

Unread post by bikerboy » Sun Jul 07, 2019 8:43 pm

pidsley wrote:
Tue Feb 17, 2015 4:16 am
We have a T&T for emacs, so let's have one for everything else. Post the things you use in nano, vim, tmux, even cmus, moc, and anything else you can think of. What shortcut keys or configs work for you?

I already posted about using nano buffers to load more than one file at once here: http://linuxbbq.org/bbs/viewtopic.php?f ... 132#p37123

The things I use in vim every day:

Code: Select all

function! NuTriState()  " toggle through line-number modes
    if(&rnu)    " turn off line numbering
        set nonu
        set nornu
    elseif(&nu) " normal numbers on, add relative numbers (hybrid mode)
        set rnu
    else        " normal numbers off, turn them on
        set nu
    endif
endfunc

nnoremap <silent><F2> :call NuTriState()<cr>

" select lines in visual mode, ,ic adds # comments, ,rc removes
map ,ic :s/^/#/g<CR>:let @/ = ""<CR>
map ,rc :s/^#//g<CR>:let @/ = ""<CR>
And I use tmux all the time. I usually have two ratpoison windows open -- one for firefox, and the other for tmux. I use tmux like a CLI window manager. In tmux I usually have one multi-pane window for terminals, a second full window for weechat, and a third window for ssh to my nfs server. Assuming "P" means "prefix" (which I have defined as ctrl-A, but you may have as ctrl-B in a default tmux config, I use these sequences every day:

Code: Select all

P-z  : toggle pane full screen
P-!  : split pane into a new window
P-c  : create new window
P-<n>  : goto window <n>
Very basic.

You have probably also seen my tmux.conf, where I redefine the window split commands to the function keys. Nothing fancy like gutterslob or DJ's configs, but it works for me.

What interesting keybinds or configs do you use?

(thamks dkeg and gekkop for encouraging me to start this thread)
Thank you so much. Very helpful :)

RogerBen
Distrowatcher
Posts: 1
Joined: Thu Oct 03, 2019 8:31 am

Re: tips and tricks for everything but emacs

Unread post by RogerBen » Fri Oct 04, 2019 2:21 pm

Is the functionality basically the same between Gutterslob's configs and this one?

Post Reply