mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-04-25 00:19:11 +00:00
Add more YASnippets and update some scripts
This commit is contained in:
parent
d117f30281
commit
6ba3713bca
@ -16,6 +16,6 @@ selection=$(awk 'match($0, /([0-9A-F ]+)\s+; fully-qualified\s+# (\S+) E[[:digit
|
||||
| awk '{print $1}')
|
||||
|
||||
if [ -n "$selection" ]; then
|
||||
printf "$selection" | xclip -selection clipboard && notify-send "'$(xclip -o -selection clipboard)' has been copied to clipboard."
|
||||
printf "%s" "$selection" | xclip -selection clipboard && notify-send "'$(xclip -o -selection clipboard)' has been copied to clipboard."
|
||||
fi
|
||||
|
||||
|
@ -17,6 +17,6 @@
|
||||
|
||||
set -o pipefail
|
||||
|
||||
man -k . | rofi -dmenu -p 'Choose a manual' -theme fds-mini-sidebar -width 60 | awk '{print $1}' | xargs --no-run-if-empty $TERMINAL --command man
|
||||
man -k . | rofi -dmenu -p 'Choose a manual' -theme fds-mini-sidebar -width 60 | awk '{print $1}' | xargs --no-run-if-empty "$TERMINAL" --command man
|
||||
|
||||
|
||||
|
62
bin/extract
62
bin/extract
@ -2,55 +2,25 @@
|
||||
|
||||
# Extracts the archive.
|
||||
# The process can vary depending on the file extension.
|
||||
# Usage: $0 ARCHIVE_FILE
|
||||
|
||||
# Dependencies:
|
||||
# * xxd V1.10 27oct98 by Juergen Weigert
|
||||
# * UnZip 6.00 of 20 April 2009
|
||||
# * tar (GNU tar) 1.32
|
||||
# * printf (GNU coreutils 8.31)
|
||||
|
||||
function get_bytes() {
|
||||
local file=$1
|
||||
local length=${2:-20}
|
||||
|
||||
# Getting the file signature.
|
||||
# At most, we will just get the first 20 bytes of the file.
|
||||
local file_sig=$(xxd -l "$length" -ps "$file")
|
||||
printf "$file_sig"
|
||||
}
|
||||
|
||||
function extract_path_without_ext() {
|
||||
local path=$1
|
||||
|
||||
local filename=$(basename -- "$path")
|
||||
|
||||
# Return the filename without the file extension.
|
||||
# For more information, you can look up the parameter expansion in
|
||||
# https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html.
|
||||
# Even if the filename has no extension, it will print the whole filename.
|
||||
printf "${filename%.*}"
|
||||
}
|
||||
|
||||
function extract_file() {
|
||||
local file=$1
|
||||
local length=$2
|
||||
|
||||
# Checking the file signatures.
|
||||
# The reference is at https://en.wikipedia.org/wiki/List_of_file_signatures.
|
||||
local file_sig=$(get_bytes "$file" "$length")
|
||||
|
||||
# Extracting the extension out of the given file and creating a directory out of it.
|
||||
local file_without_ext=$(extract_path_without_ext "$file")
|
||||
mkdir -p "$file_without_ext"
|
||||
|
||||
# Checking if the file signature matches of a zip
|
||||
if [[ $(printf "$file_sig" | head -c 4) == "504b" ]]; then
|
||||
cd "$file_without_ext" && unzip "../$file"
|
||||
# Extract each given filename.
|
||||
for f in $@; do
|
||||
if [ -n "$(file "$f" | grep -i '7-zip archive data')" ]; then
|
||||
7z x "$f"
|
||||
elif [ -n "$(file "$f" | grep -i 'zip archive data')" ]; then
|
||||
unzip "$f"
|
||||
elif [ -n "$(file "$f" | grep -i 'POSIX tar archive')" ]; then
|
||||
tar --extract --file $f # or 'tar xf $f'
|
||||
elif [ -n "$(file "$f" | grep -i 'gzip compressed data')" ]; then
|
||||
tar --extract --gzip --file "$f" # or 'tar xzf $f'
|
||||
elif [ -n "$(file "$f" | grep -i 'bzip2 compressed data')" ]; then
|
||||
tar --extract --bzip2 --file "$f" # or 'tar xjf $f'
|
||||
elif [ -n "$(file "$f" | grep -i 'RAR archive data')" ]; then
|
||||
unrar x "$f"
|
||||
else
|
||||
tar xf "$file" --directory "$file_without_ext"
|
||||
echo "unrecognized format."
|
||||
fi
|
||||
}
|
||||
|
||||
extract_file $1
|
||||
|
||||
done
|
||||
|
2
bin/ocr
2
bin/ocr
@ -15,5 +15,5 @@
|
||||
set -o pipefail
|
||||
|
||||
notify-send "Select a region for the OCR"
|
||||
maim -s | tesseract - stdout
|
||||
maim --select --hidecursor | tesseract - stdout
|
||||
|
||||
|
@ -12,5 +12,5 @@
|
||||
set -o pipefail
|
||||
|
||||
notify-send "Select a region for the barcode (QR codes, ISBN, bar codes)"
|
||||
maim -s | zbarimg - --quiet | perl -pe 's|(.+?):||'
|
||||
maim --select --hidecursor | zbarimg - --quiet | perl -pe 's|(.+?):||'
|
||||
|
||||
|
@ -65,8 +65,11 @@
|
||||
(after! tex
|
||||
(TeX-engine-set "luatex")
|
||||
(add-to-list 'safe-local-variable-values
|
||||
'(TeX-command-extra-options . "-shell-escape"))
|
||||
)
|
||||
'(TeX-command-extra-options . "-shell-escape")))
|
||||
|
||||
; Disable indentation in org-mode (it's very spacey in my opinion).
|
||||
(add-hook! org-mode
|
||||
(setq org-indent-mode nil))
|
||||
|
||||
;;(use-package! ewal
|
||||
;; :init (setq ewal-json-file "~/.cache/wal/colors.json"
|
||||
|
@ -138,10 +138,16 @@
|
||||
;;nim ; python + lisp at the speed of c
|
||||
;;nix ; I hereby declare "nix geht mehr!"
|
||||
;;ocaml ; an objective camel
|
||||
org ; organize your plain life in plain text
|
||||
(org +brain
|
||||
+hugo
|
||||
+jupyter
|
||||
+noter
|
||||
+pandoc
|
||||
+present
|
||||
+roam) ; organize your plain life in plain text
|
||||
;;perl ; write code no one else can comprehend
|
||||
;;php ; perl's insecure younger brother
|
||||
;;plantuml ; diagrams for confusing people more
|
||||
plantuml ; diagrams for confusing people more
|
||||
;;purescript ; javascript, but functional
|
||||
python ; beautiful is better than ugly
|
||||
;;qt ; the 'cutest' gui framework ever
|
||||
|
@ -51,7 +51,5 @@
|
||||
;;;;;;;;;;;;
|
||||
; PACKAGES ;
|
||||
;;;;;;;;;;;;
|
||||
(package! org-brain)
|
||||
(package! modus-operandi-theme)
|
||||
(package! modus-vivendi-theme)
|
||||
;;(package! org-roam)
|
||||
|
72
emacs/snippets/latex-mode/template
Normal file
72
emacs/snippets/latex-mode/template
Normal file
@ -0,0 +1,72 @@
|
||||
\documentclass[class=memoir, crop=false, oneside, 14pt]{standalone}
|
||||
|
||||
% all of the packages to be used
|
||||
\usepackage[nocomments]{standalone}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{fontawesome}
|
||||
\usepackage[english]{babel}
|
||||
\usepackage[rgb]{xcolor}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amssymb}
|
||||
\usepackage{amsthm}
|
||||
\usepackage{tikz}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{fancyhdr}
|
||||
\usepackage{minted}
|
||||
\usepackage[most]{tcolorbox}
|
||||
\usepackage[colorlinks=true, linkcolor=., urlcolor=blue]{hyperref}
|
||||
\usepackage{kpfonts}
|
||||
|
||||
% using the fancy header package
|
||||
% http://linorg.usp.br/CTAN/macros/latex/contrib/fancyhdr/fancyhdr.pdf
|
||||
\pagestyle{fancy}
|
||||
|
||||
% fill the header with the format
|
||||
\fancyhead[L]{\doctitle}
|
||||
\fancyhead[R]{\nouppercase{\rightmark}}
|
||||
|
||||
% fill the footer with the format
|
||||
\fancyfoot[C]{\nouppercase{\leftmark}}
|
||||
\fancyfoot[R]{\thepage}
|
||||
|
||||
% set the width of the horizontal bars in the header
|
||||
\renewcommand{\headrulewidth}{2pt}
|
||||
\renewcommand{\footrulewidth}{1pt}
|
||||
|
||||
% set the paragraph formatting
|
||||
\renewcommand{\baselinestretch}{1.35}
|
||||
|
||||
% set chapter style
|
||||
\chapterstyle{bianchi}
|
||||
|
||||
% set chapter spacing for easier reading on digital screen
|
||||
\setlength{\beforechapskip}{-\beforechapskip}
|
||||
|
||||
% document metadata
|
||||
\author{${1:"Gabriel Arazas"}}
|
||||
\title{${2:"New Title"}}
|
||||
\date{`!p
|
||||
`}
|
||||
|
||||
\begin{document}
|
||||
% Frontmatter of the class note if it's compiled standalone
|
||||
\renewcommand{\abstractname}{Summary}
|
||||
\maketitle
|
||||
\newpage
|
||||
|
||||
\frontmatter
|
||||
\chapter{Preface}
|
||||
$3
|
||||
\newpage
|
||||
|
||||
\tableofcontents
|
||||
\newpage
|
||||
|
||||
\listoffigures
|
||||
\newpage
|
||||
|
||||
\mainmatter
|
||||
% Core content (HINT: always start with chapter LaTeX tag)
|
||||
|
||||
$0
|
||||
\end{document}
|
1
emacs/snippets/org-mode/.yas-parents
Normal file
1
emacs/snippets/org-mode/.yas-parents
Normal file
@ -0,0 +1 @@
|
||||
latex-mode
|
7
emacs/snippets/org-mode/block
Normal file
7
emacs/snippets/org-mode/block
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode dynamic blocks
|
||||
# key: block
|
||||
# --
|
||||
\#+BEGIN: ${1:<PARAMETERS>}
|
||||
$2
|
||||
\#+END:
|
5
emacs/snippets/org-mode/boldface
Normal file
5
emacs/snippets/org-mode/boldface
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode boldface
|
||||
# key: bf
|
||||
# --
|
||||
*$1* $0
|
5
emacs/snippets/org-mode/deflist
Normal file
5
emacs/snippets/org-mode/deflist
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode definition list
|
||||
# key: dl
|
||||
# --
|
||||
- ${1:<TERM>} :: ${2:<DEFINITION>}
|
8
emacs/snippets/org-mode/drawer
Normal file
8
emacs/snippets/org-mode/drawer
Normal file
@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode drawer
|
||||
# key: drawer
|
||||
# --
|
||||
:${1:<DRAWERNAME>}:
|
||||
$2
|
||||
:END:
|
||||
|
5
emacs/snippets/org-mode/footnote
Normal file
5
emacs/snippets/org-mode/footnote
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode footnotes
|
||||
# key: fn
|
||||
# --
|
||||
[fn:: $1]
|
5
emacs/snippets/org-mode/header
Normal file
5
emacs/snippets/org-mode/header
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode header
|
||||
# key: header
|
||||
# --
|
||||
`(make-string (read-number "WHAT IS THE NUMBER?: ") ?*)`
|
7
emacs/snippets/org-mode/img
Normal file
7
emacs/snippets/org-mode/img
Normal file
@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode image
|
||||
# key: img
|
||||
# --
|
||||
#+CAPTION: $1
|
||||
#+NAME: $2
|
||||
[[${3:<LINK>}]
|
5
emacs/snippets/org-mode/italics
Normal file
5
emacs/snippets/org-mode/italics
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode italics
|
||||
# key: it
|
||||
# --
|
||||
/$1/ $0
|
@ -2,4 +2,4 @@
|
||||
# name: Org-Mode link
|
||||
# key: link
|
||||
# --
|
||||
[[${1:URL}][${2:Description}]]
|
||||
[[${1:URL}][${2:Description}]
|
||||
|
5
emacs/snippets/org-mode/monospace
Normal file
5
emacs/snippets/org-mode/monospace
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode monospace
|
||||
# key: tt
|
||||
# --
|
||||
~$1~ $0
|
5
emacs/snippets/org-mode/subscript
Normal file
5
emacs/snippets/org-mode/subscript
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode subscript
|
||||
# key: ==
|
||||
# --
|
||||
_{$1} $0
|
5
emacs/snippets/org-mode/superscript
Normal file
5
emacs/snippets/org-mode/superscript
Normal file
@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Org-Mode superscript
|
||||
# key: --
|
||||
# --
|
||||
^{$1} $0
|
@ -29,3 +29,6 @@ export TERMINAL="alacritty"
|
||||
export BROWSER="firefox"
|
||||
export READ="zathura"
|
||||
export FILE="lf"
|
||||
|
||||
# This is a program that `sudo -a` needs for prompting the user and password.
|
||||
export SUDO_ASKPASS="$HOME/.local/bin/askpass"
|
||||
|
@ -1,6 +1,4 @@
|
||||
if [[ -f $HOME/.profile ]]; then
|
||||
source $HOME/.profile
|
||||
if [[ -f $ZDOTDIR/.profile ]]; then
|
||||
source $ZDOTDIR/.profile
|
||||
fi
|
||||
|
||||
# This is a program that `sudo -a` needs for prompting the user and password.
|
||||
export SUDO_ASKPASS="$HOME/bin/askpass"
|
||||
|
Loading…
Reference in New Issue
Block a user