Added programs

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2021-03-22 21:27:54 +01:00
parent c1c92fc336
commit b82dc58f26
Signed by: y0rune
GPG Key ID: F204C385F57EB348
124 changed files with 18079 additions and 0 deletions

248
.config/dunst/dunstrc Normal file
View File

@ -0,0 +1,248 @@
[global]
font = Mono 16
# Allow a small subset of html markup:
# <b>bold</b>
# <i>italic</i>
# <s>strikethrough</s>
# <u>underline</u>
#
# For a complete reference see
# <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
# If markup is not allowed, those tags will be stripped out of the
# message.
allow_markup = yes
# The format of the message. Possible variables are:
# %a appname
# %s summary
# %b body
# %i iconname (including its path)
# %I iconname (without its path)
# %p progress value if set ([ 0%] to [100%]) or nothing
# Markup is allowed
format = "<b>%s</b>\n%b"
# Sort messages by urgency.
sort = no #yes
# Show how many messages are currently hidden (because of geometry).
indicate_hidden = no
# Alignment of message text.
# Possible values are "left", "center" and "right".
alignment = left
# The frequency with which text that is longer than the notification
# window allows bounces back and forth.
# This option conflicts with "word_wrap".
# Set to 0 to disable.
bounce_freq = 0
# Show age of message if message is older than show_age_threshold
# seconds.
# Set to -1 to disable.
show_age_threshold = -1 #60
# Split notifications into multiple lines if they don't fit into
# geometry.
word_wrap = yes
# Ignore newlines '\n' in notifications.
ignore_newline = no
# The geometry of the window:
# [{width}]x{height}[+/-{x}+/-{y}]
# The geometry of the message window.
# The height is measured in number of notifications everything else
# in pixels. If the width is omitted but the height is given
# ("-geometry x2"), the message window expands over the whole screen
# (dmenu-like). If width is 0, the window expands to the longest
# message displayed. A positive x is measured from the left, a
# negative from the right side of the screen. Y is measured from
# the top and down respectively.
# The width can be negative. In this case the actual width is the
# screen width minus the width defined in within the geometry option.
geometry = "400x10-40+30"
# Shrink window if it's smaller than the width. Will be ignored if
# width is 0.
shrink = no
# The transparency of the window. Range: [0; 100].
# This option will only work if a compositing window manager is
# present (e.g. xcompmgr, compiz, etc.).
transparency = 0
# Don't remove messages, if the user is idle (no mouse or keyboard input)
# for longer than idle_threshold seconds.
# Set to 0 to disable.
idle_threshold = 120
# Which monitor should the notifications be displayed on.
monitor = 0
# Display notification on focused monitor. Possible modes are:
# mouse: follow mouse pointer
# keyboard: follow window with keyboard focus
# none: don't follow anything
#
# "keyboard" needs a window manager that exports the
# _NET_ACTIVE_WINDOW property.
# This should be the case for almost all modern window managers.
#
# If this option is set to mouse or keyboard, the monitor option
# will be ignored.
follow = mouse
# Should a notification popped up from history be sticky or timeout
# as if it would normally do.
sticky_history = no # yes
# Maximum amount of notifications kept in history
history_length = 20
# Display indicators for URLs (U) and actions (A).
show_indicators = no
# The height of a single line. If the height is smaller than the
# font height, it will get raised to the font height.
# This adds empty space above and under the text.
line_height = 0
# Draw a line of "separator_height" pixel height between two
# notifications.
# Set to 0 to disable.
separator_height = 2
# Padding between text and separator.
padding = 8
# Horizontal padding.
horizontal_padding = 8
# Define a color for the separator.
# possible values are:
# * auto: dunst tries to find a color fitting to the background;
# * foreground: use the same color as the foreground;
# * frame: use the same color as the frame;
# * anything else will be interpreted as a X color.
separator_color = frame
# Print a notification on startup.
# This is mainly for error detection, since dbus (re-)starts dunst
# automatically after a crash.
startup_notification = false
# dmenu path.
dmenu = /usr/bin/dmenu -p dunst:
# Browser for opening urls in context menu.
browser = /usr/bin/firefox -new-tab
# Align icons left/right/off
icon_position = off
# Paths to default icons.
icon_folders = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
[frame]
width = 1
color = "#424242"
[shortcuts]
# Shortcuts are specified as [modifier+][modifier+]...key
# Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
# "mod3" and "mod4" (windows-key).
# Xev might be helpful to find names for keys.
# Close notification.
close = ctrl+space
# Close all notifications.
close_all = ctrl+shift+space
# Redisplay last message(s).
# On the US keyboard layout "grave" is normally above TAB and left
# of "1".
history = ctrl+grave
# Context menu.
context = ctrl+shift+period
[urgency_low]
# IMPORTANT: colors have to be defined in quotation marks.
# Otherwise the "#" and following would be interpreted as a comment.
background = "#222222"
#foreground = ${xrdb:color6}
foreground = "#dfdfdf"
timeout = 5
[urgency_normal]
background = "#222222"
#foreground = "${xrdb:color6}
foreground = "#dfdfdf"
timeout = 5
[urgency_critical]
background = "#222222"
#foreground = ${xrdb:color6}
foreground = "#dfdfdf"
timeout = 5
# Every section that isn't one of the above is interpreted as a rules to
# override settings for certain messages.
# Messages can be matched by "appname", "summary", "body", "icon", "category",
# "msg_urgency" and you can override the "timeout", "urgency", "foreground",
# "background", "new_icon" and "format".
# Shell-like globbing will get expanded.
#
# SCRIPTING
# You can specify a script that gets run when the rule matches by
# setting the "script" option.
# The script will be called as follows:
# script appname summary body icon urgency
# where urgency can be "LOW", "NORMAL" or "CRITICAL".
#
# NOTE: if you don't want a notification to be displayed, set the format
# to "".
# NOTE: It might be helpful to run dunst -print in a terminal in order
# to find fitting options for rules.
#[espeak]
# summary = "*"
# script = dunst_espeak.sh
#[script-test]
# summary = "*script*"
# script = dunst_test.sh
#[ignore]
# # This notification will not be displayed
# summary = "foobar"
# format = ""
#[signed_on]
# appname = Pidgin
# summary = "*signed on*"
# urgency = low
#
#[signed_off]
# appname = Pidgin
# summary = *signed off*
# urgency = low
#
#[says]
# appname = Pidgin
# summary = *says*
# urgency = critical
#
#[twitter]
# appname = Pidgin
# summary = *twitter.com*
# urgency = normal
#
# vim: ft=cfg

37
.config/iptables Executable file
View File

@ -0,0 +1,37 @@
# CONFIGURATION:
# Accept on localhost
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# Accept outgoing network
iptables -A OUTPUT -o eth0 -j ACCEPT
# Allow established sessions to receive traffic
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW,ESTABLISHED -j ACCEPT
# Enable SSH (to internet)
#iptables -A OUTPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
#iptables -A OUTPUT -p tcp -m state --state NEW -m tcp --dport 10571 -j ACCEPT
# Disable SSH (to that machine)
iptables -A INPUT -p tcp -m state --state NEW -m tcp -s 192.168.0.0/24 --sport 22 -j DROP
iptables -A INPUT -p tcp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 22 -j DROP
# Enable INZ
#iptables -A INPUT -p tcp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 1285 -j ACCEPT
#iptables -A INPUT -p tcp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 3000 -j ACCEPT
#iptables -A INPUT -p tcp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 8080 -j ACCEPT
#Enable CSGO
iptables -A INPUT -p tcp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 27015 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 27020 -j ACCEPT
iptables -A INPUT -p udp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 27015 -j ACCEPT
iptables -A INPUT -p udp -m state --state NEW -m tcp -s 192.168.0.0/24 --dport 27020 -j ACCEPT
iptables -A INPUT -i eth0 -m state --state NEW,INVALID -j DROP
iptables -A FORWARD -i eth0 -m state --state NEW,INVALID -j DROP
# END OF CONFIG
# END CONFIGURATION:
# END OF CONFIGURATION

View File

@ -0,0 +1,8 @@
[lutris]
library_ignores =
migration_version = 10
width = 1908
height = 1001
maximized = False
selected_category = runner:linux

17
.config/mpv/mpv.conf Normal file
View File

@ -0,0 +1,17 @@
# Always allow seeking, e.g. allow seeking within a local cache of HTTP stream
force-seekable=yes
# Always open a video window even with no video
force-window=yes
# Don't exit when the end of playlist is reached
keep-open=yes
# Always save the current playback position on exit
save-position-on-quit=yes
# Create 'high-quality' profile
[high-quality]
# Describe this profile
profile-desc="High quality rendering"
# Include all settings from the default 'opengl-hq' profile
profile=opengl-hq
# Disable debanding for better performance
deband=no

View File

