Compare commits
No commits in common. "024565d0c2fa2f635010b722b66230160e24cb74" and "7abfa796cba42b535cb02b1049ecaf75cdd9c3c2" have entirely different histories.
024565d0c2
...
7abfa796cb
@ -1,275 +0,0 @@
|
|||||||
-- youtube-quality.lua
|
|
||||||
--
|
|
||||||
-- Change youtube video quality on the fly.
|
|
||||||
--
|
|
||||||
-- Diplays a menu that lets you switch to different ytdl-format settings while
|
|
||||||
-- you're in the middle of a video (just like you were using the web player).
|
|
||||||
--
|
|
||||||
-- Bound to ctrl-f by default.
|
|
||||||
|
|
||||||
local mp = require 'mp'
|
|
||||||
local utils = require 'mp.utils'
|
|
||||||
local msg = require 'mp.msg'
|
|
||||||
local assdraw = require 'mp.assdraw'
|
|
||||||
|
|
||||||
local opts = {
|
|
||||||
--key bindings
|
|
||||||
toggle_menu_binding = "ctrl+f",
|
|
||||||
up_binding = "UP",
|
|
||||||
down_binding = "DOWN",
|
|
||||||
select_binding = "ENTER",
|
|
||||||
|
|
||||||
--formatting / cursors
|
|
||||||
selected_and_active = "▶ - ",
|
|
||||||
selected_and_inactive = "● - ",
|
|
||||||
unselected_and_active = "▷ - ",
|
|
||||||
unselected_and_inactive = "○ - ",
|
|
||||||
|
|
||||||
--font size scales by window, if false requires larger font and padding sizes
|
|
||||||
scale_playlist_by_window=false,
|
|
||||||
|
|
||||||
--playlist ass style overrides inside curly brackets, \keyvalue is one field, extra \ for escape in lua
|
|
||||||
--example {\\fnUbuntu\\fs10\\b0\\bord1} equals: font=Ubuntu, size=10, bold=no, border=1
|
|
||||||
--read http://docs.aegisub.org/3.2/ASS_Tags/ for reference of tags
|
|
||||||
--undeclared tags will use default osd settings
|
|
||||||
--these styles will be used for the whole playlist. More specific styling will need to be hacked in
|
|
||||||
--
|
|
||||||
--(a monospaced font is recommended but not required)
|
|
||||||
style_ass_tags = "{\\fnmonospace}",
|
|
||||||
|
|
||||||
--paddings for top left corner
|
|
||||||
text_padding_x = 5,
|
|
||||||
text_padding_y = 5,
|
|
||||||
|
|
||||||
--other
|
|
||||||
menu_timeout = 10,
|
|
||||||
|
|
||||||
--use youtube-dl to fetch a list of available formats (overrides quality_strings)
|
|
||||||
fetch_formats = true,
|
|
||||||
|
|
||||||
--default menu entries
|
|
||||||
quality_strings=[[
|
|
||||||
[
|
|
||||||
{"4320p" : "bestvideo[height<=?4320p]+bestaudio/best"},
|
|
||||||
{"2160p" : "bestvideo[height<=?2160]+bestaudio/best"},
|
|
||||||
{"1440p" : "bestvideo[height<=?1440]+bestaudio/best"},
|
|
||||||
{"1080p" : "bestvideo[height<=?1080]+bestaudio/best"},
|
|
||||||
{"720p" : "bestvideo[height<=?720]+bestaudio/best"},
|
|
||||||
{"480p" : "bestvideo[height<=?480]+bestaudio/best"},
|
|
||||||
{"360p" : "bestvideo[height<=?360]+bestaudio/best"},
|
|
||||||
{"240p" : "bestvideo[height<=?240]+bestaudio/best"},
|
|
||||||
{"144p" : "bestvideo[height<=?144]+bestaudio/best"}
|
|
||||||
]
|
|
||||||
]],
|
|
||||||
}
|
|
||||||
(require 'mp.options').read_options(opts, "youtube-quality")
|
|
||||||
opts.quality_strings = utils.parse_json(opts.quality_strings)
|
|
||||||
|
|
||||||
local destroyer = nil
|
|
||||||
|
|
||||||
|
|
||||||
function show_menu()
|
|
||||||
local selected = 1
|
|
||||||
local active = 0
|
|
||||||
local current_ytdl_format = mp.get_property("ytdl-format")
|
|
||||||
msg.verbose("current ytdl-format: "..current_ytdl_format)
|
|
||||||
local num_options = 0
|
|
||||||
local options = {}
|
|
||||||
|
|
||||||
|
|
||||||
if opts.fetch_formats then
|
|
||||||
options, num_options = download_formats()
|
|
||||||
end
|
|
||||||
|
|
||||||
if next(options) == nil then
|
|
||||||
for i,v in ipairs(opts.quality_strings) do
|
|
||||||
num_options = num_options + 1
|
|
||||||
for k,v2 in pairs(v) do
|
|
||||||
options[i] = {label = k, format=v2}
|
|
||||||
if v2 == current_ytdl_format then
|
|
||||||
active = i
|
|
||||||
selected = active
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--set the cursor to the currently format
|
|
||||||
for i,v in ipairs(options) do
|
|
||||||
if v.format == current_ytdl_format then
|
|
||||||
active = i
|
|
||||||
selected = active
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function selected_move(amt)
|
|
||||||
selected = selected + amt
|
|
||||||
if selected < 1 then selected = num_options
|
|
||||||
elseif selected > num_options then selected = 1 end
|
|
||||||
timeout:kill()
|
|
||||||
timeout:resume()
|
|
||||||
draw_menu()
|
|
||||||
end
|
|
||||||
function choose_prefix(i)
|
|
||||||
if i == selected and i == active then return opts.selected_and_active
|
|
||||||
elseif i == selected then return opts.selected_and_inactive end
|
|
||||||
|
|
||||||
if i ~= selected and i == active then return opts.unselected_and_active
|
|
||||||
elseif i ~= selected then return opts.unselected_and_inactive end
|
|
||||||
return "> " --shouldn't get here.
|
|
||||||
end
|
|
||||||
|
|
||||||
function draw_menu()
|
|
||||||
local ass = assdraw.ass_new()
|
|
||||||
|
|
||||||
ass:pos(opts.text_padding_x, opts.text_padding_y)
|
|
||||||
ass:append(opts.style_ass_tags)
|
|
||||||
|
|
||||||
for i,v in ipairs(options) do
|
|
||||||
ass:append(choose_prefix(i)..v.label.."\\N")
|
|
||||||
end
|
|
||||||
|
|
||||||
local w, h = mp.get_osd_size()
|
|
||||||
if opts.scale_playlist_by_window then w,h = 0, 0 end
|
|
||||||
mp.set_osd_ass(w, h, ass.text)
|
|
||||||
end
|
|
||||||
|
|
||||||
function destroy()
|
|
||||||
timeout:kill()
|
|
||||||
mp.set_osd_ass(0,0,"")
|
|
||||||
mp.remove_key_binding("move_up")
|
|
||||||
mp.remove_key_binding("move_down")
|
|
||||||
mp.remove_key_binding("select")
|
|
||||||
mp.remove_key_binding("escape")
|
|
||||||
destroyer = nil
|
|
||||||
end
|
|
||||||
timeout = mp.add_periodic_timer(opts.menu_timeout, destroy)
|
|
||||||
destroyer = destroy
|
|
||||||
|
|
||||||
mp.add_forced_key_binding(opts.up_binding, "move_up", function() selected_move(-1) end, {repeatable=true})
|
|
||||||
mp.add_forced_key_binding(opts.down_binding, "move_down", function() selected_move(1) end, {repeatable=true})
|
|
||||||
mp.add_forced_key_binding(opts.select_binding, "select", function()
|
|
||||||
destroy()
|
|
||||||
mp.set_property("ytdl-format", options[selected].format)
|
|
||||||
reload_resume()
|
|
||||||
end)
|
|
||||||
mp.add_forced_key_binding(opts.toggle_menu_binding, "escape", destroy)
|
|
||||||
|
|
||||||
draw_menu()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local ytdl = {
|
|
||||||
path = "youtube-dl",
|
|
||||||
searched = false,
|
|
||||||
blacklisted = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
format_cache={}
|
|
||||||
function download_formats()
|
|
||||||
local function exec(args)
|
|
||||||
local ret = utils.subprocess({args = args})
|
|
||||||
return ret.status, ret.stdout, ret
|
|
||||||
end
|
|
||||||
|
|
||||||
local function table_size(t)
|
|
||||||
s = 0
|
|
||||||
for i,v in ipairs(t) do
|
|
||||||
s = s+1
|
|
||||||
end
|
|
||||||
return s
|
|
||||||
end
|
|
||||||
|
|
||||||
local url = mp.get_property("path")
|
|
||||||
|
|
||||||
url = string.gsub(url, "ytdl://", "") -- Strip possible ytdl:// prefix.
|
|
||||||
|
|
||||||
-- don't fetch the format list if we already have it
|
|
||||||
if format_cache[url] ~= nil then
|
|
||||||
local res = format_cache[url]
|
|
||||||
return res, table_size(res)
|
|
||||||
end
|
|
||||||
mp.osd_message("fetching available formats with youtube-dl...", 60)
|
|
||||||
|
|
||||||
if not (ytdl.searched) then
|
|
||||||
local ytdl_mcd = mp.find_config_file("youtube-dl")
|
|
||||||
if not (ytdl_mcd == nil) then
|
|
||||||
msg.verbose("found youtube-dl at: " .. ytdl_mcd)
|
|
||||||
ytdl.path = ytdl_mcd
|
|
||||||
end
|
|
||||||
ytdl.searched = true
|
|
||||||
end
|
|
||||||
|
|
||||||
local command = {ytdl.path, "--no-warnings", "--no-playlist", "-J"}
|
|
||||||
table.insert(command, url)
|
|
||||||
local es, json, result = exec(command)
|
|
||||||
|
|
||||||
if (es < 0) or (json == nil) or (json == "") then
|
|
||||||
mp.osd_message("fetching formats failed...", 1)
|
|
||||||
msg.error("failed to get format list: " .. err)
|
|
||||||
return {}, 0
|
|
||||||
end
|
|
||||||
|
|
||||||
local json, err = utils.parse_json(json)
|
|
||||||
|
|
||||||
if (json == nil) then
|
|
||||||
mp.osd_message("fetching formats failed...", 1)
|
|
||||||
msg.error("failed to parse JSON data: " .. err)
|
|
||||||
return {}, 0
|
|
||||||
end
|
|
||||||
|
|
||||||
res = {}
|
|
||||||
msg.verbose("youtube-dl succeeded!")
|
|
||||||
for i,v in ipairs(json.formats) do
|
|
||||||
if v.vcodec ~= "none" then
|
|
||||||
local fps = v.fps and v.fps.."fps" or ""
|
|
||||||
local resolution = string.format("%sx%s", v.width, v.height)
|
|
||||||
local l = string.format("%-9s %-5s (%-4s / %s)", resolution, fps, v.ext, v.vcodec)
|
|
||||||
local f = string.format("%s+bestaudio/best", v.format_id)
|
|
||||||
table.insert(res, {label=l, format=f, width=v.width })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
table.sort(res, function(a, b) return a.width > b.width end)
|
|
||||||
|
|
||||||
mp.osd_message("", 0)
|
|
||||||
format_cache[url] = res
|
|
||||||
return res, table_size(res)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- register script message to show menu
|
|
||||||
mp.register_script_message("toggle-quality-menu",
|
|
||||||
function()
|
|
||||||
if destroyer ~= nil then
|
|
||||||
destroyer()
|
|
||||||
else
|
|
||||||
show_menu()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- keybind to launch menu
|
|
||||||
mp.add_key_binding(opts.toggle_menu_binding, "quality-menu", show_menu)
|
|
||||||
|
|
||||||
-- special thanks to reload.lua (https://github.com/4e6/mpv-reload/)
|
|
||||||
function reload_resume()
|
|
||||||
local playlist_pos = mp.get_property_number("playlist-pos")
|
|
||||||
local reload_duration = mp.get_property_native("duration")
|
|
||||||
local time_pos = mp.get_property("time-pos")
|
|
||||||
|
|
||||||
mp.set_property_number("playlist-pos", playlist_pos)
|
|
||||||
|
|
||||||
-- Tries to determine live stream vs. pre-recordered VOD. VOD has non-zero
|
|
||||||
-- duration property. When reloading VOD, to keep the current time position
|
|
||||||
-- we should provide offset from the start. Stream doesn't have fixed start.
|
|
||||||
-- Decent choice would be to reload stream from it's current 'live' positon.
|
|
||||||
-- That's the reason we don't pass the offset when reloading streams.
|
|
||||||
if reload_duration and reload_duration > 0 then
|
|
||||||
local function seeker()
|
|
||||||
mp.commandv("seek", time_pos, "absolute")
|
|
||||||
mp.unregister_event(seeker)
|
|
||||||
end
|
|
||||||
mp.register_event("file-loaded", seeker)
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,10 +1,6 @@
|
|||||||
set tabstop=4 shiftwidth=4 noexpandtab relativenumber ai nu rnu nosmd ignorecase smartcase
|
set tabstop=4 shiftwidth=4 noexpandtab relativenumber ai nu rnu nosmd ignorecase smartcase
|
||||||
set lazyredraw nocursorline ttyfast
|
set lazyredraw nocursorline ttyfast
|
||||||
|
|
||||||
let maplocalleader = ","
|
|
||||||
|
|
||||||
set shell=/bin/sh
|
|
||||||
|
|
||||||
hi Search cterm=NONE ctermfg=white ctermbg=blue
|
hi Search cterm=NONE ctermfg=white ctermbg=blue
|
||||||
hi StatusLine ctermbg=NONE cterm=italic
|
hi StatusLine ctermbg=NONE cterm=italic
|
||||||
|
|
||||||
@ -69,41 +65,3 @@ nnoremap <silent> <c-p> :Step<cr>
|
|||||||
nnoremap <silent> <c-n> :Over<cr>
|
nnoremap <silent> <c-n> :Over<cr>
|
||||||
|
|
||||||
vnoremap <silent> K :'<,'>Evaluate<cr>
|
vnoremap <silent> K :'<,'>Evaluate<cr>
|
||||||
|
|
||||||
" Plugins
|
|
||||||
|
|
||||||
call plug#begin()
|
|
||||||
|
|
||||||
filetype plugin indent on
|
|
||||||
|
|
||||||
Plug 'lervag/vimtex'
|
|
||||||
let g:vimtex_view_method = 'zathura'
|
|
||||||
let g:vimtex_compiler_method = 'latexmk'
|
|
||||||
set conceallevel=0
|
|
||||||
let g:tex_conceal='abdmg'
|
|
||||||
let g:vimtex_view_forward_search_on_start=1
|
|
||||||
let g:vimtex_compiler_latexmk = {
|
|
||||||
\ 'build_dir' : $HOME.'/.cache/latexmk/',
|
|
||||||
\ 'callback' : 1,
|
|
||||||
\ 'continuous' : 1,
|
|
||||||
\ 'executable' : 'latexmk',
|
|
||||||
\ 'hooks' : [],
|
|
||||||
\ 'options' : [
|
|
||||||
\ '-verbose',
|
|
||||||
\ '-file-line-error',
|
|
||||||
\ '-synctex=1',
|
|
||||||
\ '-interaction=nonstopmode',
|
|
||||||
\ ],
|
|
||||||
\}
|
|
||||||
|
|
||||||
" Autowrite in tex files
|
|
||||||
" au TextChanged,TextChangedI *.tex silent write
|
|
||||||
|
|
||||||
|
|
||||||
Plug 'SirVer/ultisnips'
|
|
||||||
let g:UltiSnipsExpandTrigger="<c-m>"
|
|
||||||
let g:UltiSnipsJumpForwardTrigger="<c-m>"
|
|
||||||
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
|
|
||||||
let g:UltiSnipsSnippetDirectories=[$HOME.'/.config/nvim/ultisnips/']
|
|
||||||
|
|
||||||
call plug#end()
|
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
snippet shrug "shrug emoticon"
|
|
||||||
¯\_(ツ)_/¯
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet timestamp "unix time for today"
|
|
||||||
`date -d "$(date +"%Y-%m-%d 15:45")" +%s`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet today "normal formatted date for today" i
|
|
||||||
`date +"%Y-%m-%d"`
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet "pyscr (.*)" "python script" r
|
|
||||||
`!p
|
|
||||||
def ps():
|
|
||||||
"""
|
|
||||||
Returns int list parsed from VISUAL.
|
|
||||||
"""
|
|
||||||
return [int(i) for i in snip.v.text.split()]
|
|
||||||
|
|
||||||
def tl(a):
|
|
||||||
"""
|
|
||||||
Opposite of ps().
|
|
||||||
"""
|
|
||||||
return " ".join([str(i) for i in list(a)])
|
|
||||||
|
|
||||||
if not snip.c:
|
|
||||||
exec("snip.rv = " + match.group(1))
|
|
||||||
`
|
|
||||||
endsnippet
|
|
@ -1,377 +0,0 @@
|
|||||||
global !p
|
|
||||||
import json
|
|
||||||
|
|
||||||
def to_snip(s):
|
|
||||||
return '\n'.join([snip.mkline(i) for i in s.split('\n')])
|
|
||||||
|
|
||||||
def parse_graph(data):
|
|
||||||
"""Parses markup export from https://csacademy.com/app/graph_editor/.
|
|
||||||
|
|
||||||
It seems like they put JSON inside XML, but it's horrible unstandard format
|
|
||||||
The JSON isn't properly quoted
|
|
||||||
So this solution is hacky
|
|
||||||
"""
|
|
||||||
|
|
||||||
for rep in ["label", "center", "source", "target", "x", "y", "options", "fixed"]:
|
|
||||||
data = data.replace(f"{rep}:", f"\"{rep}\":")
|
|
||||||
|
|
||||||
for prop in data.split(' '):
|
|
||||||
prop = prop.rstrip('}')
|
|
||||||
|
|
||||||
if prop.startswith("nodes="):
|
|
||||||
prop = prop.lstrip("nodes={")
|
|
||||||
nodesData = json.loads(prop)
|
|
||||||
if prop.startswith("edges="):
|
|
||||||
prop = prop.lstrip("edges={")
|
|
||||||
edgeData = json.loads(prop)
|
|
||||||
|
|
||||||
return {"nodes": nodesData, "edges": edgeData}
|
|
||||||
|
|
||||||
def tikz_graph(data):
|
|
||||||
"""Given a dictionary graphically representing a graph, export it to Tikz
|
|
||||||
|
|
||||||
This takes the output from parse_graph().
|
|
||||||
|
|
||||||
Note that the IDs of edge source and destinations are based on the order of
|
|
||||||
nodes as they are given, not their labels.
|
|
||||||
|
|
||||||
Example dict::
|
|
||||||
{
|
|
||||||
"nodes": {
|
|
||||||
[
|
|
||||||
{
|
|
||||||
"label": "0",
|
|
||||||
"center": {"x": 0, "y": 0}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
"label": "1",
|
|
||||||
"center": {"x": 200, "y": 200}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
"edges": {
|
|
||||||
{
|
|
||||||
"label": "weight goes here",
|
|
||||||
"source": "0",
|
|
||||||
"target": "1",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
ret = ""
|
|
||||||
|
|
||||||
id_to_label = {}
|
|
||||||
|
|
||||||
for i, node in enumerate(data["nodes"]):
|
|
||||||
loc = f'({node["center"]["x"]}, {400-node["center"]["y"]})'
|
|
||||||
ret += f'\\node[vertex] ({node["label"]}) at {loc} \u007b{node["label"]}\u007d;\n'
|
|
||||||
id_to_label[i] = node["label"]
|
|
||||||
|
|
||||||
for edge in data["edges"]:
|
|
||||||
src = id_to_label[edge["source"]]
|
|
||||||
dest = id_to_label[edge["target"]]
|
|
||||||
|
|
||||||
ret += f'\draw[edge] ({src}) -> ({dest});\n'
|
|
||||||
if "label" in edge:
|
|
||||||
ret += f'\draw[edge] ({src}) -- node[midway, above, sloped, pos=0.5] \u007b{edge["label"]}\u007d ({dest});\n'
|
|
||||||
|
|
||||||
return ret.strip()
|
|
||||||
|
|
||||||
endglobal
|
|
||||||
|
|
||||||
snippet beg "begin{} / end{}" bi
|
|
||||||
\begin{$1}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
\end{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cent "center env" bi
|
|
||||||
\begin{center}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
\end{center}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sec "section" wi
|
|
||||||
\section{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ssec "subsection" wi
|
|
||||||
\subsection{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sssec "subsubsection" wi
|
|
||||||
\subsubsection{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet em "emphasis" wi
|
|
||||||
\emph{${1:${VISUAL}}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tab "table environment" bi
|
|
||||||
\begin{table}[tb]
|
|
||||||
\centering
|
|
||||||
\begin{tabular}{@{}$2@{}}
|
|
||||||
\toprule
|
|
||||||
$5 \\\\
|
|
||||||
\midrule
|
|
||||||
$0
|
|
||||||
\bottomrule
|
|
||||||
\end{tabular}
|
|
||||||
\caption{$3} \label{fig:$4}
|
|
||||||
\end{table}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet mcl "multicolumn" w
|
|
||||||
\multicolumn{$1}{c}{$3}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cmd "cmidrule" w
|
|
||||||
\cmidrule(lr){$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet items "itemize" bi
|
|
||||||
\begin{itemize}
|
|
||||||
$0
|
|
||||||
\end{itemize}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet enum "enumerate (ordered list)" bi
|
|
||||||
\begin{enumerate}
|
|
||||||
${0:${VISUAL/^/\\item /g}}
|
|
||||||
\end{enumerate}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet it "itemize row" bi
|
|
||||||
\\item ${0:${VISUAL}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet im "inline math" w
|
|
||||||
\\(${1:${VISUAL}}\\)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet eq "equation" bi
|
|
||||||
\begin{equation}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
\end{equation}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet equ "equation, unnumbered" bi
|
|
||||||
\begin{equation*}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
\end{equation*}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ali "align env for equations, unnumbered" bi
|
|
||||||
\begin{align*}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
\end{align*}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet alir "align env row for continuing equations" bi
|
|
||||||
& = ${1:${VISUAL}} \\\\
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rf "figure/table reference" w
|
|
||||||
\ref{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ar "figure/table auto reference" w
|
|
||||||
\autoref{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lab "reference label" w
|
|
||||||
\label{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet grph "parse graph data from https://csacademy.com/app/graph_editor/" bi
|
|
||||||
\begin{figure}[tb]
|
|
||||||
\centering
|
|
||||||
\begin{tikzpicture}[scale=0.045, thick]
|
|
||||||
\tikzset{edge/.style = {->,> = latex'}}
|
|
||||||
\tikzset{vertex/.style = {draw, circle}}
|
|
||||||
`!p
|
|
||||||
snip >> 2
|
|
||||||
snip.rv = to_snip(tikz_graph(parse_graph(snip.v.text)))
|
|
||||||
`
|
|
||||||
\end{tikzpicture}
|
|
||||||
\caption{${3:Sample case}} \label{fig:$2}
|
|
||||||
\end{figure}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nodes "generic nodes and edges tikz graph figure" bi
|
|
||||||
\begin{figure}[tb]
|
|
||||||
\centering
|
|
||||||
\begin{tikzpicture}[scale=1, thick]
|
|
||||||
\tikzset{edge/.style = {->,> = latex'}}
|
|
||||||
\tikzset{vertex/.style = {draw, circle}}
|
|
||||||
$0
|
|
||||||
\end{tikzpicture}
|
|
||||||
\caption{${3:Sample case}} \label{fig:$2}
|
|
||||||
\end{figure}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nod "draw a node" bi
|
|
||||||
\node[vertex] ($1) [$2] {$1};
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet edg "draw an edge" bi
|
|
||||||
\draw[edge] ($1) to[$3] ($2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet tik "generic tikz figure" bi
|
|
||||||
\begin{figure}[tb]
|
|
||||||
\centering
|
|
||||||
\begin{tikzpicture}[scale=0.3]
|
|
||||||
$0
|
|
||||||
\end{tikzpicture}
|
|
||||||
\caption{${3:Sample case}} \label{fig:$2}
|
|
||||||
\end{figure}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lst "source code listing" bi
|
|
||||||
\begin{lstlisting}
|
|
||||||
$1
|
|
||||||
\end{lstlisting}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet lstf "source code listing from file" bi
|
|
||||||
\lstinputlisting[]{src/`!p snip.rv = snip.basename`.cpp}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bigo "O() asymptotic time complexity"
|
|
||||||
\\(O($1)\\) $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet logn "O(log n) time complexity" i
|
|
||||||
\log n
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet nlogn "O(n log n) time complexity" i
|
|
||||||
n \log n
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet rec "tikz rectangle draw" bi
|
|
||||||
\draw[] ($1) rectangle ($2);
|
|
||||||
endsnippet
|
|
||||||
snippet pnt "tikz draw a point with coordinate label" bi
|
|
||||||
\node[label=below:{$($1)$}] at ($1) {\textbullet};
|
|
||||||
endsnippet
|
|
||||||
snippet line "tikz line" bi
|
|
||||||
\draw ($1) -- ($2);
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bca "begin cases" bi
|
|
||||||
\begin{cases}
|
|
||||||
${0:${VISUAL}}
|
|
||||||
\end{cases}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet car "case row" bi
|
|
||||||
$1 & \text{if } $0 \\\\
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet url "url hyperlink" w
|
|
||||||
\url{${0:${VISUAL}}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet bas "footnote" i
|
|
||||||
\footnote{${0:${VISUAL}}}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet shr "no indent macro" bi
|
|
||||||
\shortmacro $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sum "sigma sum" w
|
|
||||||
\sum_{$1}^{$2} $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet prod "pi product" w
|
|
||||||
\prod_{$1}^{$2} $0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet != "not equal" w
|
|
||||||
\neq
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet <= "less or equal" w
|
|
||||||
\le
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet >= "more or equal" w
|
|
||||||
\ge
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ran "range between" w
|
|
||||||
${3:1} \le $1 \le $2
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet * "multiply dot" w
|
|
||||||
\cdot
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet frac "Fraction" w
|
|
||||||
\frac{$1}{$2}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ov "over" w
|
|
||||||
\over
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet sc "small caps" w
|
|
||||||
\textsc{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet () "proper parentheses" i
|
|
||||||
\left(${1:${VISUAL}}\right)
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet [] "proper brackets" i
|
|
||||||
\left[${1:${VISUAL}}\right]
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet floor "floor" w
|
|
||||||
\left \lfloor $1 \right \rfloor
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ceil "ceil" w
|
|
||||||
\left \lceil $1 \right \rceil
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet __ "subscript" i
|
|
||||||
_{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet ss "superscript" i
|
|
||||||
^{$1}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet cub "cube" i
|
|
||||||
^{3}
|
|
||||||
endsnippet
|
|
||||||
snippet sqr "cube" i
|
|
||||||
^{2}
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet s_ "substack" i
|
|
||||||
\substack{$1}$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet root "tex root specification" bi
|
|
||||||
%!TEX root = ${1:master.tex}
|
|
||||||
$0
|
|
||||||
endsnippet
|
|
||||||
|
|
||||||
snippet master "template for notes" bi
|
|
||||||
\documentclass[fleqn, 12pt, a4paper]{article}
|
|
||||||
\input{$1../preamble.tex}
|
|
||||||
\title{$2}
|
|
||||||
|
|
||||||
\begin{document}
|
|
||||||
\maketitle
|
|
||||||
\tableofcontents
|
|
||||||
|
|
||||||
$0
|
|
||||||
\end{document}
|
|
||||||
endsnippet
|
|
@ -40,7 +40,7 @@ KP_{Insert,End,Down,Next,Left,Begin,Right,Home,Up,Prior}
|
|||||||
snd_id="{0-9}";\
|
snd_id="{0-9}";\
|
||||||
id=$(cat /dev/random | base32 | head -c 5);\
|
id=$(cat /dev/random | base32 | head -c 5);\
|
||||||
socket="$SB_DIR/cur/sb-socket$snd_id-$id";\
|
socket="$SB_DIR/cur/sb-socket$snd_id-$id";\
|
||||||
mpv --no-resume-playback --input-ipc-server=$socket $SB_DIR/cur/$snd_id*;\
|
mpv --input-ipc-server=$socket $SB_DIR/cur/$snd_id*;\
|
||||||
rm -f "$socket"
|
rm -f "$socket"
|
||||||
|
|
||||||
# stop specific sound
|
# stop specific sound
|
||||||
|
@ -32,10 +32,6 @@ then
|
|||||||
--exclude=BL_proxy \
|
--exclude=BL_proxy \
|
||||||
--exclude=a.out \
|
--exclude=a.out \
|
||||||
--exclude=dlcache \
|
--exclude=dlcache \
|
||||||
--exclude=.synctex.gz \
|
|
||||||
--exclude=.fls \
|
|
||||||
--exclude=.fdb_latexmk \
|
|
||||||
--exclude=.aux \
|
|
||||||
~/med ~/dox ~/.xonotic dogeystamp@lambda:/mnt/disk/uv/
|
~/med ~/dox ~/.xonotic dogeystamp@lambda:/mnt/disk/uv/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
# Screenshot and save to disk.
|
# Screenshot and save to disk.
|
||||||
|
|
||||||
sleep 0.1 && scrot -fs '/tmp/%F_%T_$wx$h.png' -e 'cp $f ~/med/screen/latest.png && mv $f ~/quar/'
|
sleep 0.1 && scrot -fs '/tmp/%F_%T_$wx$h.png' -e 'cp $f ~/med/screen/latest.png && mv $f ~/med/screen/'
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
# Run mpv on the output files of minrss
|
# Run mpv on the output files of minrss
|
||||||
|
|
||||||
mpvs $(extractlink.sh "$@")
|
mpvs $(for v in "$@"; do echo $(head -n 2 "${v}" | tail -n 1 | awk -F\" '{ print $2 }'); done)
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
# Append link from clipboard to mpv playlist
|
# Append link from clipboard to mpv playlist
|
||||||
|
|
||||||
path="$(xsel -b)"
|
path="$(xsel -b)"
|
||||||
echo "{ command: [ \"loadfile\", \"$path\", \"append-play\" ] }" | socat - $1
|
echo "{ command: [ \"loadfile\", \"$path\", \"append-play\" ] }" | socat - /tmp/mpv-socket
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Custom mpv settings
|
# Custom mpv settings
|
||||||
|
|
||||||
# passed to yt-dl
|
# passed to yt-dl
|
||||||
FORMAT=""
|
FORMAT="bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best"
|
||||||
|
|
||||||
mpv \
|
mpv \
|
||||||
--ytdl-format="$FORMAT" \
|
--ytdl-format="$FORMAT" \
|
||||||
|
@ -88,7 +88,7 @@ case "$ACTION" in
|
|||||||
|
|
||||||
imp "$ROOT/Documents/contacts.vcf" $DEST
|
imp "$ROOT/Documents/contacts.vcf" $DEST
|
||||||
imp "$ROOT/infbk/" $DEST
|
imp "$ROOT/infbk/" $DEST
|
||||||
impf_cp "$ROOT/.SeedVaultAndroidBackup/" $DEST/seedvault/ &
|
impf_cp "$ROOT/.SeedVaultAndroidBackup/" $DEST/seedvault/
|
||||||
;;
|
;;
|
||||||
|
|
||||||
HELP)
|
HELP)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user