Wednesday, December 13, 2023

how to copy from term without mouse

 on linux mint xfce for whatever reason its just not easy to ctrl c ctrl v in the term

I end up reaching for the mouse and i hate it.

although ive got set -o vi in my .bashrc for vim motions, the y only copies internally.

ctrl shift a selects the whole terminal which isnt what I want.

visual mode isnt working anyway.


My solution:

piping my commands into xclip.

making a bash alias for xclip so i dont need to type xclip=selection clipboard.

add this to your .bashrc:


# Alias to copy text to clipboard using xclip

alias c='xclip -selection clipboard'


    after that you can echo it into a thing and pipe it to c which is your alias

Tuesday, December 12, 2023

csv2table

I like this vscode extension by Michel SLAGMULDER.

    you press ctrl H ctrl T on some selected csv and it converts to and HTML table. (although the command isn't working for me on linux mint so i use the command palate instead ctrl shift p)


    arggg you know what sucks though? it doesn't escape  the characters inside double quotes. so you've got a date like "sept, 11, 1905" it thinks you have 3 columns. SOO ANNNOYING. (I was wondering why the default delimiter was set to semi-colon instead of comma.)

gotta do a find and replace with a regex. heres the pattern I use to match:

,(?=(?:[^"]*"[^"]*")*[^"]*$)

open vscode live server = alt L O

format HTML = ctrl shift i 

bootstrap has dark mode add this to the head: data-bs-theme="dark"

<html lang="en" data-bs-theme="dark">

     basic table css styling:

table, th, td {
  border: 1px solid;
}

    Striped tables:

<style>
table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {background-color: #f2f2f2;}
</style> 



Saturday, December 9, 2023

how to make beorg not suck

what a hassle!

heres what it looks like once you get it going. ( gruvbox inspired) >>

screen shot of dark theme

  • i bought the dark theme export it did nothing. 99 cents wasted
  • i bought the dark theme it did nothing. 3.99 wasted!
  • somehow in canada that's probably gonna be 8 bucks with taxes and extra nonsense fees.

whatever... im committed now to figuring this out. its kind of neat that they have some
kind if repl witha elisp type thing but i was hoping to not spend my afternoon digging the docs. but i needed that dark mode.

on closer inspection dark theme isnt necessary after ios 13 implemented dark mode. the iap is a better dark mode dim grey lower contrast but still did't effext export at all! which was what i wanted it for arggg.

it says you can use your own css. they dont make it easy though. there isn't any quick menu selection. you have to read the docs to use "scheme" sort of like lisp.

** note **
if you want my roboto mono font to work on ios you need to download the app fontcase roboto mono dl link @ cufonts

the steps:

  • create org file called init
  • add this:
#+BEGIN_SRC scheme
(load-themes "groovy black")
#+END_SRC
  • create org file called groovy black
  • add this:
* groovy black
im pissed i had to make my own dark theme

#+begin_src css
@include "beorg default theme";

body { background-color: #2c2c2c;
   font-family: Roboto Mono;
       color: #8f8f8f;
}
a { color: darkseagreen;
}
h1, h2, h3, h4, h5, h6 { color: orange;
}
ul, ol {
  color: white ;
}
#+end_src

how to fix alt key in terminal so it actually alts

in kitty.conf add this.

 macos_option_as_alt left

in default mac terminal go to
preferences > profile > keyboard > checkbox "use option as meta key"

Friday, December 8, 2023

how to resize an image from terminal

    don't you hate it when you upload a picture and when you go to post realize the picture is HUUUUUUUGe. its great that these modern phones have all those pixels but it sucks when your trying to do a quick edit in ms paint.

trying to throw some quick text on there and you gotta zoom all the way out and find the corner of the screen and drag it all down. peeved.

but don't worry there's a better way.

IMAGEMAGICK

the imagemagick command in this case is convert (just like how sox has a bunch of commands other than sox like synth, play, rec). by giving only one input for the dimensions in the argument it conveniently maintains the aspect ration scaling it down nicely.

convert image.png -resize 300 image_resized.png

how to fix syncthing "folder marker missing"

syncthing creates an invisible file called .stfolder if it cant find it you get this error and sync thing wont start!!! its really easy to accidentally not copy it if you delete a folder and start from scratch so just make a new folder and name it that and you should be all good!

gotcha: keyboard shortcut for vim

Setting a keyboard shortcut for launching apps on linux mint 2 ways.

- vim .xbindkeyrc

- start>settings>keyboard>application shortcuts

was wondering why just having path to vim wasn't working

it needs to be run as a terminal command.

THE FIX: >>

xfce4-terminal -e 'vim'

whats the -e flag?

 it specifies that its to be run as a terminal command.

Thursday, December 7, 2023

how to paste in vim without leaving insert mode

         - press ctrl + r + 0 ( zero )

that lets you enter normal mode for a command and paste from the zero register which usually is the system clipboard. 

but in general you want CTRL o ( control o) 

- that lets you step breiefly into normal mode for a single command before returning you back into insert mode.

How to launch apps like finder on mac but on linux



        So on linux mint xfce you can get twister os to look like mac..

but my biggest gripe is it comes with a thing that looks like spotlight search

but instead its docked in the corner and you have to click on it to use it.


cmd space doesn't work! thats what it should be!! its so awkward

I don't want to use the mouse it gives me carpel tunnel!!



        One thing that the tiling window manager i3 gaps got right is rofi. (okay well it comes with dmenu but following some tutorial that's where i first saw a use for rofi)

cmd d (or was it control d? whatever doesnt matter) is gold!!!!!



THE STEPS:

- on linux mint, click top right start menu icon.

- settings>keyboard>Application shortcuts>Add.

- rofi -show run 

- set it to super space

and there ya go. 

now you have a nice app launcher.

Tuesday, December 5, 2023

how to open html in browser (doom emacs)

 Space o b

on mac meta x isnt working?

do space : (colon) and type open browser

vim nerdtree show hidden files

Press I and they show up.

dot files are hidden by default in nerdtree.

in lf . (period shows them)

some bash rc settings for emacs client on i3

 # start emacs daemon if not already running
if [ -z "$(pgrep -u $USER emacs)" ]; then
/usr/bin/emacs --daemon
fi
# DOOM EMACS
export PATH="$HOME/.emacs.d/bin:$PATH"
# Emacs Client
alias emacs='emacsclient -c -a 'emacs''

 

-----------------

 this helps with the load times

Monday, December 4, 2023

fixing doom emacs not opening exported org in firefox

so you wrote some text in doom emacs

space m + e to export,  ctrl + b for body only

h + o for html export and open but it doesnt open? 

WHY!!! emacs doesnt know how to open the browser

== how to fix ==

on linux mint edit:

mint/.config/doom/config.el

then add this:

;; SET BROWSER TO OPEN WITH FIREFOX --THIS IS YOUR CUSTOM THING YOU ADDED --
(after! org
  (setq org-file-apps
        '((auto-mode . emacs)
          ("\\.mm\\'" . default)
          ("\\.x?html?\\'" . "/usr/bin/firefox %s")
          ("\\.pdf\\'" . default))))

 

Sunday, December 3, 2023

lf_kitty_preview

#!/usr/bin/env bash file=$1 w=$2 h=$3 x=$4 y=$5 preview() { kitty +kitten icat --silent --stdin no --transfer-mode file --place "${w}x${h}@${x}x${y}" "$1" < /dev/null > /dev/tty } TEMPDIR=/home/mint/.cache file="$1"; shift case "$(basename "$file" | tr '[A-Z]' '[a-z]')" in *.tar*) tar tf "$file" ;; *.zip) unzip -l "$file" ;; *.rar) unrar l "$file" ;; *.7z) 7z l "$file" ;; *.avi|*.mp4|*.mkv) thumbnail="$TEMPDIR/thumbnail.png" ffmpeg -y -i "$file" -vframes 1 "$thumbnail" preview "$thumbnail" ;; *.pdf) thumbnail="$TEMPDIR/thumbnail.png" gs -o "$thumbnail" -sDEVICE=pngalpha -dLastPage=1 "$file" >/dev/null preview "$thumbnail" ;; *.jpg|*.jpeg|*.png|*.bmp) preview "$file" ;; *.ttf|*.otf|*.woff) thumbnail="$TEMPDIR/thumbnail.png" fontpreview -i "$file" -o "$thumbnail" preview "$thumbnail" ;; *.svg) thumbnail="$TEMPDIR/thumbnail.png" convert "$file" "$thumbnail" preview "$thumbnail" ;; *) lf_bat_preview "$file" ;; esac return 127 # nonzero retcode required for lf previews to reload

Saturday, December 2, 2023

LF config

set previewer ~/.config/lf/lf_kitty_preview set cleaner ~/.config/lf/lf_kitty_clean # Basic Settings set hidden false set ignorecase true set icons true # Custom Functions cmd mkdir ${{ printf "Directory Name: " read ans mkdir $ans }} cmd mkfile ${{ printf "File Name: " read ans $EDITOR $ans }} cmd setwallpaper ${{ setwallpaper "$f" }} # Archive bindings cmd unarchive ${{ case "$f" in *.zip) unzip "$f" ;; *.tar.gz) tar -xzvf "$f" ;; *.tar.bz2) tar -xjvf "$f" ;; *.tar) tar -xvf "$f" ;; *) echo "Unsupported format" ;; esac }} # Trash bindings cmd trash ${{ files=$(printf "$fx" | tr '\n' ';') while [ "$files" ]; do file=${files%%;*} trash-put "$(basename "$file")" if [ "$files" = "$file" ]; then files='' else files="${files#*;}" fi done }} cmd restore_trash ${{ trash-restore }} # Bindings map d map m map c $vim "$f" map au unarchive map ae $wine "$f" # Basic Functions map . set hidden! map dd trash map dr restore_trash map p paste map x cut map y copy map open map R reload map mf mkfile map md mkdir map bg setwallpaper map C clear # Movement map gD cd ~/Documents map gd cd ~/Downloads map gp cd ~/Pictures map gc cd ~/.config map gh cd ~/Desktop map gr cd ~/repos map gv cd ~/Videos map gs cd ~/.local/bin map gt cd ~/.local/share/Trash/files #file openers filetype ^pdf,PDF$ zathura filetype ^epub,EPUB$ calibre ebook-viewer q

xbindkeysrc

my kebinds for linux mint on a mac extended keyboard ############################################# "/home/mint/Documents/bashscripts/codepen.sh" Alt + m:0x0 + c:191 "/home/mint/Documents/bashscripts/blog.sh" Control + m:0x0 + c:191 "/home/mint/Documents/bashscripts/blogedit.sh" Shift + m:0x0 + c:191 # 13, 14, 15 "firefox" m:0x0 + c:191 "kitty" m:0x0 + c:192 "subl" m:0x0 + c:193 #16, 17, 18, 19 "mousepad" m:0x0 + c:194 "kolourpaint" m:0x0 + c:195 "/home/mint/Documents/bashscripts/youtube.sh" m:0x0 + c:196 "/home/mint/Documents/bashscripts/chatgpt.sh" m:0x0 + c:197 "scrot '/home/mint/Pictures/screenshots/%Y-%m-%d_%H-%M-%S.png' -s" Control + Shift + 4

^^^COPY PASTE BLOCK SNIPPET^^^

my I3-gaps gruvbox dark theme config


set $bg #282828
set $red #cc241d
set $green #98971a
set $yellow #d79921
set $blue #458588
set $purple #b16286
set $aqua #689d68
set $gray #a89984
set $darkgray #1d2021
set $lightgray #bdae93

bar {
    position bottom
    status_command i3blocks
    colors {
        # bar background color
        background $bg
        # text color used for blocks that do not have a color specified.
        statusline $lightgray
        # workspaces section            
        #                    border  backgr. text
        focused_workspace    $lightgray $lightgray $bg
        inactive_workspace   $darkgray $darkgray $lightgray
        active_workspace     $darkgray $darkgray $lightgray
        urgent_workspace     $red $red $bg
    }
}

# class                 border|backgr|text|indicator|child_border
client.focused          $lightgray $lightgray $bg $purple $darkgray
client.focused_inactive $darkgray $darkgray $lightgray $purple $darkgray
client.unfocused        $darkgray $darkgray $lightgray $purple $darkgray
client.urgent           $red $red $white $red $red

# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#

# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!

set $mod Mod4

# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 12

# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8

# Start XDG autostart .desktop files using dex. See also
# https://wiki.archlinux.org/index.php/XDG_Autostart
exec --no-startup-id dex --autostart --environment i3

# The combination of xss-lock, nm-applet and pactl is a popular choice, so
# they are included here as an example. Modify as you see fit.

# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
# screen before suspend. Use loginctl lock-session to lock your screen.
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork

# NetworkManager is the most popular way to manage wireless networks on Linux,
# and nm-applet is a desktop environment-independent system tray GUI for it.
exec --no-startup-id nm-applet

# Use pactl to adjust volume in PulseAudio.
set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status

# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod

# start a terminal
# i3-sensiblw-terminal is the default
#bindsym $mod+Return exec i3-sensible-terminal
#bindsym $mod+Return exec alacritty
bindsym $mod+Return exec kitty

# kill focused window
bindsym $mod+Shift+q kill

# start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id rofi -show drun -width 400 -lines 5 
# A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
# There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed.
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop

# change focus
bindsym $mod+j focus left
bindsym $mod+k focus down
bindsym $mod+l focus up
bindsym $mod+semicolon focus right

# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# move focused window
bindsym $mod+Shift+j move left
bindsym $mod+Shift+k move down
bindsym $mod+Shift+l move up
bindsym $mod+Shift+semicolon move right

# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right

# split in horizontal orientation
bindsym $mod+h split h

# split in vertical orientation
bindsym $mod+v split v

# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle

# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split

# toggle tiling / floating
bindsym $mod+Shift+space floating toggle

# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle

# focus the parent container
bindsym $mod+a focus parent

# focus the child container
#bindsym $mod+d focus child

# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1"
set $ws2 "2"
set $ws3 "3"
set $ws4 "4"
set $ws5 "5"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"

# switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
bindsym $mod+3 workspace number $ws3
bindsym $mod+4 workspace number $ws4
bindsym $mod+5 workspace number $ws5
bindsym $mod+6 workspace number $ws6
bindsym $mod+7 workspace number $ws7
bindsym $mod+8 workspace number $ws8
bindsym $mod+9 workspace number $ws9
bindsym $mod+0 workspace number $ws10

# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $ws1
bindsym $mod+Shift+2 move container to workspace number $ws2
bindsym $mod+Shift+3 move container to workspace number $ws3
bindsym $mod+Shift+4 move container to workspace number $ws4
bindsym $mod+Shift+5 move container to workspace number $ws5
bindsym $mod+Shift+6 move container to workspace number $ws6
bindsym $mod+Shift+7 move container to workspace number $ws7
bindsym $mod+Shift+8 move container to workspace number $ws8
bindsym $mod+Shift+9 move container to workspace number $ws9
bindsym $mod+Shift+0 move container to workspace number $ws10

# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"

# resize window (you can also use the mouse for that)
mode "resize" {
        # These bindings trigger as soon as you enter the resize mode

        # Pressing left will shrink the window’s width.
        # Pressing right will grow the window’s width.
        # Pressing up will shrink the window’s height.
        # Pressing down will grow the window’s height.
        bindsym j resize shrink width 10 px or 10 ppt
        bindsym k resize grow height 10 px or 10 ppt
        bindsym l resize shrink height 10 px or 10 ppt
        bindsym semicolon resize grow width 10 px or 10 ppt

        # same bindings, but for the arrow keys
        bindsym Left resize shrink width 10 px or 10 ppt
        bindsym Down resize grow height 10 px or 10 ppt
        bindsym Up resize shrink height 10 px or 10 ppt
        bindsym Right resize grow width 10 px or 10 ppt

        # back to normal: Enter or Escape or $mod+r
        bindsym Return mode "default"
        bindsym Escape mode "default"
        bindsym $mod+r mode "default"
}

bindsym $mod+r mode "resize"

# Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available)
#bar {
#        status_command i3status
#}

kitty.conf

background #1f1c27 foreground #b6a0ff cursor #ff9738 selection_background #353146 color0 #1f1c27 color8 #353146 color1 #d8393d color9 #d8393d color2 #2dcc72 color10 #2dcc72 color3 #d8b76e color11 #d8b76e color4 #ffc183 color12 #ffc183 color5 #dd8d40 color13 #dd8d40 color6 #2388ff color14 #2388ff color7 #b6a0ff color15 #e9e4ff selection_foreground #1f1c27 enable_audio_bell no #font_family DejaVuSansM Nerd Font Mono Regular #font_family FiraMono Nerd Font Mono #font_family Hack Nerd Font Mono Regular #font_family RobotoMono Nerd Font Mono #font_family DroidSansM Nerd Font Mono #font_family Menlo Regular #font_family BitstromWera Nerd Font Mono font_family SF Mono font_size 16 enable_audio_bell no # Enable mouse map mouse {override,click} enable=1 # Enable copy-on-select map ctrl+shift+v paste_from_selection

how to sleep mac from terminal

how to sleep mac from terminalsleep

redoing my shortcuts.
Previously had pause/break r corner key to sleep.
but that real estate is too valuable.
doesnt need to be THAT easy to get to.
so gonna go with shift to access instead.
freeing up that hot spot.
for my HOT key. 🥵

what do i want instead?

  • terminal? no ctrl alt t does that

i switched my terminal to kitty because it can preview images in the LF file manger. so i need to remap.

previously: karabiner is what i used to trigger the shortcut. there was one online that worked. BUT, i just figured out how to edit the json myself so i dont need to rely on hoping and wishing for somebody to make my keyboard templates for me.

  • that also means I dont need to use the shortcuts app potentially! it could be done all in karabiner maybe.
  • i was doing some of the shortcuts in one and some in the other this simplifies things alot knowing i no longer need to do that. the way i came up with using the shortcuts app was just some work around i came up with.
  • think il put chat gpt on that button