@ -0,0 +1,505 @@
--redefine keybindings here if needed; multiple bindings are possible
keybinds = {
activate = {'\\', 'MOUSE_BTN2'},
plsup = {'UP', 'MOUSE_BTN3'},
plsdown = {'DOWN', 'MOUSE_BTN4'},
plsenter = {'ENTER', 'MOUSE_BTN0'}
}
--hide playlist after specified number of seconds
osd_time=10
--show only specified number of playlist entries
window=7
--fade video when showing playlist
fade=false
--if fade=true; -100 — black, 0 — normal
plsbrightness=-70
--favorites get promotion to the top of the pls
favorites = {}
-- END OF CONFIGURABLE VARIABLES
-- put your settings in (SCRIPTS DIR)/_iptvconf.lua
pcall(require, "_iptvconf")
local timer
--local plscount
local pattern=""
local is_active
local is_playlist_loaded
-- UTF-8 lower/upper conversion
local utf8_lc_uc = {
["a"] = "A",
["b"] = "B",
["c"] = "C",
["d"] = "D",
["e"] = "E",
["f"] = "F",
["g"] = "G",
["h"] = "H",
["i"] = "I",
["j"] = "J",
["k"] = "K",
["l"] = "L",
["m"] = "M",
["n"] = "N",
["o"] = "O",
["p"] = "P",
["q"] = "Q",
["r"] = "R",
["s"] = "S",
["t"] = "T",
["u"] = "U",
["v"] = "V",
["w"] = "W",
["x"] = "X",
["y"] = "Y",
["z"] = "Z",
["а"] = "А",
["б"] = "Б",
["в"] = "В",
["г"] = "Г",
["д"] = "Д",
["е"] = "Е",
["ж"] = "Ж",
["з"] = "З",
["и"] = "И",
["й"] = "Й",
["к"] = "К",
["л"] = "Л",
["м"] = "М",
["н"] = "Н",
["о"] = "О",
["п"] = "П",
["р"] = "Р",
["с"] = "С",
["т"] = "Т",
["у"] = "У",
["ф"] = "Ф",
["х"] = "Х",
["ц"] = "Ц",
["ч"] = "Ч",
["ш"] = "Ш",
["щ"] = "Щ",
["ъ"] = "Ъ",
["ы"] = "Ы",
["ь"] = "Ь",
["э"] = "Э",
["ю"] = "Ю",
["я"] = "Я",
["ё"] = "Ё"
}
local utf8_uc_lc = {
["A"] = "a",
["B"] = "b",
["C"] = "c",
["D"] = "d",
["E"] = "e",
["F"] = "f",
["G"] = "g",
["H"] = "h",
["I"] = "i",
["J"] = "j",
["K"] = "k",
["L"] = "l",
["M"] = "m",
["N"] = "n",
["O"] = "o",
["P"] = "p",
["Q"] = "q",
["R"] = "r",
["S"] = "s",
["T"] = "t",
["U"] = "u",
["V"] = "v",
["W"] = "w",
["X"] = "x",
["Y"] = "y",
["Z"] = "z",
["А"] = "а",
["Б"] = "б",
["В"] = "в",
["Г"] = "г",
["Д"] = "д",
["Е"] = "е",
["Ж"] = "ж",
["З"] = "з",
["И"] = "и",
["Й"] = "й",
["К"] = "к",
["Л"] = "л",
["М"] = "м",
["Н"] = "н",
["О"] = "о",
["П"] = "п",
["Р"] = "р",
["С"] = "с",
["Т"] = "т",
["У"] = "у",
["Ф"] = "ф",
["Х"] = "х",
["Ц"] = "ц",
["Ч"] = "ч",
["Ш"] = "ш",
["Щ"] = "щ",
["Ъ"] = "ъ",
["Ы"] = "ы",
["Ь"] = "ь",
["Э"] = "э",
["Ю"] = "ю",
["Я"] = "я",
["Ё"] = "ё"
}
--utf8 char pattern
local utf8_char="[\1-\127\192-\223][\128-\191]*"
local cyr_chars={'а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я'}
-- символы, которые возможно вводить для поиска
local chars={}
for i=string.byte('a'),string.byte('z') do
table.insert(chars,i)
end
for i=string.byte('A'),string.byte('Z') do
table.insert(chars,i)
end
for i=string.byte('0'),string.byte('9') do
table.insert(chars,i)
end
for _,v in ipairs({',','^','$','(',')','%','.','[',']','*','+','-','?','`',"'",";"}) do
table.insert(chars,string.byte(v))
end
local keybinder = {
remove = function(action)
for i,_ in ipairs(keybinds[action]) do
mp.remove_key_binding(action..tostring(i))
end
end,
add = function(action, func, repeatable)
for i,key in ipairs(keybinds[action]) do
assert(type(func)=="function", "not a function")
if repeatable then
mp.add_forced_key_binding(key, action..tostring(i), func, "repeatable")
else
mp.add_forced_key_binding(key, action..tostring(i), func)
end
end
end
}
local fader = {
saved_brtns,
on = function(self)
if fade and not self.saved_brtns then
self.saved_brtns = mp.get_property("brightness")
mp.set_property("brightness", plsbrightness)
end
end,
off = function(self)
if fade and self.saved_brtns then
mp.set_property("brightness", self.saved_brtns)
self.saved_brtns=nil
end
end
}
local playlister = {
-- pls — список элементов плейлиста
pls,
-- plsfiltered — список индексов выбранных фильтром элементов плейлиста
plsfiltered,
plspos,
wndstart,
wndend,
cursor,
init = function(self)
if not self.pls then
self.pls = mp.get_property_native("playlist")
end
mp.commandv("stop")
--need to mark first entry non-current (mpv bug?)
if self.pls[1] then
self.pls[1].current = false
end
if favorites and #favorites>0 then
self:sortfavs()
end
pattern = ""
self.plsfiltered = tablekeys(self.pls)
end,
show = function(self)
local i
local newpos
local msg
--media-title
--playlist t[2].title
if not self.plsfiltered then
return
end
if not self.plspos then
self.plspos=mp.get_property_native("playlist-pos-1")
--plscount=mp.get_property_native("playlist-count")
end
if not self.wndstart or not self.cursor then
self.wndstart=1
self.cursor=0
end
msg=""
i = self.wndstart
local prefix
while self.plsfiltered[i] and i<=self.wndstart+window-1 do
if self.pls[self.plsfiltered[i]].current then
prefix="*"
elseif i==self.wndstart+self.cursor then
prefix=">"
else
prefix=" "
end
msg = msg..prefix..(self.pls[self.plsfiltered[i]].title or "").."\n"
i=i+1
end
if self.wndstart>1 then
msg = "...\n"..msg
else
msg = " \n"..msg
end
if self.wndstart+window-1<#self.plsfiltered then
msg = msg.."..."
end
msg="/"..pattern.."\n"..msg
mp.osd_message(msg, osd_time)
end,
sortfavs = function(self)
--favorites bubbles to the top
local favs={}
local nonfavs={}
for _,v in ipairs(self.pls) do
if in_array(favorites,v.title) then
favs[#favs+1] = v
else
nonfavs[#nonfavs+1] = v
end
end
for i=1,#nonfavs do
favs[#favs+1] = nonfavs[i]
end
self.pls = favs
end,
filter = function(self)
self.plsfiltered={}
for i,v in ipairs(self.pls) do
if string.match(mylower(v.title),'.*'..prepat(pattern)..'.*') then
table.insert(self.plsfiltered,i)
end
end
self.wndstart=1
self.cursor=0
end,
down = function(self)
if self.cursor >= #self.plsfiltered-1 then return end
if self.cursor<window-1 then
self.cursor=self.cursor+1
else
if self.wndstart<#self.plsfiltered-window+1 then
self.wndstart=self.wndstart+1
end
end
self.show(self)
end,
up = function(self)
if self.cursor>0 then
self.cursor=self.cursor-1
self.show(self)
else
if self.wndstart>1 then
self.wndstart=self.wndstart-1
self.show(self)
end
end
end,
play = function(self)
mp.commandv("loadfile",self.pls[self.plsfiltered[self.wndstart+self.cursor]].filename)
if self.plspos then
self.pls[self.plspos].current=false
end
self.plspos=self.plsfiltered[self.wndstart+self.cursor]
self.pls[self.plspos].current=true
end
}
function add_bindings()
keybinder.add("plsup", up, true)
keybinder.add("plsdown", down, true)
for i,v in ipairs(chars) do
c=string.char(v)
mp.add_forced_key_binding(c, 'search'..v, typing(c),"repeatable")
end
mp.add_forced_key_binding('SPACE', 'search32', typing(' '),"repeatable")
--[[ mp.add_key_binding('а', 'search1000', typing('а'),"repeatable")
mp.add_key_binding('с', 'search1001', typing('с'),"repeatable")]]
mp.add_forced_key_binding('BS', 'searchbs', backspace,"repeatable")
keybinder.add("plsenter", play)
for i,v in ipairs(cyr_chars) do
mp.add_forced_key_binding(v, 'search'..i+1000, typing(v),"repeatable")
end
end
function remove_bindings()
keybinder.remove('plsup')
keybinder.remove('plsdown')
keybinder.remove('plsenter')
for i,v in ipairs(chars) do
c=string.char(v)
mp.remove_key_binding('search'..v)
end
mp.remove_key_binding('search32')
mp.remove_key_binding('searchbs')
for i,v in ipairs(cyr_chars) do
mp.remove_key_binding('search'..i+1000)
end
end
function activate()
if is_active then
shutdown()
return
else
is_active=true
fader:on()
playlister:show()
add_bindings()
if not timer then
timer=mp.add_periodic_timer(osd_time, shutdown)
timer.oneshot=true
else
resumetimer()
end
end
end
function tablekeys(t)
local result={}
for i,v in ipairs(t) do
table.insert(result,i)
end
return result
end
function in_array(array, value)
for _,v in ipairs(array) do
if v==value then
return true
end
end
return false
end
function mylower(s)
local res,n = string.gsub(s,utf8_char,function (c)
return utf8_uc_lc[c]
end)
return res
end
function myupper(s)
local res,n = string.gsub(s,utf8_char,function (c)
return utf8_lc_uc[c]
end)
return res
end
function prepat(s)
--prepare nocase and magic chars
s = string.gsub(s, "[%^%$%(%)%%%.%[%]%*%+%-%?]",function (c)
return '%'..c
end)
--[[ s = string.gsub(s, utf8_char, function (c)
return string.format("[%s%s]", utf8_uc_lc[c] or c, utf8_lc_uc[c] or c)
end)]]
return s
end
function resumetimer()
timer:kill()
timer:resume()
end
function typing(char)
return function()
local c=string.lower(char)
pattern = pattern..c
playlister:filter()
playlister:show()
resumetimer()
end
end
function backspace()
if string.len(pattern)>0 then
-- pattern = string.sub(pattern,1,-2)
-- for unicode
pattern = string.match(pattern,"(.*)"..utf8_char.."$")
playlister:filter()
playlister:show()
resumetimer()
end
end
function play()
-- mp.commandv("playlist-move", wndstart+cursor, 1)
-- mp.commandv("playlist-clear")
-- mp.commandv("playlist-next")
fader:off()
playlister:play()
playlister:show()
resumetimer()
end
function shutdown()
fader:off()
remove_bindings()
is_active=false
mp.osd_message("", 1)
end
function down()
fader:on()
playlister:down()
resumetimer()
end
function up()
fader:on()
playlister:up()
resumetimer()
end
function on_start_file()
if is_playlist_loaded then
playlister:init()
mp.unregister_event(on_start_file)
activate()
else
is_playlist_loaded = true
end
end
if mp.get_opt("iptv") then
mp.set_property_bool("idle", true)
mp.set_property_bool("force-window", true)
mp.register_event("start-file", on_start_file)
keybinder.add("activate", activate)
end

26
.config/newsboat/config Normal file
View File

@ -0,0 +1,26 @@
auto-reload yes
refresh-on-startup yes
reload-time 3600
notify-program "/home/yorune/.local/bin/notify-program"
notify-always yes
unbind-key o
bind-key o open-in-browser
macro , open-in-browser
macro p set browser "mpv --ytdl-format='bestvideo[ext=mp4][height<=?1080]+bestaudio[ext=m4a]' --no-resume-playback" ; open-in-browser ; set browser "/home/yorune/.local/bin/browser-x -new-tab %u"
unbind-key n
unbind-key p
bind-key n next
bind-key p prev
color listnormal cyan default
color listfocus black yellow standout bold
color listnormal_unread blue default
color listfocus_unread yellow default bold
color info red black bold
color article white default bold
browser "/home/yorune/.local/bin/browser-x -new-tab %u"
player mpv

70
.config/newsboat/urls Normal file
View File

@ -0,0 +1,70 @@
=====================NEWS====================================
https://wtf.roflcopter.fr/rss-bridge/?action=display&bridge=Facebook&context=User&u=infoKONINpl&media_type=all&limit=-1&format=Mrss "~infoKONIN - Facebook"
shttps://wtf.roflcopter.fr/rss-bridge/?action=display&bridge=Facebook&context=User&u=gminakleczew&media_type=all&limit=-1&format=Mrss "~Gmina Kleczew - Facebook"
https://wtf.roflcopter.fr/rss-bridge/?action=display&bridge=Facebook&context=User&u=portalLM&media_type=all&limit=-1&format=Mrss "~Portal lm.pl - Facebook"
https://nitter.net/MZ_GOV_PL/rss "~MZ_GOV_PL - Twitter"
http://www.epoznan.pl/rss.php "~Epoznan - Website"
http://rss.slashdot.org/Slashdot/slashdotMain "SlashDot"
https://sekurak.pl/feed/ "~Sekurak"
https://feeds.feedburner.com/niebezpiecznik/ "~Niebezpiecznik"
https://www.cybsecurity.org/feed/podcast/ "~CybSecurity"
============================================================
https://bugs.gentoo.org/buglist.cgi?bug_status=UNCONFIRMED&chfieldfrom=24h&ctype=atom&title=NEW&list_id=4468306&order=changeddate%20DESC%2Cbug_status%2Cpriority%2Cassigned_to%2Cbug_id&query_format=advanced Gentoo
https://bugs.gentoo.org/buglist.cgi?component=Package%20issues&product=GURU&query_format=advanced&resolution=---&title=Bug%20List&ctype=atom GURU-BUGS
https://bugs.gentoo.org/buglist.cgi?component=Trusted%20Contributor%20ascension&product=GURU&query_format=advanced&resolution=---&title=Bug%20List&ctype=atom
https://www.reddit.com/r/gentoo/new.rss "~Gentoo - Reddit"
============================================================
http://rss.uptimerobot.com/u674346-753d02ab763f3725330347d4419a7569 "~UpTimeRoboot"
=====================ANIME===================================
https://mirror.animetosho.org/feed/rss2?only_tor=1&q=%5BHorribleSubs%5D%20Sword%20Art%20Online%20720p&filter%5B0%5D%5Bt%5D=nyaa_class&filter%5B0%5D%5Bv%5D=trusted "~Sword Art Online"
=====================YOUTUBE=================================
https://www.youtube.com/feeds/videos.xml?channel_id=UCzuvRWjh7k1SZm1RvqvIx4w "~Krzysztof Gonciarz"
https://www.youtube.com/feeds/videos.xml?channel_id=UC3QOjSZmJuYgb98BAzKfzig "~Zapytaj Beczkę"
https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA "~Luke Smith"
https://www.youtube.com/feeds/videos.xml?channel_id=UC2qQkGwReBfucb6yWr7idRA "~Asia Ladowska"
https://www.youtube.com/feeds/videos.xml?channel_id=UC5ZSM0kOGhtLdtZiqM2noWw "~StudyWithInSpo"
https://www.youtube.com/feeds/videos.xml?channel_id=UC84AaEtr7hlaYYwXDSKAbNg "~Ignacy z Japonii"
https://www.youtube.com/feeds/videos.xml?channel_id=UC8JbbaZ_jgdsoUqrZ2bXtQQ "~Lekko Stronniczy"
https://www.youtube.com/feeds/videos.xml?channel_id=UC8q23MpiyWjv9vd4r85oj1A "~Daniel Rakowiecki"
https://www.youtube.com/feeds/videos.xml?channel_id=UC9Vi25H6lQvPqcepJCJ3sEg "~Emma"
https://www.youtube.com/feeds/videos.xml?channel_id=UCAD-xOOaUI6N7Uq9laOVbcw "~Rene Rene"
https://www.youtube.com/feeds/videos.xml?channel_id=UCAEQl0BbYrPyTnsWVBJuIqQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCaG-Uk3PSpHexeUJaJC_TPw
https://www.youtube.com/feeds/videos.xml?channel_id=UCAkBZtIl-a0fBLcY7JCPSQw
https://www.youtube.com/feeds/videos.xml?channel_id=UCB-4hoTjsE3VIFI862C5SZA
https://www.youtube.com/feeds/videos.xml?channel_id=UCE5Au4LfcBHxTQR_yLbncrQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCe6nK69Yc1zna7QSJEfA9pw
https://www.youtube.com/feeds/videos.xml?channel_id=UCEbYhDd6c6vngsF5PQpFVWg
https://www.youtube.com/feeds/videos.xml?channel_id=UCELsE3w85wy7hXFmU2eRn_w
https://www.youtube.com/feeds/videos.xml?channel_id=UCfegHHvKywKjJ69Ymcb6j0w
https://www.youtube.com/feeds/videos.xml?channel_id=UCFGud6qsbaAjuP6WaXAJj3Q
https://www.youtube.com/feeds/videos.xml?channel_id=UCH2OHdQF5c2r2M_l_vPiXRA
https://www.youtube.com/feeds/videos.xml?channel_id=UCIDf8pzX2oZmjXtqMwHn0xg
https://www.youtube.com/feeds/videos.xml?channel_id=UCIj6yjWVKPKO5zNLBjQ8Beg
https://www.youtube.com/feeds/videos.xml?channel_id=UCJ24N4O0bP7LGLBDvye7oCA
https://www.youtube.com/feeds/videos.xml?channel_id=UCJkmbV_cndEe6Af8b5qVyoQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCJLLl6AraX1POemgLfhirwg
https://www.youtube.com/feeds/videos.xml?channel_id=UCjS2aGCvsnhExcWRAI8T4Pw
https://www.youtube.com/feeds/videos.xml?channel_id=UCMsi03EhTUsUs2OtPus6XDQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCMTkC2dA25yFsmtaevpYWfg
https://www.youtube.com/feeds/videos.xml?channel_id=UCnOo8dtBgwJbdwl4HxqPHwg
https://www.youtube.com/feeds/videos.xml?channel_id=UCO8DQrSp5yEP937qNqTooOw
https://www.youtube.com/feeds/videos.xml?channel_id=UCoJjEsNkU-Md3xB6BursT0Q
https://www.youtube.com/feeds/videos.xml?channel_id=UCoXxgqIOTa8qCM7Hd7RiURw
https://www.youtube.com/feeds/videos.xml?channel_id=UCPc_saLjikyw-1sscFsHIsA
https://www.youtube.com/feeds/videos.xml?channel_id=UCPKgIhTC3BdkAwMw6s-GEug
https://www.youtube.com/feeds/videos.xml?channel_id=UCRxAgfYexGLlu1WHGIMUDqw
https://www.youtube.com/feeds/videos.xml?channel_id=UCs02jgjMVeirmDHaxAXApkg
https://www.youtube.com/feeds/videos.xml?channel_id=UCsnGwSIHyoYN0kiINAGUKxg
https://www.youtube.com/feeds/videos.xml?channel_id=UCv9wKjBogC5AVG54s_Imn0A
https://www.youtube.com/feeds/videos.xml?channel_id=UCvbEYH_h8k-hHq2oS-7zIdQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCVbn813ctsoChuTT4LuLqrA
https://www.youtube.com/feeds/videos.xml?channel_id=UCVVt5tbZEzfQSIsHUh3b_vg
https://www.youtube.com/feeds/videos.xml?channel_id=UCw3T7SvPYDHCkdMhC0NcKsw
https://www.youtube.com/feeds/videos.xml?channel_id=UCWcz2SQMCcijkVta0hSERIA
https://www.youtube.com/feeds/videos.xml?channel_id=UCWFKCr40YwOZQx8FHU_ZqqQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCXRJfVWEjv9qxooSbOkFmkw
https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw
https://www.youtube.com/feeds/videos.xml?channel_id=UCZgyxIrQnTDLwwEr9VSkoPA
https://www.youtube.com/feeds/videos.xml?channel_id=UCZKqIdmPtIU6DOTmWxzudKw
=============================================================

567
.config/ranger/rc.conf Normal file
View File

@ -0,0 +1,567 @@
#set viewmode miller
set viewmode multipane
set column_ratios 1,3,4
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
set show_hidden false
# Ask for a confirmation when running the "delete" command?
# Valid values are "always", "never", "multiple" (default)
# With "multiple", ranger will ask only if you delete multiple files at once.
#set confirm_on_delete multiple
set confirm_on_delete never
set use_preview_script true
set automatically_count_files true
set open_all_images true
set vcs_aware false
set vcs_backend_git enabled
set vcs_backend_hg disabled
set vcs_backend_bzr disabled
set vcs_backend_svn disabled
set preview_images true
set preview_images_method urxvt
set w3m_delay 0.02
set iterm2_font_width 8
set iterm2_font_height 11
set unicode_ellipsis false
set bidi_support false
set show_hidden_bookmarks true
set colorscheme default
set preview_files true
set preview_directories true
set collapse_preview true
set save_console_history true
set status_bar_on_top false
set draw_progress_bar_in_status_bar true
set draw_borders true
set respect draw_borders
set dirname_in_tabs false
set mouse_enabled true
set display_size_in_main_column true
set display_size_in_status_bar true
# Display the free disk space in the status bar?
set display_free_space_in_status_bar true
# Display files tags in all columns or only in main column?
set display_tags_in_all_columns true
# Set a title for the window?
set update_title false
# Set the title to "ranger" in the tmux program?
set update_tmux_title true
# Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature.
set shorten_title 3
# Show hostname in titlebar?
set hostname_in_titlebar false
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
set tilde_in_titlebar true
# How many directory-changes or console-commands should be kept in history?
set max_history_size 20
set max_console_history_size 50
# Try to keep so much space between the top/bottom border when scrolling:
set scroll_offset 10
# Flush the input after each key hit? (Noticeable when ranger lags)
set flushinput true
# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
set padding_right true
# Save bookmarks (used with mX and `X) instantly?
# This helps to synchronize bookmarks between multiple ranger
# instances but leads to *slight* performance loss.
# When false, bookmarks are saved when ranger is exited.
set autosave_bookmarks true
# Save the "`" bookmark to disk. This can be used to switch to the last
# directory by typing "``".
set save_backtick_bookmark true
# You can display the "real" cumulative size of directories by using the
# command :get_cumulative_size or typing "dc". The size is expensive to
# calculate and will not be updated automatically. You can choose
# to update it automatically though by turning on this option:
set autoupdate_cumulative_size false
# Turning this on makes sense for screen readers:
set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
set sort natural
# Additional sorting options
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
set xterm_alt_key false
# Whether to include bookmarks in cd command
set cd_bookmarks true
# Changes case sensitivity for the cd command tab completion
set cd_tab_case sensitive
# Use fuzzy tab completion with the "cd" command. For example,
# ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
set cd_tab_fuzzy false
set preview_max_size 0
set hint_collapse_threshold 10
set show_selection_in_titlebar true
set idle_delay 2000
set metadata_deep_search false
set clear_filters_on_dir_change false
set line_numbers false
set relative_current_zero false
set one_indexed false
set save_tabs_on_exit false
set wrap_scroll false
set global_inode_type_filter
set freeze_files false
# ===================================================================
# == My settings
# ===================================================================
setlocal path=~/Screenshots sort mtime
setlocal path=~/Screenshots sort_reverse False
# ===================================================================
# == Local Options
# ===================================================================
# You can set local options that only affect a single directory.
# Examples:
# setlocal path=~/downloads sort mtime
# ===================================================================
# == Command Aliases in the Console
# ===================================================================
alias e edit
alias q quit
alias q! quit!
alias qa quitall
alias qa! quitall!
alias qall quitall
alias qall! quitall!
alias setl setlocal
alias filter scout -prts
alias find scout -aets
alias mark scout -mr
alias unmark scout -Mr
alias search scout -rs
alias search_inc scout -rts
alias travel scout -aefklst
# ===================================================================
# == Define keys for the browser
# ===================================================================
# Basic
map bg shell set-wallpaper %f
map bc shell wall -i %f
map bh cd ~
map Q quitall
map q quit
copymap q ZZ ZQ
map R reload_cwd
map F set freeze_files!
map <C-r> reset
map <C-l> redraw_window
map <C-c> abort
map <esc> change_mode normal
map ~ set viewmode!
map i display_file
map ? help
map W display_log
map w taskview_open
map S shell $SHELL
map : console
map ; console
map ! console shell%space
map @ console -p6 shell %%s
map # console shell -p%space
map s console shell%space
map r chain draw_possible_programs; console open_with%%space
map f console find%space
map cd console cd%space
map <C-p> chain console; eval fm.ui.console.history_move(-1)
# Change the line mode
map Mf linemode filename
map Mi linemode fileinfo
map Mm linemode mtime
map Mp linemode permissions
map Ms linemode sizemtime
map Mt linemode metatitle
# Tagging / Marking
map t tag_toggle
map ut tag_remove
map <Space> mark_files toggle=True
map v mark_files all=True toggle=True
map uv mark_files all=True val=False
map V toggle_visual_mode
map uV toggle_visual_mode reverse=True
# For the nostalgics: Midnight Commander bindings
map <F1> help
map <F2> rename_append
map <F3> display_file
map <F4> edit
map <F5> copy
map <F6> cut
map <F7> console mkdir%space
map <F8> console delete
map <F10> exit
# In case you work on a keyboard with dvorak layout
map <UP> move up=1
map <DOWN> move down=1
map <LEFT> move left=1
map <RIGHT> move right=1
map <HOME> move to=0
map <END> move to=-1
map <PAGEDOWN> move down=1 pages=True
map <PAGEUP> move up=1 pages=True
map <CR> move right=1
#map <DELETE> console delete
map <INSERT> console touch%space
# VIM-like
copymap <UP> k
copymap <DOWN> j
copymap <LEFT> h
copymap <RIGHT> l
copymap <HOME> gg
copymap <END> G
copymap <PAGEDOWN> <C-F>
copymap <PAGEUP> <C-B>
map J move down=0.5 pages=True
map K move up=0.5 pages=True
copymap J <C-D>
copymap K <C-U>
# Jumping around
map H history_go -1
map L history_go 1
map ] move_parent 1
map [ move_parent -1
map } traverse
map { traverse_backwards
map ) jump_non
#DEFAULT MOVEMENT
map ge cd /etc
map gh cd ~
map gu cd /usr
#map gl cd -r .
map gL cd -r %f
#map gv cd /var
map gM cd /mnt
map gr cd /
map gR eval fm.cd(ranger.RANGERDIR)
map g? cd /usr/share/doc/ranger
# External Programs
map E edit
map du shell -p du --max-depth=1 -h --apparent-size
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
map yp yank path
map yd yank dir
map yn yank name
map y. yank name_without_extension
# Filesystem Operations
map = chmod
map cw console rename%space
map a rename_append
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
map pp paste
map po paste overwrite=True
map pP paste append=True
map pO paste overwrite=True append=True
map pl paste_symlink relative=False
map pL paste_symlink relative=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
map dD console delete
map dd cut
map ud uncut
map da cut mode=add
map dr cut mode=remove
map dt cut mode=toggle
map yy copy
map uy uncut
map ya copy mode=add
map yr copy mode=remove
map yt copy mode=toggle
# Temporary workarounds
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
# Searching
map / console search%space
map n search_next
map N search_next forward=False
map ct search_next order=tag
map cs search_next order=size
map ci search_next order=mimetype
map cc search_next order=ctime
map cm search_next order=mtime
map ca search_next order=atime
# Tabs
map <C-n> tab_new
map <C-w> tab_close
map <TAB> tab_move 1
map <S-TAB> tab_move -1
map <A-Right> tab_move 1
map <A-Left> tab_move -1
map uq tab_restore
map <a-1> tab_open 1
map <a-2> tab_open 2
map <a-3> tab_open 3
map <a-4> tab_open 4
map <a-5> tab_open 5
map <a-6> tab_open 6
map <a-7> tab_open 7
map <a-8> tab_open 8
map <a-9> tab_open 9
map <a-r> tab_shift 1
map <a-l> tab_shift -1
# Sorting
map or set sort_reverse!
map oz set sort=random
map os chain set sort=size; set sort_reverse=False
map ob chain set sort=basename; set sort_reverse=False
map on chain set sort=natural; set sort_reverse=False
map om chain set sort=mtime; set sort_reverse=False
map oc chain set sort=ctime; set sort_reverse=False
map oa chain set sort=atime; set sort_reverse=False
map ot chain set sort=type; set sort_reverse=False
map oe chain set sort=extension; set sort_reverse=False
map oS chain set sort=size; set sort_reverse=True
map oB chain set sort=basename; set sort_reverse=True
map oN chain set sort=natural; set sort_reverse=True
map oM chain set sort=mtime; set sort_reverse=True
map oC chain set sort=ctime; set sort_reverse=True
map oA chain set sort=atime; set sort_reverse=True
map oT chain set sort=type; set sort_reverse=True
map oE chain set sort=extension; set sort_reverse=True
map dc get_cumulative_size
# Settings
map zc set collapse_preview!
map zd set sort_directories_first!
map zh set show_hidden!
map <C-h> set show_hidden!
copymap <C-h> <backspace>
copymap <backspace> <backspace2>
map zI set flushinput!
map zi set preview_images!
map zm set mouse_enabled!
map zp set preview_files!
map zP set preview_directories!
map zs set sort_case_insensitive!
map zu set autoupdate_cumulative_size!
map zv set use_preview_script!
map zf console filter%space
copymap zf zz
# Filter stack
map .n console filter_stack add name%space
map .m console filter_stack add mime%space
map .d filter_stack add type d
map .f filter_stack add type f
map .l filter_stack add type l
map .| filter_stack add or
map .& filter_stack add and
map .! filter_stack add not
map .r console filter_stack rotate
map .c filter_stack clear
map .* filter_stack decompose
map .p filter_stack pop
map .. filter_stack show
# Bookmarks
map `<any> enter_bookmark %any
map '<any> enter_bookmark %any
map m<any> set_bookmark %any
map um<any> unset_bookmark %any
map m<bg> draw_bookmarks
copymap m<bg> um<bg> `<bg> '<bg>
# Generate all the chmod bindings with some python help:
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
# ===================================================================
# == Define keys for the console
# ===================================================================
# Note: Unmapped keys are passed directly to the console.
# Basic
cmap <tab> eval fm.ui.console.tab()
cmap <s-tab> eval fm.ui.console.tab(-1)
cmap <ESC> eval fm.ui.console.close()
cmap <CR> eval fm.ui.console.execute()
cmap <C-l> redraw_window
copycmap <ESC> <C-c>
copycmap <CR> <C-j>
# Move around
cmap <up> eval fm.ui.console.history_move(-1)
cmap <down> eval fm.ui.console.history_move(1)
cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1)
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
cmap <a-b> eval fm.ui.console.move_word(left=1)
cmap <a-f> eval fm.ui.console.move_word(right=1)
copycmap <a-b> <a-left>
copycmap <a-f> <a-right>
# Line Editing
cmap <backspace> eval fm.ui.console.delete(-1)
cmap <delete> eval fm.ui.console.delete(0)
cmap <C-w> eval fm.ui.console.delete_word()
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
cmap <C-k> eval fm.ui.console.delete_rest(1)
cmap <C-u> eval fm.ui.console.delete_rest(-1)
cmap <C-y> eval fm.ui.console.paste()
# And of course the emacs way
copycmap <ESC> <C-g>
copycmap <up> <C-p>
copycmap <down> <C-n>
copycmap <left> <C-b>
copycmap <right> <C-f>
copycmap <home> <C-a>
copycmap <end> <C-e>
copycmap <delete> <C-d>
copycmap <backspace> <C-h>
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
# and <backspace2> (code 127). To be sure, use both.
copycmap <backspace> <backspace2>
# This special expression allows typing in numerals:
cmap <allow_quantifiers> false
# ===================================================================
# == Pager Keybindings
# ===================================================================
# Movement
pmap <down> pager_move down=1
pmap <up> pager_move up=1
pmap <left> pager_move left=4
pmap <right> pager_move right=4
pmap <home> pager_move to=0
pmap <end> pager_move to=-1
pmap <pagedown> pager_move down=1.0 pages=True
pmap <pageup> pager_move up=1.0 pages=True
pmap <C-d> pager_move down=0.5 pages=True
pmap <C-u> pager_move up=0.5 pages=True
copypmap <UP> k <C-p>
copypmap <DOWN> j <C-n> <CR>
copypmap <LEFT> h
copypmap <RIGHT> l
copypmap <HOME> g
copypmap <END> G
copypmap <C-d> d
copypmap <C-u> u
copypmap <PAGEDOWN> n f <C-F> <Space>
copypmap <PAGEUP> p b <C-B>
# Basic
pmap <C-l> redraw_window
pmap <ESC> pager_close
copypmap <ESC> q Q i <F3>
pmap E edit_file
# ===================================================================
# == Taskview Keybindings
# ===================================================================
# Movement
tmap <up> taskview_move up=1
tmap <down> taskview_move down=1
tmap <home> taskview_move to=0
tmap <end> taskview_move to=-1
tmap <pagedown> taskview_move down=1.0 pages=True
tmap <pageup> taskview_move up=1.0 pages=True
tmap <C-d> taskview_move down=0.5 pages=True
tmap <C-u> taskview_move up=0.5 pages=True
copytmap <UP> k <C-p>
copytmap <DOWN> j <C-n> <CR>
copytmap <HOME> g
copytmap <END> G
copytmap <C-u> u
copytmap <PAGEDOWN> n f <C-F> <Space>
copytmap <PAGEUP> p b <C-B>
# Changing priority and deleting tasks
tmap J eval -q fm.ui.taskview.task_move(-1)
tmap K eval -q fm.ui.taskview.task_move(0)
tmap dd eval -q fm.ui.taskview.task_remove()
tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
tmap <delete> eval -q fm.ui.taskview.task_remove()
# Basic
tmap <C-l> redraw_window
tmap <ESC> taskview_close
copytmap <ESC> q Q w <C-c>

210
.config/ranger/rifle.conf Normal file
View File

@ -0,0 +1,210 @@
ext jpg = feh --scale-down "$@"
#ext doc = openoffice4 "$@"
#ext odt = openoffice4 "$@"
#-------------------------------------------
# Websites
#-------------------------------------------
# Rarely installed browsers get higher priority; It is assumed that if you
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
# other hand are often only installed as fallback browsers.
ext x?html?, has surf, X, flag f = surf -- file://"$1"
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has dwb, X, flag f = dwb -- "$@"
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
ext x?html?, has luakit, X, flag f = luakit -- "$@"
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
ext x?html?, has midori, X, flag f = midori -- "$@"
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
ext x?html?, has chromium, X, flag f = chromium -- "$@"
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
ext x?html?, has opera, X, flag f = opera -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
ext x?html?, has links2, terminal = links2 "$@"
ext x?html?, has links, terminal = links "$@"
ext x?html?, has lynx, terminal = lynx -- "$@"
ext x?html?, has w3m, terminal = w3m "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
# Define the "editor" for text files as first action
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
#--------------------------------------------
# Code
#-------------------------------------------
ext py = python -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext sh = sh -- "$1"
ext php = php -- "$1"
#--------------------------------------------
# Audio without X
#-------------------------------------------
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
#--------------------------------------------
# Video/Audio with a GUI
#-------------------------------------------
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
mime ^video|audio, has totem, X, flag f = totem -- "$@"
mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
#--------------------------------------------
# Video without X:
#-------------------------------------------
mime ^video, terminal, !X, has mpv = mpv -- "$@"
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
#-------------------------------------------
# Documents
#-------------------------------------------
ext pdf, has llpp, X, flag f = llpp "$@"
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has mupdf, X, flag f = mupdf "$@"
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
ext pdf, has evince, X, flag f = evince -- "$@"
ext pdf, has atril, X, flag f = atril -- "$@"
ext pdf, has okular, X, flag f = okular -- "$@"
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
ext pdf, has open, X, flag f = open "$@"
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
ext djvu, has zathura,X, flag f = zathura -- "$@"
ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
ext djvu, has djview, X, flag f = djview -- "$@"
ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
#-------------------------------------------
# Image Viewing:
#-------------------------------------------
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh -- "$@"
mime ^image, has mirage, X, flag f = mirage -- "$@"
mime ^image, has ristretto, X, flag f = ristretto "$@"
mime ^image, has eog, X, flag f = eog -- "$@"
mime ^image, has eom, X, flag f = eom -- "$@"
mime ^image, has nomacs, X, flag f = nomacs -- "$@"
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
mime ^image, has gwenview, X, flag f = gwenview -- "$@"
mime ^image, has gimp, X, flag f = gimp -- "$@"
ext xcf, X, flag f = gimp -- "$@"
#-------------------------------------------
# Archives
#-------------------------------------------
# avoid password prompt by providing empty password
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
# This requires atool
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
# Listing and extracting archives without atool:
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
ext zip, has unzip = unzip -l "$1" | less
ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done
ext ace, has unace = unace l "$1" | less
ext ace, has unace = for file in "$@"; do unace e "$file"; done
ext rar, has unrar = unrar l "$1" | less
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
#-------------------------------------------
# Flag t fallback terminals
#-------------------------------------------
# Rarely installed terminal emulators get higher priority; It is assumed that
# if you install a rare terminal emulator, you probably use it.
# gnome-terminal/konsole/xterm on the other hand are often installed as part of
# a desktop environment or as fallback terminal emulators.
mime ^ranger/x-terminal-emulator, has terminology = terminology -e "$@"
mime ^ranger/x-terminal-emulator, has kitty = kitty -- "$@"
mime ^ranger/x-terminal-emulator, has alacritty = alacritty -e "$@"
mime ^ranger/x-terminal-emulator, has sakura = sakura -e "$@"
mime ^ranger/x-terminal-emulator, has lilyterm = lilyterm -e "$@"
#mime ^ranger/x-terminal-emulator, has cool-retro-term = cool-retro-term -e "$@"
mime ^ranger/x-terminal-emulator, has termite = termite -x '"$@"'
#mime ^ranger/x-terminal-emulator, has yakuake = yakuake -e "$@"
mime ^ranger/x-terminal-emulator, has guake = guake -ne "$@"
mime ^ranger/x-terminal-emulator, has tilda = tilda -c "$@"
mime ^ranger/x-terminal-emulator, has st = st -e "$@"
mime ^ranger/x-terminal-emulator, has terminator = terminator -x "$@"
mime ^ranger/x-terminal-emulator, has urxvt = urxvt -e "$@"
mime ^ranger/x-terminal-emulator, has pantheon-terminal = pantheon-terminal -e "$@"
mime ^ranger/x-terminal-emulator, has lxterminal = lxterminal -e "$@"
mime ^ranger/x-terminal-emulator, has mate-terminal = mate-terminal -x "$@"
mime ^ranger/x-terminal-emulator, has xfce4-terminal = xfce4-terminal -x "$@"
mime ^ranger/x-terminal-emulator, has konsole = konsole -e "$@"
mime ^ranger/x-terminal-emulator, has gnome-terminal = gnome-terminal -- "$@"
mime ^ranger/x-terminal-emulator, has xterm = xterm -e "$@"
#-------------------------------------------
# Misc
#-------------------------------------------
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
# The very last action, so that it's never triggered accidentally, is to execute a program:
mime application/x-executable = "$1"

14
.emacs.d/emacs-custom.el Normal file
View File

@ -0,0 +1,14 @@
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-safe-themes
'("2dff5f0b44a9e6c8644b2159414af72261e38686072e063aa66ee98a2faecf0e" default))
'(markdown-command "/usr/bin/pandoc"))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

529
.emacs.d/init.el Normal file
View File

@ -0,0 +1,529 @@
;Packages
;; package archives
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives
'(
("melpa" . "https://melpa.org/packages/")
("ELPA" . "http://tromey.com/elpa/")
("gnu" . "http://elpa.gnu.org/packages/")
("ORG" . "https://orgmode.org/elpa/")
)
)
(package-initialize)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;; Remove welcome screen
(setq inhibit-startup-screen t)
;; Disable menu
(menu-bar-mode 0)
;; Enable IDO mode
(setq ido-enable-flex-matching t)
;;(setq ido-everywhere t)
;;(ido-mode 1)
(global-set-key (kbd "C-x b") 'ido-switch-buffer)
;; Remove working cl
(require 'cl-lib)
(setq byte-compile-warnings '(cl-functions))
(advice-add 'sh-set-shell :around
(lambda (orig-fun &rest args)
(cl-letf (((symbol-function 'message) #'ignore))
(apply orig-fun args))))
;; install use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package)
)
;; Set path to store "custom-set"
(setq custom-file "~/.emacs.d/emacs-custom.el")
;; Enable awesome-tab-mode
(add-to-list 'load-path (expand-file-name "~/.emacs.d/plugins"))
(require 'awesome-tab)
(awesome-tab-mode t)
(use-package awesome-tab
:load-path "~/.emacs.d/plugins"
:config
(awesome-tab-mode t))
(awesome-tab-mode t)
(global-set-key (kbd "C-x j") 'awesome-tab-backward-tab)
(global-set-key (kbd "C-x k") 'awesome-tab-forward-tab)
;; 80-charaters mode
(add-hook 'text-mode-hook 'auto-fill-mode)
(setq-default fill-column 80)
; Global turn on flycheck
(add-hook 'after-init-hook #'global-flycheck-mode)
; Org Files
(add-hook 'org-mode-hook '(lambda () (setq fill-column 80)))
(add-hook 'org-mode-hook 'auto-fill-mode)
(add-hook 'org-mode-hook 'turn-on-flyspell)
;; Latex files
(add-hook 'latex-mode-hook 'turn-on-flyspell)
(setq ispell-dictionary "pl")
;; Broswer
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "browser-x")
;; Switch-window
(use-package switch-window
:ensure t
:config
(setq
switch-window-increase 4
switch-window-input-style 'minibuffer
switch-window-shortcut-style 'qwerty
switch-window-threshold 2
)
(setq
switch-window-qwerty-shortcuts
'( "a" "s" "d" "f" "g" "h" "j" "k" "l")
)
:bind
([remap other-window] . switch-window)
)
;; Enable japanese
(if (condition-case nil (require 'mozc)(error nil))
(setq ecb-be-more-like-better-yes-p t)
(message "Monz not available; not configuring") )
(setq default-input-method "japanese-mozc")
;; Enable Smex
(use-package smex
:ensure t
:init
(smex-initialize)
:bind
("M-x" . smex)
)
;; reveal dependency
(use-package htmlize
:ensure t
)
(use-package ox-reveal
:ensure t
:config
;; maybe add auto-installer in the future
(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js")
)
;; moveline
(use-package move-text
:ensure t
:config)
(global-set-key (kbd "M-<up>") 'move-text-up)
(global-set-key (kbd "M-<down>") 'move-text-down)
;; company
(use-package company
:ensure t
)
(global-company-mode)
;; Shell - bash
(use-package flymake-shellcheck
:ensure t
)
(use-package flycheck-bashate
:ensure t
)
(require 'bash-completion)
(bash-completion-setup)
(use-package flymake-shell
:ensure t
)
(require 'flymake-shell)
(add-hook 'sh-set-shell-hook 'flymake-shell-load)
;; Default font
(defun rc/get-default-font ()
(cond
((eq system-type 'windows-nt) "Consolas-13")
((eq system-type 'gnu/linux) "xos4 Terminus Bold 16")))
(add-to-list 'default-frame-alist `(font . ,(rc/get-default-font)))
;; Theme
(use-package dracula-theme
:ensure t
:config
(load-theme 'dracula t))
;; Sitebar dirred
(use-package dired-sidebar
:ensure t
:commands (dired-sidebar-toggle-sidebar))
(require 'dired-sidebar)
(global-set-key (kbd "C-x d") 'dired-sidebar-toggle-sidebar)
;; Smex
(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
;;buffer-move
(require 'buffer-move)
(global-set-key (kbd "<C-S-up>") 'buf-move-up)
(global-set-key (kbd "<C-S-down>") 'buf-move-down)
(global-set-key (kbd "<C-S-left>") 'buf-move-left)
(global-set-key (kbd "<C-S-right>") 'buf-move-right)
;; Multiple-cursors
(use-package multiple-cursors
:ensure t
:config
)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;; Magit
(use-package magit
:ensure t
:config
)
(global-set-key (kbd "C-x g") 'magit-status)
;; Helpers for easily building Emacs flymake checkers.
(use-package flymake-easy
:ensure t
:config
)
;; Error list
(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
;; Ruby
(use-package flymake-ruby
:ensure t
:config
)
;;robe
(use-package robe
:ensure t
:config
)
(require 'robe)
(add-hook 'ruby-mode-hook 'robe-mode)
(add-hook 'robe-mode-hook 'ac-robe-setup)
(eval-after-load 'company
'(push 'company-robe company-backends))
(require 'flymake-ruby)
(add-hook 'ruby-mode-hook 'flymake-ruby-load)
;; Docker
(use-package dockerfile-mode
:ensure t
:defer t)
;; YAML
(require 'flymake-yaml)
(use-package yaml-mode
:ensure t
:config
)
;; Ansible
(use-package ansible
:ensure t
:config
)
(use-package ansible-doc
:ensure t
:config
)
(use-package company-ansible
:ensure t
:config
)
(add-to-list 'company-backends 'company-ansible)
(add-hook 'yaml-mode-hook '(lambda () (ansible 1)))
(add-hook 'yaml-mode-hook #'ansible-doc-mode)
;; Markdown-mode
(custom-set-variables
'(markdown-command "/usr/bin/pandoc"))
(use-package markdown-mode
:ensure t
:config
)
;; C++ C
(use-package auto-complete-clang
:ensure t
:config
)
;; Apache
(use-package apache-mode
:ensure t
:config
)
;; Haskell
(use-package haskell-mode
:ensure t
:config
)
(use-package flycheck-haskell
:ensure t
:config
)
(add-hook 'flycheck-mode-hook #'flycheck-haskell-setup)
;; Java
;; lsp-install-server
;; jdtls
(use-package lsp-java
:ensure t
:config
(global-set-key (kbd "C-.") 'lsp-execute-code-action)
)
(global-set-key (kbd "<f9>") 'dap-breakpoint-toggle)
(global-set-key (kbd "<f10>") 'dap-next)
(global-set-key (kbd "<f11>") 'dap-step-in)
(global-set-key (kbd "<f12>") 'lsp-jt-browser)
(global-set-key (kbd "<C-f12>") 'dap-stop-thread)
(global-set-key (kbd "<C-?>") 'comment-or-uncomment-region)
(add-hook 'dap-stopped-hook
(lambda (arg) (call-interactively #'dap-hydra)))
(setq dap-auto-configure-features '(sessions locals controls tooltip))
(require 'lsp-java)
(add-hook 'java-mode-hook #'lsp)
(require 'dap-java)
;; Treemacs
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display t
treemacs-file-event-delay 5000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-forward-on-expand nil
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-width 35
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(pcase (cons (not (null (executable-find "git")))
(not (null treemacs-python-executable)))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple))))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-evil
:after treemacs evil
:ensure t)
(use-package treemacs-projectile
:after treemacs projectile
:ensure t)
(use-package treemacs-icons-dired
:after treemacs dired
:ensure t
:config (treemacs-icons-dired-mode))
(use-package treemacs-magit
:after treemacs magit
:ensure t)
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
:after treemacs persp-mode ;;or perspective vs. persp-mode
:ensure t
:config (treemacs-set-scope-type 'Perspectives))
;;; --- Look & Feel ---
;; Helm
(use-package helm
:ensure t
:config
)
(add-hook 'helm-minibuffer-set-up-hook
'helm-hide-minibuffer-maybe)
(setq helm-autoresize-max-height 0)
(setq helm-autoresize-min-height 20)
(helm-autoresize-mode 1)
(helm-mode 1)
;; Disable scroll bar
;; no toolbar:
(if (display-graphic-p)
(progn
(tool-bar-mode -1)
(scroll-bar-mode -1)))
;; Copy
(setq select-active-regions nil)
(setq mouse-drag-copy-region t)
(global-set-key [mouse-2] 'mouse-yank-at-click)
;; Zoom in/out.
(global-set-key (kbd "M-+") 'text-scale-increase)
(global-set-key (kbd "M--") 'text-scale-decrease)
;; line numbers:
(global-display-line-numbers-mode 1)
;; scrolling:
(setq scroll-conservatively 100)
;; Whitespaces
(global-whitespace-mode 1)
(setq whitespace-display-mappings '((space-mark 32 [])))
(set-face-attribute 'whitespace-space nil :background nil :foreground "gray30")
(setq whitespace-style (quote (face tabs spaces trailing space-before-tab newline indentation empty space-after-tab space-mark tab-mark)))
(add-hook 'before-save-hook (lambda () (delete-trailing-whitespace)))
;; no "bell" (audible notification):
(setq ring-bell-function 'ignore)
;; auto reloading (reverting) buffers
(global-auto-revert-mode 1)
;; disable lock files:
(setq create-lockfiles nil)
;; disable autosave:
(setq auto-save-default nil)
;; disable backups:
(setq make-backup-files nil)
;; Pass "y or n" instead of "yes or no"
(defalias 'yes-or-no-p 'y-or-n-p)
;; Highlight parens
(show-paren-mode 1)
;; Candy
(global-prettify-symbols-mode 1)
;; Modeline
(column-number-mode 1)
(size-indication-mode 1)
;; Horizontal splitting
(defun split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1)
)
(global-set-key (kbd "C-x 2") 'split-and-follow-horizontally)
;; Vertical splitting
(defun split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1)
)
(global-set-key (kbd "C-x 3") 'split-and-follow-vertically)
;; Kill & remove split
(defun kill-and-remove-split ()
"Kill and remove split."
(interactive)
(kill-buffer)
(delete-window)
(balance-windows)
(other-window 1)
)
(global-set-key (kbd "C-x x") 'kill-and-remove-split)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,138 @@
;;; buffer-move.el ---
;; Copyright (C) 2004-2014 Lucas Bonnet <lucas@rincevent.net.fr>
;; Author: Lucas Bonnet <lucas@rincevent.net>
;; Keywords: lisp,convenience
;; Version: 0.5
;; URL : https://github.com/lukhas/buffer-move
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
;; 02111-1307, USA.
;;; Commentary:
;; This file is for lazy people wanting to swap buffers without
;; typing C-x b on each window. This is useful when you have :
;; +--------------+-------------+
;; | | |
;; | #emacs | #gnus |
;; | | |
;; +--------------+-------------+
;; | |
;; | .emacs |
;; | |
;; +----------------------------+
;; and you want to have :
;; +--------------+-------------+
;; | | |
;; | #gnus | .emacs |
;; | | |
;; +--------------+-------------+
;; | |
;; | #emacs |
;; | |
;; +----------------------------+
;; With buffer-move, just go in #gnus, do buf-move-left, go to #emacs
;; (which now should be on top right) and do buf-move-down.
;; To use it, simply put a (require 'buffer-move) in your ~/.emacs and
;; define some keybindings. For example, i use :
;; (global-set-key (kbd "<C-S-up>") 'buf-move-up)
;; (global-set-key (kbd "<C-S-down>") 'buf-move-down)
;; (global-set-key (kbd "<C-S-left>") 'buf-move-left)
;; (global-set-key (kbd "<C-S-right>") 'buf-move-right)
;;; Code:
(require 'windmove)
;;;###autoload
(defun buf-move-up ()
"Swap the current buffer and the buffer above the split.
If there is no split, ie now window above the current one, an
error is signaled."
;; "Switches between the current buffer, and the buffer above the
;; split, if possible."
(interactive)
(let* ((other-win (windmove-find-other-window 'up))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No window above this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-down ()
"Swap the current buffer and the buffer under the split.
If there is no split, ie now window under the current one, an
error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'down))
(buf-this-buf (window-buffer (selected-window))))
(if (or (null other-win)
(string-match "^ \\*Minibuf" (buffer-name (window-buffer other-win))))
(error "No window under this one")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-left ()
"Swap the current buffer and the buffer on the left of the split.
If there is no split, ie now window on the left of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'left))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No left split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
;;;###autoload
(defun buf-move-right ()
"Swap the current buffer and the buffer on the right of the split.
If there is no split, ie now window on the right of the current
one, an error is signaled."
(interactive)
(let* ((other-win (windmove-find-other-window 'right))
(buf-this-buf (window-buffer (selected-window))))
(if (null other-win)
(error "No right split")
;; swap top with this one
(set-window-buffer (selected-window) (window-buffer other-win))
;; move this one to top
(set-window-buffer other-win buf-this-buf)
(select-window other-win))))
(provide 'buffer-move)
;;; buffer-move.el ends here

1195
.emacs.d/plugins/dired-sidebar.el Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
;;; flymake-yaml.el --- A flymake handler for YAML
;; Copyright (C) 2013 Yasuyuki Oka
;; Author: Yasuyuki Oka <yasuyk@gmail.com>
;; Version: 0.0.2
;; URL: https://github.com/yasuyk/flymake-yaml
;; Package-Requires: ((flymake-easy "0.1"))
;; Keywords: yaml
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Based in part on http://d.hatena.ne.jp/kitokitoki/20120306/p1
;;
;; Usage:
;;
;; (require 'flymake-yaml) ;; Not necessary if using ELPA package
;; (add-hook 'yaml-mode-hook 'flymake-yaml-load)
;;
;; Uses flymake-easy, from https://github.com/purcell/flymake-easy
;;; Code:
(require 'flymake-easy)
(defconst flymake-yaml-err-line-patterns
;; Syck error message
'(("syntax error on line \\([0-9]+\\), col \\([0-9]+\\): `\\(.*\\)'" nil 1 2 3)
;; Psych error message
(".*: \\(.*\\) at line \\([0-9]+\\) column \\([0-9]+\\)" nil 2 3 1)))
(defun flymake-yaml-command (filename)
"Construct a command that flymake can use to check yaml source.
Argument FILENAME
YAML file name."
(list "ruby" "-ryaml" "-e" "YAML.load(ARGF) rescue warn $!" filename))
;;;###autoload
(defun flymake-yaml-load ()
"Configure flymake mode to check the current buffer's YAML syntax."
(interactive)
(when (eq major-mode 'yaml-mode)
(flymake-easy-load 'flymake-yaml-command
flymake-yaml-err-line-patterns
'tempdir
"yml")))
(provide 'flymake-yaml)
;; Local Variables:
;; coding: utf-8
;; eval: (checkdoc-minor-mode 1)
;; End:
;;; flymake-yaml.el ends here

View File

@ -0,0 +1,27 @@
;;; latexmk-mode.el --- LatexMK minor mode
;;; Commentary:
;;; none
;;; Code:
(define-minor-mode latexmk-mode
"Toggle LatexMK mode."
:init-value nil
:lighter " LatexMK "
)
(defun my/run-latexmk ()
(interactive)
(start-process "latexmk" "latexmk out" "latexmk" "--silent" "--pdf" (buffer-file-name (current-buffer)))
)
(defun my/try-run-latexmk ()
"Try to run latexmk."
(if (bound-and-true-p latexmk-mode)
(my/run-latexmk)
)
)
(add-hook 'after-save-hook 'my/try-run-latexmk)
(add-hook 'latex-mode-hook 'latexmk-mode)
;;; latexmk-mode.el ends here

View File

@ -0,0 +1,75 @@
;;; livedown.el --- Realtime Markdown previews for Emacs.
;; Copyright (C) 2014-2016 Hrvoje Simic
;; Author: Hrvoje Simic <hrvoje@twobucks.co>
;; Version: 1.0.0
;; Keywords: markdown, preview, live
;; URL: https://github.com/shime/emacs-livedown
;;; Commentary:
;; Realtime Markdown previews for Emacs.
;;; Code:
(defgroup livedown nil
"Realtime Markdown previews"
:group 'livedown
:prefix "livedown-")
(defcustom livedown-port 1337
"Port on which livedown server will run."
:type 'integer
:group 'livedown)
(defcustom livedown-open t
"Open browser automatically."
:type 'boolean
:group 'livedown)
(defcustom livedown-browser nil
"Open alternative browser."
:type 'string
:group 'livedown)
(defcustom livedown-autostart nil
"Auto-open previews when opening markdown files."
:type 'boolean
:group 'livedown)
;;;###autoload
(defun livedown-preview ()
"Preview the current file in livedown."
(interactive)
(call-process-shell-command
(format "livedown stop --port %s &"
livedown-port))
(start-process-shell-command
(format "emacs-livedown")
(format "emacs-livedown-buffer")
(format "livedown start %s --port %s %s %s "
buffer-file-name
livedown-port
(if livedown-browser (concat "--browser " livedown-browser) "")
(if livedown-open "--open" "")))
(print (format "%s rendered @ %s" buffer-file-name livedown-port) (get-buffer "emacs-livedown-buffer")))
;;;###autoload
(defun livedown-kill (&optional async)
"Stops the livedown process."
(interactive)
(let ((stop-livedown (if async 'async-shell-command 'call-process-shell-command)))
(funcall stop-livedown
(format "livedown stop --port %s &"
livedown-port))))
(if livedown-autostart
(eval-after-load 'markdown-mode '(livedown-preview)))
(add-hook 'kill-emacs-query-functions (lambda () (livedown-kill t)))
(provide 'livedown)
;;; livedown.el ends here

261
.emacs.d/plugins/org-ac.el Normal file
View File

@ -0,0 +1,261 @@
;;; org-ac.el --- Some auto-complete sources for org-mode
;; Copyright (C) 2014 Hiroaki Otsu
;; Author: Hiroaki Otsu <ootsuhiroaki@gmail.com>
;; Keywords: org, completion
;; URL: https://github.com/aki2o/org-ac
;; Version: 0.0.2
;; Package-Requires: ((auto-complete-pcmp "0.0.1") (log4e "0.2.0") (yaxception "0.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; This extension provides auto-complete sources for org-mode.
;;; Dependency:
;;
;; - auto-complete-pcmp.el ( see <https://github.com/aki2o/auto-complete-pcmp> )
;; - yaxception.el ( see <https://github.com/aki2o/yaxception> )
;; - log4e.el ( see <https://github.com/aki2o/log4e> )
;;; Installation:
;;
;; Put this to your load-path.
;; And put the following lines in your .emacs or site-start.el file.
;;
;; (require 'org-ac)
;;; Configuration:
;;
;; ;; Make config suit for you. About the config item, see Customization or eval the following sexp.
;; ;; (customize-group "org-ac")
;;
;; (org-ac/config-default)
;;; Customization:
;;
;; [EVAL] (autodoc-document-lisp-buffer :type 'user-variable :prefix "org-ac/" :docstring t)
;; `org-ac/ac-trigger-command-keys'
;; Keystrokes for doing `ac-start' with self insert.
;;
;; *** END auto-documentation
;;; API:
;;
;; [EVAL] (autodoc-document-lisp-buffer :type 'command :prefix "org-ac/" :docstring t)
;; `org-ac/setup-current-buffer'
;; Do setup for using org-ac in current buffer.
;;
;; *** END auto-documentation
;; [Note] Functions and variables other than listed above, Those specifications may be changed without notice.
;;; Tested On:
;;
;; - Emacs ... GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-08-22 on chindi02, modified by Debian
;; - auto-complete-pcmp.el ... Version 0.0.1
;; - yaxception.el ... Version 0.1
;; - log4e.el ... Version 0.2.0
;; Enjoy!!!
(eval-when-compile (require 'cl))
(require 'org)
(require 'auto-complete-pcmp)
(require 'rx)
(require 'log4e)
(require 'yaxception)
(defgroup org-ac nil
"Auto completion for org-mode."
:group 'org
:prefix "org-ac/")
(defcustom org-ac/ac-trigger-command-keys '("\\" "*" "SPC" ":" "[" "+")
"Keystrokes for doing `ac-start' with self insert."
:type '(repeat string)
:group 'org-ac)
(log4e:deflogger "org-ac" "%t [%l] %m" "%H:%M:%S" '((fatal . "fatal")
(error . "error")
(warn . "warn")
(info . "info")
(debug . "debug")
(trace . "trace")))
(org-ac--log-set-level 'trace)
(defun* org-ac--show-message (msg &rest args)
(apply 'message (concat "[ORG-AC] " msg) args)
nil)
(defun org-ac--complete-close-option-at-current-point ()
(let ((pt (point)))
(yaxception:$
(yaxception:try
(org-ac--trace "start complete close option at current point")
(when (save-excursion
(re-search-backward "#\\+\\(begin\\|BEGIN\\)_\\([a-zA-Z0-9]+\\) *\\=" nil t))
(let* ((opennm (match-string-no-properties 1))
(typenm (match-string-no-properties 2))
(closenm (cond ((string= opennm "begin") "end")
((string= opennm "BEGIN") "END")))
(case-fold-search t))
(if (or (not (re-search-forward "^[ \t]*#\\+" nil t))
(not (re-search-forward (concat "\\=" closenm "_") nil t)))
(progn (goto-char pt)
(insert "\n#+" closenm "_" typenm)
(org-cycle))
(let ((currtypenm (if (re-search-forward "\\=\\([a-zA-Z0-9]+\\)" nil t)
(match-string-no-properties 1)
"")))
(backward-delete-char (+ (length closenm)
1
(length currtypenm)))
(insert closenm "_" typenm)))
(goto-char pt))))
(yaxception:catch 'error e
(org-ac--show-message "Failed complete close option : %s" (yaxception:get-text e))
(org-ac--error "failed complete close option at current point : %s\n%s"
(yaxception:get-text e)
(yaxception:get-stack-trace-string e))
(goto-char pt)))))
(defun org-ac--get-link-head-candidates ()
(append (ac-pcmp/get-ac-candidates)
(mapcar (lambda (x) (concat x ":")) org-link-types)))
(defvar ac-source-org-ac-tex
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "\\\\\\([a-zA-Z0-9_-]*\\)")
(symbol . "t")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-head
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "[^\r\n*]\\*\\([^\t\r\n]*\\)")
(symbol . "h")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-todo
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^\\*+ \\([a-zA-Z0-9_-]*\\)")
(symbol . "d")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-tag
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "[ \t]:\\([a-zA-Z0-9_-]*\\)")
(symbol . "t")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar org-ac--regexp-link-head (rx-to-string `(and "["
(* (any " \t"))
"["
(group (* (not (any ":*]")))))))
(defvar ac-source-org-ac-link-head
`((candidates . org-ac--get-link-head-candidates)
(prefix . ,org-ac--regexp-link-head)
(symbol . "l")
(requires . 0)
(cache)
(action . (lambda ()
(ac-pcmp/do-ac-action)
(ac-start)))))
(defvar ac-source-org-ac-option
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^[ \t]*#\\+\\([a-zA-Z0-9_:=-]*\\)")
(symbol . "o")
(requires . 0)
(cache)
(action . (lambda ()
(ac-pcmp/do-ac-action)
(org-ac--complete-close-option-at-current-point)
(auto-complete '(ac-source-org-ac-option-key))))))
(defvar ac-source-org-ac-option-key
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^[ \t]*#\\+[a-zA-Z0-9_:=-]+ +\\([a-zA-Z0-9_-]*\\)")
(symbol . "k")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-option-options
'((candidates . ac-pcmp/get-ac-candidates)
(prefix . "^[ \t]*#\\+\\(?:options\\|OPTIONS\\):.* +\\([a-zA-Z0-9_-]*\\)")
(symbol . "x")
(requires . 0)
(cache)
(action . ac-pcmp/do-ac-action)))
(defvar ac-source-org-ac-file
'((init . (setq ac-filename-cache nil))
(candidates . org-ac/file-candidate)
(prefix . "\\[file:\\(.*\\)")
(symbol . "f")
(requires . 0)
(action . ac-start)
(limit . nil)))
;;;###autoload
(defun org-ac/setup-current-buffer ()
"Do setup for using org-ac in current buffer."
(interactive)
(when (eq major-mode 'org-mode)
(loop for stroke in org-ac/ac-trigger-command-keys
do (local-set-key (read-kbd-macro stroke) 'ac-pcmp/self-insert-command-with-ac-start))
(add-to-list 'ac-sources 'ac-source-org-ac-tex)
(add-to-list 'ac-sources 'ac-source-org-ac-head)
(add-to-list 'ac-sources 'ac-source-org-ac-todo)
(add-to-list 'ac-sources 'ac-source-org-ac-tag)
(add-to-list 'ac-sources 'ac-source-org-ac-link-head)
(add-to-list 'ac-sources 'ac-source-org-ac-option)
(add-to-list 'ac-sources 'ac-source-org-ac-option-key)
(add-to-list 'ac-sources 'ac-source-org-ac-option-options)
(add-to-list 'ac-sources 'ac-source-org-ac-file)
(auto-complete-mode t)))
;;;###autoload
(defun org-ac/config-default ()
"Do setting recommemded configuration."
(add-to-list 'ac-modes 'org-mode)
(add-hook 'org-mode-hook 'org-ac/setup-current-buffer t))
(defun org-ac/file-candidate ()
"Adds [file: to the normal file completition, plus allows relative paths"
(if (string-match "^[~./]+" ac-prefix)
(ac-filename-candidate)
(let ((ac-prefix (concat "./" ac-prefix)))
(mapcar (lambda (path) (substring path 2))
(ac-filename-candidate)))))
(provide 'org-ac)
;;; org-ac.el ends here

483
.emacs.d/plugins/smex.el Normal file
View File

@ -0,0 +1,483 @@
;;; smex.el --- M-x interface with Ido-style fuzzy matching. -*- lexical-binding: t; -*-
;; Copyright (C) 2009-2014 Cornelius Mika and contributors
;;
;; Author: Cornelius Mika <cornelius.mika@gmail.com> and contributors
;; URL: http://github.com/nonsequitur/smex/
;; Package-Requires: ((emacs "24"))
;; Version: 3.0
;; Keywords: convenience, usability
;; This file is not part of GNU Emacs.
;;; License:
;; Licensed under the same terms as Emacs.
;;; Commentary:
;; Quick start:
;; run (smex-initialize)
;;
;; Bind the following commands:
;; smex, smex-major-mode-commands
;;
;; For a detailed introduction see:
;; http://github.com/nonsequitur/smex/blob/master/README.markdown
;;; Code:
(require 'ido)
(defgroup smex nil
"M-x interface with Ido-style fuzzy matching and ranking heuristics."
:group 'extensions
:group 'convenience
:link '(emacs-library-link :tag "Lisp File" "smex.el"))
(defcustom smex-auto-update t
"If non-nil, `Smex' checks for new commands each time it is run.
Turn it off for minor speed improvements on older systems."
:type 'boolean
:group 'smex)
(defcustom smex-save-file (locate-user-emacs-file "smex-items" ".smex-items")
"File in which the smex state is saved between Emacs sessions.
Variables stored are: `smex-data', `smex-history'.
Must be set before initializing Smex."
:type 'string
:group 'smex)
(defcustom smex-history-length 7
"Determines on how many recently executed commands
Smex should keep a record.
Must be set before initializing Smex."
:type 'integer
:group 'smex)
(defcustom smex-prompt-string "M-x "
"String to display in the Smex prompt."
:type 'string
:group 'smex)
(defcustom smex-flex-matching t
"Enables Ido flex matching. On by default.
Set this to nil to disable fuzzy matching."
:type 'boolean
:group 'smex)
(defvar smex-initialized-p nil)
(defvar smex-cache)
(defvar smex-ido-cache)
(defvar smex-data)
(defvar smex-history)
(defvar smex-command-count 0)
(defvar smex-custom-action nil)
;; Check if Smex is supported
(when (equal (cons 1 1)
(ignore-errors
(subr-arity (symbol-function 'execute-extended-command))))
(error "Your Emacs has a non-elisp version of `execute-extended-command', which is incompatible with Smex"))
;;--------------------------------------------------------------------------------
;; Smex Interface
;;;###autoload
(defun smex ()
(interactive)
(unless smex-initialized-p
(smex-initialize))
(if (smex-already-running)
(smex-update-and-rerun)
(and smex-auto-update
(smex-detect-new-commands)
(smex-update))
(smex-read-and-run smex-ido-cache)))
(defun smex-already-running ()
(and (boundp 'ido-choice-list)
(eql ido-choice-list smex-ido-cache)
(minibuffer-window-active-p (selected-window))))
(defun smex-update-and-rerun ()
(smex-do-with-selected-item
(lambda (_) (smex-update) (smex-read-and-run smex-ido-cache ido-text))))
(defun smex-read-and-run (commands &optional initial-input)
(let* ((chosen-item-name (smex-completing-read commands initial-input))
(chosen-item (intern chosen-item-name)))
(if smex-custom-action
(let ((action smex-custom-action))
(setq smex-custom-action nil)
(funcall action chosen-item))
(unwind-protect
(with-no-warnings ; Don't warn about interactive use of `execute-extended-command'
(execute-extended-command current-prefix-arg chosen-item-name))
(smex-rank chosen-item)))))
;;;###autoload
(defun smex-major-mode-commands ()
"Like `smex', but limited to commands that are relevant to the active major mode."
(interactive)
(unless smex-initialized-p
(smex-initialize))
(let ((commands (delete-dups (append (smex-extract-commands-from-keymap (current-local-map))
(smex-extract-commands-from-features major-mode)))))
(setq commands (smex-sort-according-to-cache commands))
(setq commands (mapcar #'symbol-name commands))
(smex-read-and-run commands)))
(defun smex-completing-read (choices initial-input)
(let ((ido-completion-map ido-completion-map)
(ido-setup-hook (cons 'smex-prepare-ido-bindings ido-setup-hook))
(ido-enable-prefix nil)
(ido-enable-flex-matching smex-flex-matching)
(ido-max-prospects 10)
(minibuffer-completion-table choices))
(ido-completing-read (smex-prompt-with-prefix-arg) choices nil nil
initial-input 'extended-command-history (car choices))))
(defun smex-prompt-with-prefix-arg ()
(if (not current-prefix-arg)
smex-prompt-string
(concat
(if (eq current-prefix-arg '-)
"- "
(if (integerp current-prefix-arg)
(format "%d " current-prefix-arg)
(if (= (car current-prefix-arg) 4)
"C-u "
(format "%d " (car current-prefix-arg)))))
smex-prompt-string)))
(defun smex-prepare-ido-bindings ()
(define-key ido-completion-map (kbd "TAB") 'minibuffer-complete)
(define-key ido-completion-map (kbd "C-h f") 'smex-describe-function)
(define-key ido-completion-map (kbd "C-h w") 'smex-where-is)
(define-key ido-completion-map (kbd "M-.") 'smex-find-function)
(define-key ido-completion-map (kbd "C-a") 'move-beginning-of-line))
;;--------------------------------------------------------------------------------
;; Cache and Maintenance
(defun smex-rebuild-cache ()
(interactive)
(setq smex-cache nil)
;; Build up list 'new-commands' and later put it at the end of 'smex-cache'.
;; This speeds up sorting.
(let (new-commands)
(mapatoms (lambda (symbol)
(when (commandp symbol)
(let ((known-command (assq symbol smex-data)))
(if known-command
(setq smex-cache (cons known-command smex-cache))
(setq new-commands (cons (list symbol) new-commands)))))))
(if (eq (length smex-cache) 0)
(setq smex-cache new-commands)
(setcdr (last smex-cache) new-commands)))
(setq smex-cache (sort smex-cache 'smex-sorting-rules))
(smex-restore-history)
(setq smex-ido-cache (smex-convert-for-ido smex-cache)))
(defun smex-convert-for-ido (command-items)
(mapcar (lambda (command-item) (symbol-name (car command-item))) command-items))
(defun smex-restore-history ()
"Rearranges `smex-cache' according to `smex-history'"
(if (> (length smex-history) smex-history-length)
(setcdr (nthcdr (- smex-history-length 1) smex-history) nil))
(mapc (lambda (command)
(unless (eq command (caar smex-cache))
(let ((command-cell-position (smex-detect-position
smex-cache
(lambda (cell)
(eq command (caar cell))))))
(when command-cell-position
(let ((command-cell (smex-remove-nth-cell
command-cell-position smex-cache)))
(setcdr command-cell smex-cache)
(setq smex-cache command-cell))))))
(reverse smex-history)))
(defun smex-sort-according-to-cache (list)
"Sorts a list of commands by their order in `smex-cache'"
(let (sorted)
(dolist (command-item smex-cache)
(let ((command (car command-item)))
(when (memq command list)
(setq sorted (cons command sorted))
(setq list (delq command list)))))
(nreverse (append list sorted))))
(defun smex-update ()
(interactive)
(smex-save-history)
(smex-rebuild-cache))
(defun smex-detect-new-commands ()
(let ((i 0))
(mapatoms (lambda (symbol) (if (commandp symbol) (setq i (1+ i)))))
(unless (= i smex-command-count)
(setq smex-command-count i))))
(defun smex-auto-update (&optional idle-time)
"Update Smex when Emacs has been idle for IDLE-TIME."
(unless idle-time (setq idle-time 60))
(run-with-idle-timer idle-time t
'(lambda () (if (smex-detect-new-commands) (smex-update)))))
;;;###autoload
(defun smex-initialize ()
(interactive)
(unless ido-mode (smex-initialize-ido))
(smex-load-save-file)
(smex-detect-new-commands)
(smex-rebuild-cache)
(add-hook 'kill-emacs-hook 'smex-save-to-file)
(setq smex-initialized-p t))
(defun smex-initialize-ido ()
"Sets up a minimal Ido environment for `ido-completing-read'."
(with-no-warnings ; `ido-init-completion-maps' is deprecated in Emacs 25
(ido-init-completion-maps))
(add-hook 'minibuffer-setup-hook 'ido-minibuffer-setup))
(defsubst smex-save-file-not-empty-p ()
(string-match-p "\[^[:space:]\]" (buffer-string)))
(defun smex-load-save-file ()
"Loads `smex-history' and `smex-data' from `smex-save-file'"
(let ((save-file (expand-file-name smex-save-file)))
(if (file-readable-p save-file)
(with-temp-buffer
(insert-file-contents save-file)
(condition-case nil
(setq smex-history (read (current-buffer))
smex-data (read (current-buffer)))
(error (if (smex-save-file-not-empty-p)
(error "Invalid data in smex-save-file (%s). Can't restore history."
smex-save-file)
(unless (boundp 'smex-history) (setq smex-history nil))
(unless (boundp 'smex-data) (setq smex-data nil))))))
(setq smex-history nil smex-data nil))))
(defun smex-save-history ()
"Updates `smex-history'"
(setq smex-history nil)
(let ((cell smex-cache))
(dotimes (_ smex-history-length)
(setq smex-history (cons (caar cell) smex-history))
(setq cell (cdr cell))))
(setq smex-history (nreverse smex-history)))
(defmacro smex-pp (list-var)
`(smex-pp* ,list-var ,(symbol-name list-var)))
(defun smex-save-to-file ()
(interactive)
(smex-save-history)
(with-temp-file (expand-file-name smex-save-file)
(smex-pp smex-history)
(smex-pp smex-data)))
;;--------------------------------------------------------------------------------
;; Ranking
(defun smex-sorting-rules (command-item other-command-item)
"Returns true if COMMAND-ITEM should sort before OTHER-COMMAND-ITEM."
(let* ((count (or (cdr command-item ) 0))
(other-count (or (cdr other-command-item) 0))
(name (car command-item))
(other-name (car other-command-item))
(length (length (symbol-name name)))
(other-length (length (symbol-name other-name))))
(or (> count other-count) ; 1. Frequency of use
(and (= count other-count)
(or (< length other-length) ; 2. Command length
(and (= length other-length)
(string< name other-name))))))) ; 3. Alphabetical order
(defun smex-rank (command)
(let ((command-item (or (assq command smex-cache)
;; Update caches and try again if not found.
(progn (smex-update)
(assq command smex-cache)))))
(when command-item
(smex-update-counter command-item)
;; Don't touch the cache order if the chosen command
;; has just been execucted previously.
(unless (eq command-item (car smex-cache))
(let (command-cell
(pos (smex-detect-position smex-cache (lambda (cell)
(eq command-item (car cell))))))
;; Remove the just executed command.
(setq command-cell (smex-remove-nth-cell pos smex-cache))
;; And put it on top of the cache.
(setcdr command-cell smex-cache)
(setq smex-cache command-cell)
;; Repeat the same for the ido cache. Should this be DRYed?
(setq command-cell (smex-remove-nth-cell pos smex-ido-cache))
(setcdr command-cell smex-ido-cache)
(setq smex-ido-cache command-cell)
;; Now put the last history item back to its normal place.
(smex-sort-item-at smex-history-length))))))
(defun smex-update-counter (command-item)
(let ((count (cdr command-item)))
(setcdr command-item
(if count
(1+ count)
;; Else: Command has just been executed for the first time.
;; Add it to `smex-data'.
(if smex-data
(setcdr (last smex-data) (list command-item))
(setq smex-data (list command-item)))
1))))
(defun smex-sort-item-at (n)
"Sorts item at position N in `smex-cache'."
(let* ((command-cell (nthcdr n smex-cache))
(command-item (car command-cell)))
(let ((insert-at (smex-detect-position
command-cell
(lambda (cell)
(smex-sorting-rules command-item (car cell))))))
;; TODO: Should we handle the case of 'insert-at' being nil?
;; This will never happen in practice.
(when (> insert-at 1)
(setq command-cell (smex-remove-nth-cell n smex-cache))
;; smex-cache just got shorter by one element, so subtract '1' from insert-at.
(setq insert-at (+ n (- insert-at 1)))
(smex-insert-cell command-cell insert-at smex-cache)
;; Repeat the same for the ido cache. DRY?
(setq command-cell (smex-remove-nth-cell n smex-ido-cache))
(smex-insert-cell command-cell insert-at smex-ido-cache)))))
(defun smex-detect-position (cell function)
"Detects, relatively to CELL, the position of the cell
on which FUNCTION returns true.
Only checks cells after CELL, starting with the cell right after CELL.
Returns nil when reaching the end of the list."
(let ((pos 1))
(catch 'break
(while t
(setq cell (cdr cell))
(if (not cell)
(throw 'break nil)
(if (funcall function cell) (throw 'break pos))
(setq pos (1+ pos)))))))
(defun smex-remove-nth-cell (n list)
"Removes and returns the Nth cell in LIST."
(let* ((previous-cell (nthcdr (- n 1) list))
(result (cdr previous-cell)))
(setcdr previous-cell (cdr result))
result))
(defun smex-insert-cell (new-cell n list)
"Inserts cell at position N in LIST."
(let* ((cell (nthcdr (- n 1) list))
(next-cell (cdr cell)))
(setcdr (setcdr cell new-cell) next-cell)))
;;--------------------------------------------------------------------------------
;; Help and Reference
(defun smex-do-with-selected-item (fn)
(setq smex-custom-action fn)
(ido-exit-minibuffer))
(defun smex-describe-function ()
(interactive)
(smex-do-with-selected-item (lambda (chosen)
(describe-function chosen)
(pop-to-buffer "*Help*"))))
(defun smex-where-is ()
(interactive)
(smex-do-with-selected-item 'where-is))
(defun smex-find-function ()
(interactive)
(smex-do-with-selected-item 'find-function))
(defun smex-extract-commands-from-keymap (map)
(let (commands)
(smex-parse-keymap map commands)
commands))
(defun smex-parse-keymap (map commands)
(map-keymap (lambda (_binding element)
(if (and (listp element) (eq 'keymap (car element)))
(smex-parse-keymap element commands)
;; Strings are commands, too. Reject them.
(if (and (symbolp element) (commandp element))
(push element commands))))
map))
(defun smex-extract-commands-from-features (mode)
(let ((library-path (symbol-file mode))
(mode-name (symbol-name mode))
commands)
(string-match "\\(.+?\\)\\(-mode\\)?$" mode-name)
;; 'lisp-mode' -> 'lisp'
(setq mode-name (match-string 1 mode-name))
(if (string= mode-name "c") (setq mode-name "cc"))
(setq mode-name (regexp-quote mode-name))
(dolist (feature load-history)
(let ((feature-path (car feature)))
(when (and feature-path (or (equal feature-path library-path)
(string-match mode-name (file-name-nondirectory
feature-path))))
(dolist (item (cdr feature))
(if (and (listp item) (eq 'defun (car item)))
(let ((function (cdr item)))
(when (commandp function)
(setq commands (append commands (list function))))))))))
commands))
(defun smex-show-unbound-commands ()
"Shows unbound commands in a new buffer,
sorted by frequency of use."
(interactive)
(setq smex-data (sort smex-data 'smex-sorting-rules))
(let ((unbound-commands (delq nil
(mapcar (lambda (command-item)
(unless (where-is-internal (car command-item))
command-item))
smex-data))))
(view-buffer-other-window "*Smex: Unbound Commands*")
(setq buffer-read-only t)
(let ((inhibit-read-only t))
(erase-buffer)
(smex-pp unbound-commands))
(set-buffer-modified-p nil)
(goto-char (point-min))))
;; A copy of `ido-pp' that's compatible with lexical bindings
(defun smex-pp* (list list-name)
(let ((print-level nil) (eval-expression-print-level nil)
(print-length nil) (eval-expression-print-length nil))
(insert "\n;; ----- " list-name " -----\n(\n ")
(while list
(let* ((elt (car list))
(s (if (consp elt) (car elt) elt)))
(if (and (stringp s) (= (length s) 0))
(setq s nil))
(if s
(prin1 elt (current-buffer)))
(if (and (setq list (cdr list)) s)
(insert "\n "))))
(insert "\n)\n")))
(provide 'smex)
;;; smex.el ends here

42
.emacs.d/smex-items Normal file
View File

@ -0,0 +1,42 @@
;; ----- smex-history -----
(
goto-line
overwrite-mode
shell
load-theme
treemacs
inf-ruby-console-auto
compile
)
;; ----- smex-data -----
(
(lsp-install-server . 6)
(treemacs . 17)
(lsp-java-update-server . 1)
(set-frame-font . 1)
(lsp-jt-browser . 6)
(sort-lines . 5)
(lsp-jt-report-open . 17)
(treemacs-edit-workspaces . 2)
(treemacs-refresh . 1)
(treemacs-mode . 3)
(menu-set-font . 2)
(magit-commit . 1)
(column-number-mode . 1)
(set-fill-column . 3)
(dap-java-debug . 7)
(ruby-indent-exp . 1)
(ruby-indent-line . 1)
(ruby-mode-menu . 1)
(inf-ruby-console-auto . 8)
(shell . 4)
(package-install-selected-packages . 1)
(package-install . 1)
(compile . 2)
(lsp-mode . 2)
(load-theme . 14)
(overwrite-mode . 1)
(goto-line . 2)
)

6
.emacs.d/tramp Normal file
View File

@ -0,0 +1,6 @@
;; -*- emacs-lisp -*- <21/03/22 00:03:53 /home/yorune/.emacs.d/tramp>
;; Tramp connection history. Don't change this file.
;; Run `M-x tramp-cleanup-all-connections' instead.
(((tramp-file-name "sudo" "root" nil "Gentoo" nil nil nil)
nil))

View File

@ -0,0 +1,3 @@
((magit-commit nil)
(magit-dispatch nil)
(magit-push nil))

104
.local/bin/Checking-repo Executable file
View File

@ -0,0 +1,104 @@
#!/usr/bin/env bash
####################################################
#
# SRC_PREPARE
#
# Marcin Woźniak
# y0rune@aol.com
#
# Last edit: 16-09-2020
#
###################################################
mainteiner="Marcin Woźniak"
function scanning(){
EUSCAN=$(euscan --nocolor --quiet "$1")
if [ -n "$EUSCAN" ]; then
echo $1
echo "=============== NOW: $(find ./* -mindepth 2 -maxdepth 2 -name ''"$1"'*.ebuild' | sort | tail -1) =================
$(echo -e "$EUSCAN" | tail -1)"
sleep 1
fi
}
function folder(){
cd "$1"; git pull || exit
PACKAGES=()
for FILE in */*
do
PACKAGE=$(echo "$FILE" | grep -Eo '[A-z0-9_-]+$')
PACKAGES+=("$PACKAGE")
done
for i in "${PACKAGES[@]}"
do
scanning "$i" &
done
for j in $(jobs -p)
do
wait "$j"
done
echo -n ">>> Done scanning $1"
}
function nofolder(){
if [ -z "${1}" ]; then
echo "No overlay names given"
echo "Please give at least one overlay name as a commandline argument"
echo "Exiting"
exit 1
fi
for overlay in "${@}"
do
for ebuild in $(EIX_LIMIT=0 eix --only-names --in-overlay "${overlay}")
do
euscan --nocolor --quiet "${ebuild}" &
sleep 1
done
for j in $(jobs -p)
do
wait "$j"
done
echo -n ">>> Done scanning ${overlay}"
done
}
function help(){
echo "You can use:"
echo "* -r or --repo <HERE-REPO-NAME>"
echo "* -f or --folder <FOLDER-NAME>"
echo
echo "Example of usage"
echo "./logeuscan -r src_prepare-overlay"
echo "./logeuscan -f ~/git/src_prepare-overlay"
}
function main(){
[ "$(whereis eix | wc -w)" -le "1" ] && { echo "The eix is NOT installed"; exit; }
[ "$(whereis euscan | wc -w)" -le "1" ] && { echo "The euscan is NOT installed"; exit; }
case $1 in
-h|--help)
help
;;
-r|--repo)
nofolder "$2" | tee -a "euscan-$(date -I).log"
;;
-f|--folder)
folder "$2" | tee -a "euscan-$(date -I).log"
;;
*)
echo "No found variable"; echo; help
esac
}
main "$@"

1
.local/bin/Logs Symbolic link
View File

@ -0,0 +1 @@
emerge-logs

Binary file not shown.

177
.local/bin/ansible Executable file
View File

@ -0,0 +1,177 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
# PYTHON_ARGCOMPLETE_OK
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__requires__ = ['ansible_core']
import errno
import os
import shutil
import sys
import traceback
from ansible import context
from ansible.errors import AnsibleError, AnsibleOptionsError, AnsibleParserError
from ansible.module_utils._text import to_text
# Used for determining if the system is running a new enough python version
# and should only restrict on our documented minimum versions
_PY38_MIN = sys.version_info[:2] >= (3, 8)
_PY3_MIN = sys.version_info[:2] >= (3, 5)
_PY2_MIN = (2, 6) <= sys.version_info[:2] < (3,)
_PY_MIN = _PY3_MIN or _PY2_MIN
if not _PY_MIN:
raise SystemExit('ERROR: Ansible requires a minimum of Python2 version 2.6 or Python3 version 3.5. Current version: %s' % ''.join(sys.version.splitlines()))
class LastResort(object):
# OUTPUT OF LAST RESORT
def display(self, msg, log_only=None):
print(msg, file=sys.stderr)
def error(self, msg, wrap_text=None):
print(msg, file=sys.stderr)
if __name__ == '__main__':
display = LastResort()
try: # bad ANSIBLE_CONFIG or config options can force ugly stacktrace
import ansible.constants as C
from ansible.utils.display import Display, initialize_locale
except AnsibleOptionsError as e:
display.error(to_text(e), wrap_text=False)
sys.exit(5)
initialize_locale()
cli = None
me = os.path.basename(sys.argv[0])
try:
display = Display()
if C.CONTROLLER_PYTHON_WARNING and not _PY38_MIN:
display.deprecated(
(
'Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. '
'Current version: %s' % ''.join(sys.version.splitlines())
),
version='2.12',
collection_name='ansible.builtin',
)
display.debug("starting run")
sub = None
target = me.split('-')
if target[-1][0].isdigit():
# Remove any version or python version info as downstreams
# sometimes add that
target = target[:-1]
if len(target) > 1:
sub = target[1]
myclass = "%sCLI" % sub.capitalize()
elif target[0] == 'ansible':
sub = 'adhoc'
myclass = 'AdHocCLI'
else:
raise AnsibleError("Unknown Ansible alias: %s" % me)
try:
mycli = getattr(__import__("ansible.cli.%s" % sub, fromlist=[myclass]), myclass)
except ImportError as e:
# ImportError members have changed in py3
if 'msg' in dir(e):
msg = e.msg
else:
msg = e.message
if msg.endswith(' %s' % sub):
raise AnsibleError("Ansible sub-program not implemented: %s" % me)
else:
raise
b_ansible_dir = os.path.expanduser(os.path.expandvars(b"~/.ansible"))
try:
os.mkdir(b_ansible_dir, 0o700)
except OSError as exc:
if exc.errno != errno.EEXIST:
display.warning("Failed to create the directory '%s': %s"
% (to_text(b_ansible_dir, errors='surrogate_or_replace'),
to_text(exc, errors='surrogate_or_replace')))
else:
display.debug("Created the '%s' directory" % to_text(b_ansible_dir, errors='surrogate_or_replace'))
try:
args = [to_text(a, errors='surrogate_or_strict') for a in sys.argv]
except UnicodeError:
display.error('Command line args are not in utf-8, unable to continue. Ansible currently only understands utf-8')
display.display(u"The full traceback was:\n\n%s" % to_text(traceback.format_exc()))
exit_code = 6
else:
cli = mycli(args)
exit_code = cli.run()
except AnsibleOptionsError as e:
cli.parser.print_help()
display.error(to_text(e), wrap_text=False)
exit_code = 5
except AnsibleParserError as e:
display.error(to_text(e), wrap_text=False)
exit_code = 4
# TQM takes care of these, but leaving comment to reserve the exit codes
# except AnsibleHostUnreachable as e:
# display.error(str(e))
# exit_code = 3
# except AnsibleHostFailed as e:
# display.error(str(e))
# exit_code = 2
except AnsibleError as e:
display.error(to_text(e), wrap_text=False)
exit_code = 1
except KeyboardInterrupt:
display.error("User interrupted execution")
exit_code = 99
except Exception as e:
if C.DEFAULT_DEBUG:
# Show raw stacktraces in debug mode, It also allow pdb to
# enter post mortem mode.
raise
have_cli_options = bool(context.CLIARGS)
display.error("Unexpected Exception, this is probably a bug: %s" % to_text(e), wrap_text=False)
if not have_cli_options or have_cli_options and context.CLIARGS['verbosity'] > 2:
log_only = False
if hasattr(e, 'orig_exc'):
display.vvv('\nexception type: %s' % to_text(type(e.orig_exc)))
why = to_text(e.orig_exc)
if to_text(e) != why:
display.vvv('\noriginal msg: %s' % why)
else:
display.display("to see the full traceback, use -vvv")
log_only = True
display.display(u"the full traceback was:\n\n%s" % to_text(traceback.format_exc()), log_only=log_only)
exit_code = 250
sys.exit(exit_code)

1
.local/bin/ansible-config Symbolic link
View File

@ -0,0 +1 @@
ansible

342
.local/bin/ansible-connection Executable file
View File

@ -0,0 +1,342 @@
#!/usr/bin/python3
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
__requires__ = ['ansible_core']
import fcntl
import hashlib
import os
import signal
import socket
import sys
import time
import traceback
import errno
import json
from contextlib import contextmanager
from ansible import constants as C
from ansible.module_utils._text import to_bytes, to_text
from ansible.module_utils.six import PY3
from ansible.module_utils.six.moves import cPickle, StringIO
from ansible.module_utils.connection import Connection, ConnectionError, send_data, recv_data
from ansible.module_utils.service import fork_process
from ansible.parsing.ajson import AnsibleJSONEncoder, AnsibleJSONDecoder
from ansible.playbook.play_context import PlayContext
from ansible.plugins.loader import connection_loader
from ansible.utils.path import unfrackpath, makedirs_safe
from ansible.utils.display import Display
from ansible.utils.jsonrpc import JsonRpcServer
def read_stream(byte_stream):
size = int(byte_stream.readline().strip())
data = byte_stream.read(size)
if len(data) < size:
raise Exception("EOF found before data was complete")
data_hash = to_text(byte_stream.readline().strip())
if data_hash != hashlib.sha1(data).hexdigest():
raise Exception("Read {0} bytes, but data did not match checksum".format(size))
# restore escaped loose \r characters
data = data.replace(br'\r', b'\r')
return data
@contextmanager
def file_lock(lock_path):
"""
Uses contextmanager to create and release a file lock based on the
given path. This allows us to create locks using `with file_lock()`
to prevent deadlocks related to failure to unlock properly.
"""
lock_fd = os.open(lock_path, os.O_RDWR | os.O_CREAT, 0o600)
fcntl.lockf(lock_fd, fcntl.LOCK_EX)
yield
fcntl.lockf(lock_fd, fcntl.LOCK_UN)
os.close(lock_fd)
class ConnectionProcess(object):
'''
The connection process wraps around a Connection object that manages
the connection to a remote device that persists over the playbook
'''
def __init__(self, fd, play_context, socket_path, original_path, task_uuid=None, ansible_playbook_pid=None):
self.play_context = play_context
self.socket_path = socket_path
self.original_path = original_path
self._task_uuid = task_uuid
self.fd = fd
self.exception = None
self.srv = JsonRpcServer()
self.sock = None
self.connection = None
self._ansible_playbook_pid = ansible_playbook_pid
def start(self, variables):
try:
messages = list()
result = {}
messages.append(('vvvv', 'control socket path is %s' % self.socket_path))
# If this is a relative path (~ gets expanded later) then plug the
# key's path on to the directory we originally came from, so we can
# find it now that our cwd is /
if self.play_context.private_key_file and self.play_context.private_key_file[0] not in '~/':
self.play_context.private_key_file = os.path.join(self.original_path, self.play_context.private_key_file)
self.connection = connection_loader.get(self.play_context.connection, self.play_context, '/dev/null',
task_uuid=self._task_uuid, ansible_playbook_pid=self._ansible_playbook_pid)
self.connection.set_options(var_options=variables)
self.connection._socket_path = self.socket_path
self.srv.register(self.connection)
messages.extend([('vvvv', msg) for msg in sys.stdout.getvalue().splitlines()])
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.sock.bind(self.socket_path)
self.sock.listen(1)
messages.append(('vvvv', 'local domain socket listeners started successfully'))
except Exception as exc:
messages.extend(self.connection.pop_messages())
result['error'] = to_text(exc)
result['exception'] = traceback.format_exc()
finally:
result['messages'] = messages
self.fd.write(json.dumps(result, cls=AnsibleJSONEncoder))
self.fd.close()
def run(self):
try:
while not self.connection._conn_closed:
signal.signal(signal.SIGALRM, self.connect_timeout)
signal.signal(signal.SIGTERM, self.handler)
signal.alarm(self.connection.get_option('persistent_connect_timeout'))
self.exception = None
(s, addr) = self.sock.accept()
signal.alarm(0)
signal.signal(signal.SIGALRM, self.command_timeout)
while True:
data = recv_data(s)
if not data:
break
log_messages = self.connection.get_option('persistent_log_messages')
if log_messages:
display.display("jsonrpc request: %s" % data, log_only=True)
request = json.loads(to_text(data, errors='surrogate_or_strict'))
if request.get('method') == "exec_command" and not self.connection.connected:
self.connection._connect()
signal.alarm(self.connection.get_option('persistent_command_timeout'))
resp = self.srv.handle_request(data)
signal.alarm(0)
if log_messages:
display.display("jsonrpc response: %s" % resp, log_only=True)
send_data(s, to_bytes(resp))
s.close()
except Exception as e:
# socket.accept() will raise EINTR if the socket.close() is called
if hasattr(e, 'errno'):
if e.errno != errno.EINTR:
self.exception = traceback.format_exc()
else:
self.exception = traceback.format_exc()
finally:
# allow time for any exception msg send over socket to receive at other end before shutting down
time.sleep(0.1)
# when done, close the connection properly and cleanup the socket file so it can be recreated
self.shutdown()
def connect_timeout(self, signum, frame):
msg = 'persistent connection idle timeout triggered, timeout value is %s secs.\nSee the timeout setting options in the Network Debug and ' \
'Troubleshooting Guide.' % self.connection.get_option('persistent_connect_timeout')
display.display(msg, log_only=True)
raise Exception(msg)
def command_timeout(self, signum, frame):
msg = 'command timeout triggered, timeout value is %s secs.\nSee the timeout setting options in the Network Debug and Troubleshooting Guide.'\
% self.connection.get_option('persistent_command_timeout')
display.display(msg, log_only=True)
raise Exception(msg)
def handler(self, signum, frame):
msg = 'signal handler called with signal %s.' % signum
display.display(msg, log_only=True)
raise Exception(msg)
def shutdown(self):
""" Shuts down the local domain socket
"""
lock_path = unfrackpath("%s/.ansible_pc_lock_%s" % os.path.split(self.socket_path))
if os.path.exists(self.socket_path):
try:
if self.sock:
self.sock.close()
if self.connection:
self.connection.close()
if self.connection.get_option("persistent_log_messages"):
for _level, message in self.connection.pop_messages():
display.display(message, log_only=True)
except Exception:
pass
finally:
if os.path.exists(self.socket_path):
os.remove(self.socket_path)
setattr(self.connection, '_socket_path', None)
setattr(self.connection, '_connected', False)
if os.path.exists(lock_path):
os.remove(lock_path)
display.display('shutdown complete', log_only=True)
def main():
""" Called to initiate the connect to the remote device
"""
rc = 0
result = {}
messages = list()
socket_path = None
# Need stdin as a byte stream
if PY3:
stdin = sys.stdin.buffer
else:
stdin = sys.stdin
# Note: update the below log capture code after Display.display() is refactored.
saved_stdout = sys.stdout
sys.stdout = StringIO()
try:
# read the play context data via stdin, which means depickling it
vars_data = read_stream(stdin)
init_data = read_stream(stdin)
if PY3:
pc_data = cPickle.loads(init_data, encoding='bytes')
variables = cPickle.loads(vars_data, encoding='bytes')
else:
pc_data = cPickle.loads(init_data)
variables = cPickle.loads(vars_data)
play_context = PlayContext()
play_context.deserialize(pc_data)
display.verbosity = play_context.verbosity
except Exception as e:
rc = 1
result.update({
'error': to_text(e),
'exception': traceback.format_exc()
})
if rc == 0:
ssh = connection_loader.get('ssh', class_only=True)
ansible_playbook_pid = sys.argv[1]
task_uuid = sys.argv[2]
cp = ssh._create_control_path(play_context.remote_addr, play_context.port, play_context.remote_user, play_context.connection, ansible_playbook_pid)
# create the persistent connection dir if need be and create the paths
# which we will be using later
tmp_path = unfrackpath(C.PERSISTENT_CONTROL_PATH_DIR)
makedirs_safe(tmp_path)
socket_path = unfrackpath(cp % dict(directory=tmp_path))
lock_path = unfrackpath("%s/.ansible_pc_lock_%s" % os.path.split(socket_path))
with file_lock(lock_path):
if not os.path.exists(socket_path):
messages.append(('vvvv', 'local domain socket does not exist, starting it'))
original_path = os.getcwd()
r, w = os.pipe()
pid = fork_process()
if pid == 0:
try:
os.close(r)
wfd = os.fdopen(w, 'w')
process = ConnectionProcess(wfd, play_context, socket_path, original_path, task_uuid, ansible_playbook_pid)
process.start(variables)
except Exception:
messages.append(('error', traceback.format_exc()))
rc = 1
if rc == 0:
process.run()
else:
process.shutdown()
sys.exit(rc)
else:
os.close(w)
rfd = os.fdopen(r, 'r')
data = json.loads(rfd.read(), cls=AnsibleJSONDecoder)
messages.extend(data.pop('messages'))
result.update(data)
else:
messages.append(('vvvv', 'found existing local domain socket, using it!'))
conn = Connection(socket_path)
conn.set_options(var_options=variables)
pc_data = to_text(init_data)
try:
conn.update_play_context(pc_data)
conn.set_check_prompt(task_uuid)
except Exception as exc:
# Only network_cli has update_play context and set_check_prompt, so missing this is
# not fatal e.g. netconf
if isinstance(exc, ConnectionError) and getattr(exc, 'code', None) == -32601:
pass
else:
result.update({
'error': to_text(exc),
'exception': traceback.format_exc()
})
if os.path.exists(socket_path):
messages.extend(Connection(socket_path).pop_messages())
messages.append(('vvvv', sys.stdout.getvalue()))
result.update({
'messages': messages,
'socket_path': socket_path
})
sys.stdout = saved_stdout
if 'exception' in result:
rc = 1
sys.stderr.write(json.dumps(result, cls=AnsibleJSONEncoder))
else:
rc = 0
sys.stdout.write(json.dumps(result, cls=AnsibleJSONEncoder))
sys.exit(rc)
if __name__ == '__main__':
display = Display()
main()

1
.local/bin/ansible-console Symbolic link
View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-doc Symbolic link
View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-galaxy Symbolic link
View File

@ -0,0 +1 @@
ansible

View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-playbook Symbolic link
View File

@ -0,0 +1 @@
ansible

1
.local/bin/ansible-pull Symbolic link
View File

@ -0,0 +1 @@
ansible

28
.local/bin/ansible-test Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/python3
# PYTHON_ARGCOMPLETE_OK
"""Command line entry point for ansible-test."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import sys
def main():
"""Main program entry point."""
ansible_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
source_root = os.path.join(ansible_root, 'test', 'lib')
if os.path.exists(os.path.join(source_root, 'ansible_test', '_internal', 'cli.py')):
# running from source, use that version of ansible-test instead of any version that may already be installed
sys.path.insert(0, source_root)
# noinspection PyProtectedMember
from ansible_test._internal.cli import main as cli_main
cli_main()
if __name__ == '__main__':
main()

1
.local/bin/ansible-vault Symbolic link
View File

@ -0,0 +1 @@
ansible

18
.local/bin/backupSynology Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
source ~/.password
mkdir -p ~/Movies/{Anime,Videos}
mkdir -p ~/Music
mkdir -p ~/Collage
#sudo mount -t cifs //192.168.0.220/Mega -o username=${USERNAME},password=${PASSWORD},vers=2\.0 /mnt/Synology
#sudo mount -t cifs //192.168.0.220/music -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Music
#sudo mount -t cifs //192.168.0.220/usbshare1/Video -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Movies/Videos
#sudo mount -t cifs //192.168.0.220/usbshare1/Anime -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Movies/Anime
#sudo mount -t cifs //192.168.0.220/Studia -o username=${USERNAME},password=${PASSWORD},vers=2\.0 ~/Collage
if [ -e /mnt/Synology/Systems ]
then
echo "Starting $(date)" > ~/.cache/.logSynology
sudo rsync -r --bwlimit=1024 --update --progress /usr/mega/ /mnt/Synology >> ~/.cache/.logSynology
echo "Ending $(date)" >> ~/.cache/.logSynology
fi

8
.local/bin/bin-cp Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
chmod +x *
chown -R yorune: *
sudo cp -pr * /bin/
#sudo cp /etc/bash.bashrc ../configs
#cp /home/yorune/Arch/configs/zshrc /home/yorune/.zshrc
#cp /home/yorune/Arch/configs/vimrc /home/yorune/.vimrc
echo DONE!!

12
.local/bin/browser-x Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
KERNEL=$(uname -sr)
[[ $KERNEL =~ "icrosoft" ]] && "/mnt/c/Program Files/Mozilla Firefox/firefox.exe" "$@"
[[ $KERNEL =~ "gentoo" ]] && GDK_DPI_SCALE="1.2" firefox-bin "$@"
#[[ $KERNEL =~ "gentoo" ]] && __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 GDK_DPI_SCALE="1.2" firefox "$@"
# Firefox
# media.ffmpeg.vaapi.enabled -> true

8
.local/bin/chardetect Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from chardet.cli.chardetect import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

15
.local/bin/cleaner Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
set -x
sudo rm -rf /var/tmp/portage/*
sudo rm -rf /var/tmp/binpkgs/*
sudo rm -rf /var/tmp/genkernel/*
sudo rm -rf /var/cache/genkernel/*
sudo emerge -a --depclean
sudo emerge -a @preserved-rebuild
sudo eclean -C -q packages
sudo eclean -C -q -d -t1w distfiles
sudo revdep-rebuild
sudo perl-cleaner --all
sudo etc-update
sudo env-update
source /etc/profile

6
.local/bin/cleanertmp Executable file
View File

@ -0,0 +1,6 @@
sudo rm -rf /var/tmp/portage/*
sudo rm -rf /var/tmp/binpkgs/*
sudo rm -rf /var/tmp/genkernel/*
sudo rm -rf /var/cache/genkernel/*
sudo eclean-dist -d
sudo eclean-pkg -d

5
.local/bin/cmus-control Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
pkill -RTMIN+11 dwmblocks
[ "$1" = "play" ] && cmus-remote -u
[ "$1" = "next" ] && cmus-remote -n
[ "$1" = "prev" ] && cmus-remote -r

4
.local/bin/cmus-shell Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
if ! screen -r -D cmus >/dev/null ; then
screen -S cmus /usr/bin/cmus "$@"
fi

59
.local/bin/dmenumount Executable file
View File

@ -0,0 +1,59 @@
#!/bin/sh
# Gives a dmenu prompt to mount unmounted drives.
# If they're in /etc/fstab, they'll be mounted automatically.
# Otherwise, you'll be prompted to give a mountpoint from already existsing directories.
# If you input a novel directory, it will prompt you to create that directory.
getmount() { \
[ -z "$chosen" ] && exit 1
mp="$(find $1 | dmenu -i -p "Type in mount point.")"
[ "$mp" = "" ] && exit 1
if [ ! -d "$mp" ]; then
mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?")
[ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp")
fi
}
mountusb() { \
chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?" | awk '{print $1}')"
sudo -A mount "$chosen" && notify-send "💻 USB mounting" "$chosen mounted." && exit 0
alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$2=="part"&&$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not \( -path *%s -prune \) \ \n",$3}')
getmount "/mnt /media -maxdepth 5 -type d $alreadymounted"
partitiontype="$(lsblk -no "fstype" "$chosen")"
case "$partitiontype" in
"vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;;
*) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" 741 "$mp";;
esac
notify-send "💻 USB mounting" "$chosen mounted to $mp."
}
mountandroid() { \
chosen=$(echo "$anddrives" | dmenu -i -p "Which Android device?" | cut -d : -f 1)
getmount "/media -maxdepth 3 -type d"
sudo simple-mtpfs --device "$chosen" "$mp"
notify-send "🤖 Android Mounting" "Android device mounted to $mp."
}
asktype() { \
case $(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?") in
USB) mountusb ;;
Android) mountandroid ;;
esac
}
anddrives=$(simple-mtpfs -l 2>/dev/null)
usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}')"
if [ -z "$usbdrives" ]; then
[ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit
echo "Android device(s) detected."
mountandroid
else
if [ -z "$anddrives" ]; then
echo "USB drive(s) detected."
mountusb
else
echo "Mountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

41
.local/bin/dmenuumount Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# A dmenu prompt to unmount drives.
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
unmountusb() {
[ -z "$drives" ] && exit
chosen=$(echo "$drives" | dmenu -i -p "Unmount which drive?" | awk '{print $1}')
[ -z "$chosen" ] && exit
sudo -A umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
}
unmountandroid() { \
chosen=$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -i -p "Unmount which device?")
[ -z "$chosen" ] && exit
sudo -A umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
}
asktype() { \
case "$(printf "USB\\nAndroid" | dmenu -i -p "Unmount a USB drive or Android device?")" in
USB) unmountusb ;;
Android) unmountandroid ;;
esac
}
drives=$(lsblk -nrpo "name,type,size,mountpoint" | awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
if ! grep simple-mtpfs /etc/mtab; then
[ -z "$drives" ] && echo "No drives to unmount." && exit
echo "Unmountable USB drive detected."
unmountusb
else
if [ -z "$drives" ]
then
echo "Unmountable Android device detected."
unmountandroid
else
echo "Unmountable USB drive(s) and Android device(s) detected."
asktype
fi
fi

18
.local/bin/dmenuunicode Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# Give dmenu list of all unicode characters to copy.
# Shows the selected character in dunst if running.
# Must have xclip installed to even show menu.
xclip -h >/dev/null || exit
chosen=$(grep -v "#" ~/dwm/emoji | dmenu -i -l 20 -fn Monospace-18)
[ "$chosen" != "" ] || exit
c=$(echo "$chosen" | sed "s/ .*//")
echo "$c" | tr -d '\n' | xclip -selection clipboard
notify-send "'$c' copied to clipboard." &
s=$(echo "$chosen" | sed "s/.*; //" | awk '{print $1}')
echo "$s" | tr -d '\n' | xclip
notify-send "'$s' copied to primary." &

17
.local/bin/docker-start Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash -
#===============================================================================
#
# FILE: docker-start.sh
#
# USAGE: ./docker-start.sh
#
# OPTIONS: ---
# REQUIREMENTS: openrc system
# AUTHOR: Marcin Woźniak, y0rune@aol.com
# CREATED: 11/08/2020 11:21
# REVISION: ---
#===============================================================================
sudo rc-service docker start
sleep 10
sudo docker ps

99
.local/bin/dwmstatusbar Executable file
View File

@ -0,0 +1,99 @@
#!/bin/bash
print_weather() {
[ "$(stat -c %y "/home/yorune/.config/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && curl -s "wttr.in/$location" > "/home/yorune/.config/weatherreport"
printf "%s" "$(sed '16q;d' "/home/yorune/.config/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" && sed '13q;d' "/home/yorune/.config/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print" ❄",$1"°","☀",$2"°"}'
}
print_volume() {
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇" && exit
vol=$(pulsemixer --get-volume | awk '{print $1}')
printf "%s%%\\n" "🔊 $vol"
}
print_wifi(){
echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/")"
#echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/") $( [[ $(ip -br a show | awk {'print $1'}) =~ "vpn" ]] && echo "📡" || echo "❌" )"
}
print_temp(){
echo -e "🔥 $(sensors | awk '/Core 0/ {print int($3)"°C"}') $(sudo nvidia-smi -q -d temperature | grep --color=no -i "GPU Current" |egrep --color=no -o '[0-9]*')°C"
}
print_date(){
echo -e "🕛 $(date +"%d/%m %H:%M")"
}
print_mem(){
free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠 %2.2fGiB", ( $3 / 1024) )}'
}
print_music(){
# Source: https://github.com/joestandring/dwm-bar
# A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: cmus
if ps -C cmus > /dev/null; then
ARTIST=$(cmus-remote -Q | grep -a '^tag artist' | awk '{gsub("tag artist ", "");print}')
TRACK=$(cmus-remote -Q | grep -a '^tag title' | awk '{gsub("tag title ", "");print}')
POSITION=$(cmus-remote -Q | grep -a '^position' | awk '{gsub("position ", "");print}')
DURATION=$(cmus-remote -Q | grep -a '^duration' | awk '{gsub("duration ", "");print}')
STATUS=$(cmus-remote -Q | grep -a '^status' | awk '{gsub("status ", "");print}')
SHUFFLE=$(cmus-remote -Q | grep -a '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
if [ "$STATUS" = "playing" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
#printf "%s%s %s - %s " "$STATUS" "$ARTIST" "$TRACK"
printf "%s" "$STATUS"
#printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
#printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
#printf "%s\n"
fi
}
print_battery() {
# Find the battery level
hash acpi || return 0
onl="$(acpi -V | grep "on-line")"
charge="$(cat /sys/class/power_supply/BAT*/capacity)"
time="$(awk '{print $5}' <(acpi))"
# Determine battery glyph by percentage range
if [[ -z $onl && ${charge} -gt 80 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 80 && ${charge} -gt 60 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 60 && ${charge} -gt 40 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 40 && ${charge} -gt 20 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 20 ]]; then
echo -e "❗🔋 ${charge}% ${time}"
# If charging, use animated glyph
else
echo -e "🔌"
fi
}
print_mail(){
unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
icon="$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)"
[ "$unread" = "1" ] && [ "$icon" = "" ] || echo "📬 $unread$icon"
}
print_cpu() {
cpuUse=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print int(100 - $1)"%"}')
echo -e "💻 $cpuUse"
}
while true
do
xsetroot -name "$(print_music) $(print_temp) $(print_weather) $(print_mail) $(print_cpu) $(print_mem) $(print_wifi) $(print_battery) $(print_volume) $(print_date)"
sleep 10
done

2
.local/bin/eix-repos-sync Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
for i in /usr/repos/*/.git; do ( echo $i; cd $i/..; sudo git pull; ); done

13
.local/bin/emerge-logs Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
LOGS=( $(sudo find /var/tmp/portage/ -mindepth 1 -maxdepth 5 -name "build.log") )
LEN=${#LOGS[@]}
for (( i=0; i<$LEN; i++ ));
do
echo "$(( $i + 1 )) - ${LOGS[$i]}"
done
echo
read -p 'Select number to show logs: ' NUMBER
sudo tail -f ${LOGS[$NUMBER-1]}

8
.local/bin/epylint Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_epylint
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_epylint())

4
.local/bin/euscan Executable file
View File

@ -0,0 +1,4 @@
#!/usr/lib/python-exec/python3.8/python
# EASY-INSTALL-SCRIPT: 'euscan==9999','euscan'
__requires__ = 'euscan==9999'
__import__('pkg_resources').run_script('euscan==9999', 'euscan')

44
.local/bin/ext Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
# A general, all-purpose extraction script. Not all extraction programs here
# are installed by LARBS automatically.
#
# Default behavior: Extract archive into new directory
# Behavior with `-c` option: Extract contents into current directory
while getopts "hc" o; do case "${o}" in
c) extracthere="True" ;;
*) printf "Options:\\n -c: Extract archive into current directory rather than a new one.\\n" && exit 1 ;;
esac done
if [ -z "$extracthere" ]; then
archive="$(readlink -f "$*")" &&
directory="$(echo "$archive" | sed 's/\.[^\/.]*$//')" &&
mkdir -p "$directory" &&
cd "$directory" || exit 1
else
archive="$(readlink -f "$(echo "$*" | cut -d' ' -f2)" 2>/dev/null)"
fi
[ -z "$archive" ] && printf "Give archive to extract as argument.\\n" && exit 1
if [ -f "$archive" ] ; then
case "$archive" in
*.tar.bz2|*.tbz2) tar xvjf "$archive" ;;
*.tar.xz) tar -vxf "$archive" ;;
*.tar.gz|*.tgz) tar xvzf "$archive" ;;
*.lzma) unlzma "$archive" ;;
*.bz2) bunzip2 "$archive" ;;
*.rar) unrar x -ad "$archive" ;;
*.gz) gunzip "$archive" ;;
*.tar) tar xvf "$archive" ;;
*.zip) unzip "$archive" ;;
*.Z) uncompress "$archive" ;;
*.7z) 7z x "$archive" ;;
*.xz) unxz "$archive" ;;
*.exe) cabextract "$archive" ;;
*) printf "extract: '%s' - unknown archive method\\n" "$archive" ;;
esac
else
printf "File \"%s\" not found.\\n" "$archive"
fi

8
.local/bin/f2py Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3.6 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.6
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3.7 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/f2py3.8 Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from numpy.f2py.f2py2e import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/flask Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from flask.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

8
.local/bin/futurize Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from libfuturize.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

28
.local/bin/gentoo-test Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
sudo mount /dev/disk/by-uuid/c61f258f-5fd1-47f2-a270-bb8aa63b0020 /mnt/gentoo
sleep 5
sync
if [ -e /dev/disk/by-uuid/c61f258f-5fd1-47f2-a270-bb8aa63b0020 ]
then
sudo mkdir -p /mnt/gentoo/proc
sudo mkdir -p /mnt/gentoo/dev
sudo mkdir -p /mnt/gentoo/sys
sudo mkdir -p /mnt/gentoo/mnt/backup/ccache
sudo cp -r $CCACHE_DIR/ccache.conf /mnt/gentoo/mnt/backup/ccache
sudo rsync -az -H /etc/portage/ /mnt/gentoo/gentoo/etc/portage/
#sudo rsync -az -H /usr/portage/ /mnt/gentoo/gentoo/usr/portage/
#sudo rsync -az -H /usr/repos/ /mnt/gentoo/gentoo/usr/repos/
sudo mount --types proc /proc /mnt/gentoo/gentoo/proc
sudo mount --rbind /sys /mnt/gentoo/gentoo/sys
sudo mount --make-rslave /mnt/gentoo/gentoo/sys
sudo mount --rbind /dev /mnt/gentoo/gentoo/dev
sudo mount --make-rslave /mnt/gentoo/gentoo/dev
sleep 5
sudo chroot /mnt/gentoo/gentoo /bin/bash
# echo "Europe/Warsaw" > /etc/timezone
# emerge --config sys-libs/timezone-data
# emerge dev-util/ccache app-shells/oh-my-zsh app-admin/sudo app-editors/vim
fi

3
.local/bin/geoip Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
curl -s ipinfo.io/$1

16
.local/bin/getforecast Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# Updates weather forecast
FILE="$HOME/.config/.weatherreport.tmp"
FILER="$HOME/.config/weatherreport"
location="Kleczew"
curl -s --max-time 10 "wttr.in/$location" > $FILE
if [ -s "$FILE" ]
then
mv $FILE $FILER
# notify-send " Weather" "The weather forecast has been updated."
else
rm $FILE
fi

133
.local/bin/gfetch Executable file
View File

@ -0,0 +1,133 @@
#!/bin/sh
# Copyright (c) 2020, XGQT
# Licensed under the ISC License
# .vir.
# ,d$$$$$$b.
# &&&&( )&&&b
# Q$$$$$$$$$$B
# "$$$$$$$P
# ,d$$$$$$P"
# $$$$$$P
# `Q$$P"
# gfetch - tiny system info for gentoo
# based on:
# https://github.com/jschx/ufetch/
# INFO
host="$(hostname 2>/dev/null)"
cpu="$(uname -p 2>/dev/null)"
kernel="$(uname -sr 2>/dev/null)"
uptime="$(uptime -p 2>/dev/null | sed 's/up //')"
shell="$(basename "${SHELL}" 2>/dev/null)"
if [ -f /etc/lsb-release ]
then
os="$(cut -d \" -f 2 < /etc/lsb-release) $(uname -m)"
elif [ -f /etc/os-release ]
then
os="$(cut -d = -f 2 < /etc/os-release | sed 1q) $(uname -m)"
else
os="Gentoo $(uname -m)"
fi
if [ -d "${EPREFIX}"/var/db/pkg ]
then
packages="All: $(find "${EPREFIX}"/var/db/pkg/*/* -type d | wc -l)"
real="Real: $(find "${EPREFIX}"/var/db/pkg/*/* -type d | grep -c -v -E 'acct-group|acct-user|app-eselect|java-virtuals|media-fonts|virtual')"
else
packages="n/a"
real=""
fi
if [ -f "${EPREFIX}"/var/lib/portage/world ]
then
world="World: $(wc -l < "${EPREFIX}"/var/lib/portage/world)"
else
world=""
fi
if [ -n "${DE}" ]
then
ui="${DE}"
uitype='DE'
elif [ -n "${WM}" ]
then
ui="${WM}"
uitype='WM'
elif [ -n "${XDG_CURRENT_DESKTOP}" ]
then
ui="${XDG_CURRENT_DESKTOP}"
uitype='DE'
elif [ -n "${DESKTOP_SESSION}" ]
then
ui="${DESKTOP_SESSION}"
uitype='DE'
elif [ -f "${HOME}/.xinitrc" ]
then
ui="$(tail -n 1 "${HOME}/.xinitrc" | cut -d ' ' -f 2)"
uitype='WM'
elif [ -f "${HOME}/.xsession" ]
then
ui="$(tail -n 1 "${HOME}/.xsession" | cut -d ' ' -f 2)"
uitype='WM'
else
ui='unknown'
uitype='UI'
fi
# Color Definitions
if [ -x "$(command -v tput)" ]; then
bold="$(tput bold)"
# black="$(tput setaf 0)"
# red="$(tput setaf 1)"
# green="$(tput setaf 2)"
# yellow="$(tput setaf 3)"
# blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
# cyan="$(tput setaf 6)"
white="$(tput setaf 7)"
reset="$(tput sgr0)"
fi
# Output color
# labels
lc="${reset}${bold}${magenta}"
# user and hostname
nc="${reset}${bold}${magenta}"
# info
ic="${reset}${bold}${white}"
# first color
c0="${reset}${bold}${magenta}"
# second color
c1="${reset}${magenta}"
# OUTPUT
cat <<EOF
${c0} .vir. ${nc}${USER}${ic}@${nc}${host}${reset}
${c0} ,d\$\$\$\$${c1}\$\$b. ${lc}CPU: ${ic}${cpu}${reset}
${c0} &&&&${c1}( )&&&b ${lc}OS: ${ic}${os}${reset}
${c0} Q\$\$\$\$\$\$\$\$${c1}\$\$B ${lc}KERNEL: ${ic}${kernel}${reset}
${c0} "\$\$\$\$\$${c1}\$\$P ${lc}UP: ${ic}${uptime}${reset}
${c0} ,d\$\$\$\$${c1}\$\$P" ${lc}PKGS: ${ic}${packages} ${world} ${real}${reset}
${c0} \$\$\$\$${c1}\$\$P ${lc}SHELL: ${ic}${shell}${reset}
${c0} \`Q\$\$${c1}P" ${lc}${uitype}: ${ic}${ui}${reset}
EOF

11
.local/bin/git-init-folder Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
mkdir $1
cd $1
git init
touch README.md
git add README.md
git commit -m "first commit"
curl -u 'linux923344' https://api.github.com/user/repos -d '{"name":"'$1'"}'
git remote add origin git@github.com:linux923344/$1.git
git push -u origin master

8
.local/bin/haruhi-dl Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.8/python3
# -*- coding: utf-8 -*-
import re
import sys
from haruhi_dl import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

6
.local/bin/iptables-restart Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo rc-service iptables stop
sudo iptables -F
sudo ~/.config/iptables
sudo /etc/init.d/iptables save
sudo rc-service iptables start

42
.local/bin/iptables-update Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
TEMP=/tmp/iptablesTemp
FINAL="/home/yorune/.config/iptables"
LINK="https://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz"
#BLOCKEDCOUNTRIES=(ad ae af ag ai al am ao ap aq ar as at au aw ax az ba bb bd be bf bg bh bi bj bl bm bn bo bq br bs bt bw by bz ca cd cf cg ch ci ck cl cm cn co cr cu cv cw cy cz de dj dk dm do dz ec ee eg er es et eu fi fj fk fm fo fr ga gb gd ge gf gg gh gi gl gm gn gp gq gr gt gu gw gy hk hn hr ht hu id ie il im in io iq ir is it je jm jo jp ke kg kh ki km kn kp kr kw ky kz la lb lc li lk lr ls lt lu lv ly ma mc md me mf mg mh mk ml mm mn mo mp mq mr ms mt mu mv mw mx my mz na nc ne nf ng ni nl no np nr nu nz om pa pe pf pg ph pk pm pr ps pt pw py qa re ro rs ru rw sa sb sc sd se sg si sk sl sm sn so sr ss st sv sx sy sz tc td tg th tj tk tl tm tn to tr tt tv tw tz ua ug us uy uz va vc ve vg vivn vu wf ws ye yt za zm zw)
BLOCKEDCOUNTRIES=(af ax al dz as ad ao ai aq ag ar am aw au az bs bh bd bb by bz bj bm bt bo ba bw br io bn bg bf bi kh cm cv cf td cl cn co km cg cd ck cr ci hr cu cy dj dm do ec sv gq er ee et fk fj gf ga gm ge gh gi gd gp gu gt gn gw ht hn hk hu is in id ir iq im il jm je jo kz ke ki kp kr kw kg la lv lb ls lr ly mo mk mg mw my mv ml mt mh mq mr mu yt fm md mc mn me ms ma mz mm na nr np nc nz ni ne ng nu nf mp om pk pw ps pa py pe pr qa re ro ru rw kn lc pm vc ws sm st sa sn rs sc sl sg sk si sb so za es lk sd sr sy tw tj tz th tl tg tk to tt tn tr tm tc ug ua ae uy uz vu ve vn vg vi ye zm zw)
cd $HOME
mkdir {blocked,allzones}
curl -LO $LINK
tar xzvf all-zones.tar.gz -C allzones
rm all-zones.tar.gz
sed -n '/# CONFIGURATION:/,/# END OF CONFIG/p' $FINAL > beggining.txt
sed -n '/# END CONFIGURATION:/,/# END OF CONFIGURATION/p' $FINAL > end.txt
for blockedCountries in "${BLOCKEDCOUNTRIES[@]}"
do
mv allzones/$blockedCountries.zone blocked/
done
for f in blocked/*.zone;
do
echo "Adding $f to iptables.."
echo "" >> $TEMP
echo "# Adding zone $f" >> $TEMP
while read line; do
echo "iptables -A INPUT -s $line -j DROP" >> $TEMP
#echo "-A INPUT -s $line -j DROP" >> $TEMP
done < $f
done
cat beggining.txt > $FINAL
cat $TEMP >> $FINAL
echo "" >> $FINAL
cat end.txt >> $FINAL
rm -rf blocked allzones $TEMP beggining.txt end.txt
sh ~/.local/bin/iptables-restart
#systemctl restart iptables

8
.local/bin/isort Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from isort.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

73
.local/bin/mailsync Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash
# Sync mail and give notification if there is new mail.
# Run only if user logged in (prevent cron errors)
export DISPLAY=:0
pgrep -u "${USER:=$LOGNAME}" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;}
# Run only if not already running in other instance
pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;}
# Checks for internet connection and set notification script.
ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; exit ;}
command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotify-send\` should be installed for pop-up mail notifications with this script."
# Required to display notifications if run as a cronjob:
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
# For individual configurations:
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store"
# Settings are different for MacOS (Darwin) systems.
if [ "$(uname)" = "Darwin" ]; then
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;}
messageinfo() { osascript "display notification with title \"📧 $from\" subtitle \"$subject\"" ;}
else
notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;}
messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;}
fi
# Check account for new mail. Notify if there is new content.
syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")"
mbsync $opts "$acc"
new=$(find $(ls $HOME/.local/share/mail/$acc/* | grep -i inbox | sed 's/\://')/new -type f -newer "$HOME/.config/mutt/.mailsynclastrun" 2> /dev/null)
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
if [ "$newcount" -gt "0" ]; then
notify "$acc" "$newcount" &
for file in $new; do
# Extract subject and sender from mail.
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
messageinfo &
done
fi
}
# Sync accounts passed as argument or all.
if [ "$#" -eq "0" ]; then
accounts="$(awk '/^Channel/ {print $2}' "$HOME/.mbsyncrc")"
else
for arg in "$@"; do
[ "${arg%${arg#?}}" = '-' ] && opts="${opts:+${opts} }${arg}" && shift 1
done
accounts=$*
fi
echo " 🔃" > /tmp/imapsyncicon_"$USER"
( pkill -RTMIN+12 "${STATUSBAR:-blocks}" >/dev/null 2>&1 ) 2>/dev/null
# Parallelize multiple accounts
for account in $accounts
do
syncandnotify &
done
wait
rm -f /tmp/imapsyncicon_"$USER"
( pkill -RTMIN+12 "${STATUSBAR:-blocks}" >/dev/null 2>&1 ) 2>/dev/null
notmuch new 2>/dev/null
#Create a touch file that indicates the time of the last run of mailsync
touch "$HOME/.config/mutt/.mailsynclastrun"

2
.local/bin/minecraft-launcher Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 java -jar ~/Downloads/TLauncher-2.75/TLauncher-2.75.jar

10
.local/bin/mouse-set Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
choices="Off\nCycle"
chosen=$(echo -e "$choices" | dmenu -i)
mouse=$(sudo ratbag-command list | awk '{print $1}' | sed 's/://')
case "$chosen" in
Off) sudo ratbag-command led 0 set mode off $mouse ;;
Cycle) sudo ratbag-command led 0 set mode cycle $mouse && sudo ratbag-command led 0 set rate 25000 $mouse ;;
esac

2
.local/bin/night Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
redshift -l 52.2327:18.3036 -t 6500:3200&

4
.local/bin/notify-program Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
KERNEL=$(uname -sr)
[[ $KERNEL =~ "icrosoft" ]] && $HOME/.local/bin/wsl-notify "$@"
[[ $KERNEL =~ "gentoo" ]] && /usr/bin/notify-send "$@"

2
.local/bin/password-manager Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
QT_SCALE_FACTOR=1.5 keepassxc

8
.local/bin/pasteurize Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/python3.8
# -*- coding: utf-8 -*-
import re
import sys
from libpasteurize.main import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())

223
.local/bin/pwiz.py Executable file
View File

@ -0,0 +1,223 @@
#!/usr/bin/python3.8
import datetime
import sys
from getpass import getpass
from optparse import OptionParser
from peewee import *
from peewee import print_
from peewee import __version__ as peewee_version
from playhouse.cockroachdb import CockroachDatabase
from playhouse.reflection import *
HEADER = """from peewee import *%s
database = %s('%s'%s)
"""
BASE_MODEL = """\
class BaseModel(Model):
class Meta:
database = database
"""
UNKNOWN_FIELD = """\
class UnknownField(object):
def __init__(self, *_, **__): pass
"""
DATABASE_ALIASES = {
CockroachDatabase: ['cockroach', 'cockroachdb', 'crdb'],
MySQLDatabase: ['mysql', 'mysqldb'],
PostgresqlDatabase: ['postgres', 'postgresql'],
SqliteDatabase: ['sqlite', 'sqlite3'],
}
DATABASE_MAP = dict((value, key)
for key in DATABASE_ALIASES
for value in DATABASE_ALIASES[key])
def make_introspector(database_type, database_name, **kwargs):
if database_type not in DATABASE_MAP:
err('Unrecognized database, must be one of: %s' %
', '.join(DATABASE_MAP.keys()))
sys.exit(1)
schema = kwargs.pop('schema', None)
DatabaseClass = DATABASE_MAP[database_type]
db = DatabaseClass(database_name, **kwargs)
return Introspector.from_database(db, schema=schema)
def print_models(introspector, tables=None, preserve_order=False,
include_views=False, ignore_unknown=False, snake_case=True):
database = introspector.introspect(table_names=tables,
include_views=include_views,
snake_case=snake_case)
db_kwargs = introspector.get_database_kwargs()
header = HEADER % (
introspector.get_additional_imports(),
introspector.get_database_class().__name__,
introspector.get_database_name(),
', **%s' % repr(db_kwargs) if db_kwargs else '')
print_(header)
if not ignore_unknown:
print_(UNKNOWN_FIELD)
print_(BASE_MODEL)
def _print_table(table, seen, accum=None):
accum = accum or []
foreign_keys = database.foreign_keys[table]
for foreign_key in foreign_keys:
dest = foreign_key.dest_table
# In the event the destination table has already been pushed
# for printing, then we have a reference cycle.
if dest in accum and table not in accum:
print_('# Possible reference cycle: %s' % dest)
# If this is not a self-referential foreign key, and we have
# not already processed the destination table, do so now.
if dest not in seen and dest not in accum:
seen.add(dest)
if dest != table:
_print_table(dest, seen, accum + [table])
print_('class %s(BaseModel):' % database.model_names[table])
columns = database.columns[table].items()
if not preserve_order:
columns = sorted(columns)
primary_keys = database.primary_keys[table]
for name, column in columns:
skip = all([
name in primary_keys,
name == 'id',
len(primary_keys) == 1,
column.field_class in introspector.pk_classes])
if skip:
continue
if column.primary_key and len(primary_keys) > 1:
# If we have a CompositeKey, then we do not want to explicitly
# mark the columns as being primary keys.
column.primary_key = False
is_unknown = column.field_class is UnknownField
if is_unknown and ignore_unknown:
disp = '%s - %s' % (column.name, column.raw_column_type or '?')
print_(' # %s' % disp)
else:
print_(' %s' % column.get_field())
print_('')
print_(' class Meta:')
print_(' table_name = \'%s\'' % table)
multi_column_indexes = database.multi_column_indexes(table)
if multi_column_indexes:
print_(' indexes = (')
for fields, unique in sorted(multi_column_indexes):
print_(' ((%s), %s),' % (
', '.join("'%s'" % field for field in fields),
unique,
))
print_(' )')
if introspector.schema:
print_(' schema = \'%s\'' % introspector.schema)
if len(primary_keys) > 1:
pk_field_names = sorted([
field.name for col, field in columns
if col in primary_keys])
pk_list = ', '.join("'%s'" % pk for pk in pk_field_names)
print_(' primary_key = CompositeKey(%s)' % pk_list)
elif not primary_keys:
print_(' primary_key = False')
print_('')
seen.add(table)
seen = set()
for table in sorted(database.model_names.keys()):
if table not in seen:
if not tables or table in tables:
_print_table(table, seen)
def print_header(cmd_line, introspector):
timestamp = datetime.datetime.now()
print_('# Code generated by:')
print_('# python -m pwiz %s' % cmd_line)
print_('# Date: %s' % timestamp.strftime('%B %d, %Y %I:%M%p'))
print_('# Database: %s' % introspector.get_database_name())
print_('# Peewee version: %s' % peewee_version)
print_('')
def err(msg):
sys.stderr.write('\033[91m%s\033[0m\n' % msg)
sys.stderr.flush()
def get_option_parser():
parser = OptionParser(usage='usage: %prog [options] database_name')
ao = parser.add_option
ao('-H', '--host', dest='host')
ao('-p', '--port', dest='port', type='int')
ao('-u', '--user', dest='user')
ao('-P', '--password', dest='password', action='store_true')
engines = sorted(DATABASE_MAP)
ao('-e', '--engine', dest='engine', default='postgresql', choices=engines,
help=('Database type, e.g. sqlite, mysql, postgresql or cockroachdb. '
'Default is "postgresql".'))
ao('-s', '--schema', dest='schema')
ao('-t', '--tables', dest='tables',
help=('Only generate the specified tables. Multiple table names should '
'be separated by commas.'))
ao('-v', '--views', dest='views', action='store_true',
help='Generate model classes for VIEWs in addition to tables.')
ao('-i', '--info', dest='info', action='store_true',
help=('Add database information and other metadata to top of the '
'generated file.'))
ao('-o', '--preserve-order', action='store_true', dest='preserve_order',
help='Model definition column ordering matches source table.')
ao('-I', '--ignore-unknown', action='store_true', dest='ignore_unknown',
help='Ignore fields whose type cannot be determined.')
ao('-L', '--legacy-naming', action='store_true', dest='legacy_naming',
help='Use legacy table- and column-name generation.')
return parser
def get_connect_kwargs(options):
ops = ('host', 'port', 'user', 'schema')
kwargs = dict((o, getattr(options, o)) for o in ops if getattr(options, o))
if options.password:
kwargs['password'] = getpass()
return kwargs
if __name__ == '__main__':
raw_argv = sys.argv
parser = get_option_parser()
options, args = parser.parse_args()
if len(args) < 1:
err('Missing required parameter "database"')
parser.print_help()
sys.exit(1)
connect = get_connect_kwargs(options)
database = args[-1]
tables = None
if options.tables:
tables = [table.strip() for table in options.tables.split(',')
if table.strip()]
introspector = make_introspector(options.engine, database, **connect)
if options.info:
cmd_line = ' '.join(raw_argv[1:])
print_header(cmd_line, introspector)
print_models(introspector, tables, options.preserve_order, options.views,
options.ignore_unknown, not options.legacy_naming)

8
.local/bin/pylint Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_pylint
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_pylint())

8
.local/bin/pyreverse Executable file
View File

@ -0,0 +1,8 @@
#!/usr/lib/python-exec/python3.7/python
# -*- coding: utf-8 -*-
import re
import sys
from pylint import run_pyreverse
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(run_pyreverse())

5
.local/bin/rasp Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
sudo chown yorune: /mnt/rasp
sshfs root@192.168.0.222:/mnt/ /mnt/rasp/
sleep 10
cd /mnt/rasp

BIN
.local/bin/rcon Executable file

Binary file not shown.

19
.local/bin/record Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
AUDIO=$(pactl list sources | awk '/Name: alsa_out/{print $2}' | head -n1)
pkill -9 xautolock; xset s 10800
ffmpeg \
-f pulse \
-i "$AUDIO" \
-f x11grab \
-framerate 60 \
-r 30 \
-s 1920x1080 \
-i :0 \
-b:v 5500k \
-c:v h264 -preset ultrafast -c:a aac \
"$HOME/screencast-$(date '+%y%m%d-%H%M-%S').mp4"
xset s 600&
xautolock -time 15 -locker slock&

6
.local/bin/remove-kernel Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sudo emerge -C "=sys-kernel/gentoo-sources-$1"
sudo rm -rf /usr/src/linux-$1-gentoo
sudo rm -rf /lib/modules/$1-gentoo-x86_64
sudo rm -rf /boot/*$1*
sudo grub-mkconfig -o /boot/grub/grub.cfg

2
.local/bin/runJava Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 __GLX_VENDOR_LIBRARY_NAME=nvidia __GL_SYNC_TO_VBLANK=0 DRI_PRIME=1 exec java "$@"

4
.local/bin/saver-off Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
xset s off
xset -dpms
pkill -9 xautolock

25
.local/bin/sb-battery Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
print_battery() {
# Find the battery level
hash acpi || return 0
onl="$(acpi -V | grep "on-line")"
charge="$(cat /sys/class/power_supply/BAT*/capacity)"
time="$(awk '{print $5}' <(acpi))"
# Determine battery glyph by percentage range
if [[ -z $onl && ${charge} -gt 80 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 80 && ${charge} -gt 60 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 60 && ${charge} -gt 40 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 40 && ${charge} -gt 20 ]]; then
echo -e "🔋 ${charge}% ${time}"
elif [[ -z $onl && ${charge} -le 20 ]]; then
echo -e "❗🔋 ${charge}% ${time}"
# If charging, use animated glyph
else
echo -e "🔌"
fi
}
print_battery

5
.local/bin/sb-clock Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_date(){
echo -e "🕛 $(date +"%d/%m %H:%M")"
}
print_date

6
.local/bin/sb-cpu Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
print_cpu() {
cpuUse=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print int(100 - $1)"%"}')
echo -e "💻 $cpuUse"
}
print_cpu

7
.local/bin/sb-mail Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
print_mail(){
unread="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f | wc -l 2>/dev/null)"
icon="$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)"
[ "$unread" = "1" ] && [ "$icon" = "" ] || echo "📬 $unread$icon"
}
print_mail

5
.local/bin/sb-mem Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_mem(){
free --mebi | sed -n '2{p;q}' | awk '{printf ("🧠 %2.2fGiB", ( $3 / 1024) )}'
}
print_mem

30
.local/bin/sb-music Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
print_music(){
# Source: https://github.com/joestandring/dwm-bar
# A dwm_bar function that shows the current artist, track, position, duration, and status from cmus
# Joe Standring <git@joestandring.com>
# GNU GPLv3
# Dependencies: cmus
if ps -C cmus > /dev/null; then
ARTIST=$(cmus-remote -Q | grep -a '^tag artist' | awk '{gsub("tag artist ", "");print}')
TRACK=$(cmus-remote -Q | grep -a '^tag title' | awk '{gsub("tag title ", "");print}')
POSITION=$(cmus-remote -Q | grep -a '^position' | awk '{gsub("position ", "");print}')
DURATION=$(cmus-remote -Q | grep -a '^duration' | awk '{gsub("duration ", "");print}')
STATUS=$(cmus-remote -Q | grep -a '^status' | awk '{gsub("status ", "");print}')
SHUFFLE=$(cmus-remote -Q | grep -a '^set shuffle' | awk '{gsub("set shuffle ", "");print}')
if [ "$STATUS" = "playing" ]; then
STATUS="▶"
else
STATUS="⏸"
fi
#printf "%s%s %s - %s " "$STATUS" "$ARTIST" "$TRACK"
printf "%s" "$STATUS"
#printf "%0d:%02d/" $((POSITION%3600/60)) $((POSITION%60))
#printf "%0d:%02d" $((DURATION%3600/60)) $((DURATION%60))
#printf "%s\n"
fi
}
print_music

5
.local/bin/sb-network Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_wifi(){
echo -e "$(cat /sys/class/net/w*/operstate | sed "s/down/❌/;s/up/📶/") $(cat /sys/class/net/e*/operstate | sed "s/down/❌/;s/up/🌐/")"
}
print_wifi

5
.local/bin/sb-temp Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
print_temp(){
echo -e "🔥 $(sensors | awk '/Core 0/ {print int($3)"°C"}') $(sudo nvidia-smi -q -d temperature | grep --color=no -i "GPU Current" |egrep --color=no -o '[0-9]*')°C"
}
print_temp

7
.local/bin/sb-volume Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
print_volume() {
[ "$(pulsemixer --get-mute)" = "1" ] && printf "🔇" && exit
vol=$(pulsemixer --get-volume | awk '{print $1}')
printf "%s%%\\n" "🔊 $vol"
}
print_volume

7
.local/bin/sb-weather Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
print_weather() {
[ "$(stat -c %y "/home/yorune/.config/weatherreport" 2>/dev/null | cut -d' ' -f1)" != "$(date '+%Y-%m-%d')" ] && curl -s "wttr.in/$location" > "/home/yorune/.config/weatherreport"
printf "%s" "$(sed '16q;d' "/home/yorune/.config/weatherreport" | grep -wo "[0-9]*%" | sort -n | sed -e '$!d' | sed -e "s/^/☔ /g" | tr -d '\n')" && sed '13q;d' "/home/yorune/.config/weatherreport" | grep -o "m\\(-\\)*[0-9]\\+" | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print" ❄",$1"°","☀",$2"°"}'
}
print_weather

13
.local/bin/screen-switcher Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
choices="Left\nRight\nDuplicated\nHDMI\nMonitor\nTV\n"
chosen=$(echo -e "$choices" | dmenu -i)
case "$chosen" in
Monitor) mons -o ;;
Duplicated) mons -d ;;
Left) mons -e left ;;
Right) mons -e right ;;
HDMI) mons -s ;;
TV) xrandr --output HDMI-1 --left-of eDP-1 --mode 1366x768 --rate 60
esac

7
.local/bin/screenshot Executable file
View File

@ -0,0 +1,7 @@
FILE="/tmp/`date +%Y%m%d-%H.%M.%S.png`"
NAME=$(date +%s | sha256sum | base64 | head -c 20 ; echo)
gnome-screenshot -f "$FILE"
rsync -avz --delete $FILE -e "ssh -p 22" root@209.250.255.224:/var/www/yorune.pl/u/$NAME.png &&
echo -e "https://yorune.pl/u/$NAME.png" | xclip -selection clipboard && notify-send "Screenshot has been updated"

7
.local/bin/screenshot-area Executable file
View File

@ -0,0 +1,7 @@
FILE="/tmp/`date +%Y%m%d-%H.%M.%S.png`"
NAME=$(date +%s | sha256sum | base64 | head -c 20 ; echo)
gnome-screenshot --area -f "$FILE"
rsync -avz --delete $FILE -e "ssh -p 22" root@209.250.255.224:/var/www/yorune.pl/u/$NAME.png &&
echo -e "https://yorune.pl/u/$NAME.png" | xclip -selection clipboard && notify-send "Screenshot has been updated"

Some files were not shown because too many files have changed in this diff Show More