Compare commits

..

47 Commits

Author SHA1 Message Date
3ff0adcbf3 libsecret credentials 2025-11-14 19:24:58 +01:00
c6705a2229 ssh vim and tmux 2025-11-14 13:39:26 +01:00
41e9336603 sshconfig 2025-03-05 11:27:17 +01:00
93473be663 Vundle -> Plug 2024-03-31 15:42:40 +02:00
912afb5576 ssh config 2024-01-26 08:29:27 +01:00
913de0fa24 slurm alias 2024-01-24 10:25:00 +01:00
1d1cabbd38 Slurm aliases 2024-01-19 09:31:58 +01:00
75b08a39f6 Read npy files 2024-01-18 16:40:44 +01:00
af4e2d4364 pylab 2023-12-21 08:06:55 +01:00
5b12de7672 vimrc: YCM only if python3 enabled 2023-12-20 12:47:22 +01:00
144ea8b936 i3 2023-11-26 16:43:56 +01:00
6ec0d320c3 Update 2023-11-26 16:43:30 +01:00
f81face7de ssh 2023-11-26 16:43:30 +01:00
1fbd656840 i3 2023-11-21 19:43:30 +01:00
eabfa84c6a vimrc: node 2023-11-21 19:40:50 +01:00
10ff2034bb vimrc: YCM only if python3 enabled 2023-05-17 11:29:50 +02:00
04273c2422 Break tools out into modules 2023-03-09 11:15:53 +01:00
522854ab3d vimrc: CtrlP, slime, tagbar 2023-03-08 15:26:53 +01:00
1c8133c827 Slurm aliases 2023-01-12 10:46:49 +01:00
d933b8a830 .bashrc: Watch 2022-12-20 16:34:39 +01:00
34451575a9 vimrc: autopep8 2022-12-20 16:34:39 +01:00
2ba88ea838 Local settings on aino. DO NOT PUSH 2022-12-20 16:34:39 +01:00
4aa6e57064 python alias 2022-12-17 19:39:07 +01:00
037b8321d6 Picom config 2022-12-17 19:36:23 +01:00
e7ece8748b Enchance npz_preview 2022-03-16 15:51:07 +01:00
13baa5f8ce Tmux ssh config 2022-03-16 09:20:17 +01:00
b082cc00b2 ssh rc 2022-03-15 14:53:24 +01:00
9c6ecfce28 rsync 2022-02-23 20:52:05 +01:00
eb7a79a758 .vimrc Julia 2022-02-14 17:17:44 +01:00
5fc158cf12 More slurm aliases 2022-02-09 10:34:40 +01:00
135b6c5ea3 Get rid of gpaw and ase modules 2022-01-27 17:10:09 +01:00
e3a67128fa Source optional local settings 2022-01-25 17:15:48 +01:00
715d630ff7 Better handle lmod in bashrc.kuba 2022-01-13 14:11:11 +01:00
438051159a xclip 2022-01-13 09:32:14 +01:00
ec76425031 .ssh: Dardel config 2022-01-03 16:42:42 +01:00
be733bbcba snakemake and myqueue completion 2021-12-13 11:03:47 +01:00
5b02e1ea77 gitconfig 2021-12-13 11:03:47 +01:00
86e49d6b74 Okular config 2021-11-22 21:52:09 +01:00
2f6fb5e0d1 .vimrc highligh 2021-10-10 21:13:34 +02:00
086a75b054 vimrc: ALE, unimpaired and colors 2021-10-07 10:30:45 +02:00
8f52441c54 .vimrc YCM 2021-09-20 10:15:25 +02:00
964c1f3f85 .bashrc source completion 2021-09-17 10:18:52 +02:00
22617db376 Use auto modules instead 2021-09-13 10:22:33 +02:00
bc0ff2b3ea ssh: PDC transfer node 2021-09-13 08:13:12 +02:00
959c9228c5 Move conky's into i3 2021-09-12 09:28:26 +02:00
8aad68fd7c Tab completion for dotfiles 2021-09-12 09:11:15 +02:00
0af0672f3e Move .i3 and diskhealth into modules 2021-09-12 09:02:51 +02:00
93 changed files with 823 additions and 4151 deletions

View File

@@ -4,3 +4,8 @@
if [ -f "$HOME/.bashrc.kuba" ]; then if [ -f "$HOME/.bashrc.kuba" ]; then
. "$HOME/.bashrc.kuba" . "$HOME/.bashrc.kuba"
fi fi
# Settings not included in dotfiles repo
if [ -f "$HOME/.bashrc.local" ]; then
. "$HOME/.bashrc.local"
fi

View File

@@ -22,43 +22,19 @@ alias dvim="GIT_WORK_TREE='/home/kuba' GIT_DIR='/home/kuba/.dotfiles.git/' vim"
alias ls='ls --color=auto' alias ls='ls --color=auto'
source_existing /usr/share/bash-completion/bash_completion
# Make tab-completion work for dotfiles exactly as for git
# First we need to load the completion for git (this is done the first time
# one types `git <TAB>` in the console).
_completion_loader git
# Running `complete -p git` yields the following
# complete -o bashdefault -o default -o nospace -F __git_wrap__git_main git
# So we do
complete -o bashdefault -o default -o nospace -F __git_wrap__git_main dotfiles
# Define a OS X-like open command # Define a OS X-like open command
open() { command xdg-open "$@" > /dev/null 2>&1 & } open() { command xdg-open "$@" > /dev/null 2>&1 & }
# Inspect .npz files
npz_py_str="$(cat << EOM
from sys import argv
import numpy as np
try:
import matplotlib.pyplot as plt
print('Imported matplotlib.pyplot as plt')
except ImportError:
pass
class Wrap:
def __init__(self, fname):
n = np.load(fname, allow_pickle=True)
files = n.files
globs = globals()
print('Contains files', files)
for f in files:
setattr(self, f, n[f])
globs[f] = n[f]
archive = Wrap(argv[1])
print('Global namespace populated with "archive" and all files')
EOM
)"
npz_preview() {
if [ $# -lt 1 ]; then
echo "Please specify file to open as argument"
return
fi
python -ic "$npz_py_str" "$1"
}
# Source git prompt # Source git prompt
source_existing ~/scripts/git-prompt.sh source_existing ~/scripts/git-prompt.sh
source_existing ~/.bash_prompt.kuba source_existing ~/.bash_prompt.kuba
@@ -66,27 +42,25 @@ source_existing ~/.bash_prompt.kuba
# Activate python virtualenv # Activate python virtualenv
source_existing ~/.python-venv.kuba/bin/activate source_existing ~/.python-venv.kuba/bin/activate
# Source lmod module setup if command -v ipython &> /dev/null; then
source_existing /usr/share/lmod/lmod/init/profile alias p="ipython --pylab"
elif command -v python &> /dev/null; then
alias p=python
fi
complete -o default -C "python ~/.python-venv.kuba/lib/python3.9/site-packages/myqueue/complete.py" mq
complete -o bashdefault -C snakemake-bash-completion snakemake
if [ -z "$DONT_LOAD_LMOD" ]; then
if [ -e /usr/share/lmod/lmod/init/profile ]; then
# Source lmod module setup
. /usr/share/lmod/lmod/init/profile
case $(hostname) in
vera* )
module use "$HOME/.modules.kuba/" module use "$HOME/.modules.kuba/"
module load iccifort/2019.5.281 module use "$HOME/git/auto-venv-setup/lmod-modules/"
module load impi/2018.5.288 module load tools
module load imkl/2019.5.281 else
module load Python/3.7.4 # lmod does not exist
module load clusterappl source $HOME/.modules.kuba/.tools.sh
module load slurm-aliases fi
;; fi
tetralith* )
module use "$HOME/.modules.kuba/"
module load Python/3.6.3-anaconda-5.0.1-nsc1
module load clusterappl
;;
* )
if [ -e /usr/share/lmod/lmod/init/profile ]; then
module use "$HOME/.modules.kuba/"
fi
esac

433
.config/picom.conf Normal file
View File

@@ -0,0 +1,433 @@
#################################
# Shadows #
#################################
# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
#
# shadow = false
shadow = true;
# The blur radius for shadows, in pixels. (defaults to 12)
# shadow-radius = 12
shadow-radius = 7;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
# shadow-opacity = .75
# The left offset for shadows, in pixels. (defaults to -15)
# shadow-offset-x = -15
shadow-offset-x = -7;
# The top offset for shadows, in pixels. (defaults to -15)
# shadow-offset-y = -15
shadow-offset-y = -7;
# Red color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-red = 0
# Green color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-green = 0
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
# shadow-blue = 0
# Hex string color value of shadow (#000000 - #FFFFFF, defaults to #000000). This option will override options set shadow-(red/green/blue)
# shadow-color = "#000000"
# Specify a list of conditions of windows that should have no shadow.
#
# examples:
# shadow-exclude = "n:e:Notification";
#
# shadow-exclude = []
shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g ?= 'Notify-osd'",
"class_g = 'Cairo-clock'",
"_GTK_FRAME_EXTENTS@:c"
];
# Specify a list of conditions of windows that should have no shadow painted over, such as a dock window.
# clip-shadow-above = []
# Specify a X geometry that describes the region in which shadow should not
# be painted in, such as a dock window region. Use
# shadow-exclude-reg = "x10+0+0"
# for example, if the 10 pixels on the bottom of the screen should not have shadows painted on.
#
# shadow-exclude-reg = ""
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
# xinerama-shadow-crop = false
#################################
# Fading #
#################################
# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used.
# fading = false
fading = true;
# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
# fade-in-step = 0.028
fade-in-step = 0.03;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
# fade-out-step = 0.03
fade-out-step = 0.03;
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
# fade-delta = 10
# Specify a list of conditions of windows that should not be faded.
# fade-exclude = []
# Do not fade on window open/close.
# no-fading-openclose = false
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox, Fluxbox, etc.
# no-fading-destroyed-argb = false
#################################
# Transparency / Opacity #
#################################
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
# inactive-opacity = 1
inactive-opacity = 0.8;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
# frame-opacity = 1.0
frame-opacity = 0.7;
# Let inactive opacity set by -i override the '_NET_WM_WINDOW_OPACITY' values of windows.
# inactive-opacity-override = true
inactive-opacity-override = false;
# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
# active-opacity = 1.0
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
# inactive-dim = 0.0
# Specify a list of conditions of windows that should never be considered focused.
# focus-exclude = []
focus-exclude = [ "class_g = 'Cairo-clock'",
"class_g = 'firefox'",
"class_g = 'zoom'",
"class_g = 'Soffice'",
"class_g = 'libreoffice-impress'"
];
# Use fixed inactive dim value, instead of adjusting according to window opacity.
# inactive-dim-fixed = 1.0
# Specify a list of opacity rules, in the format `PERCENT:PATTERN`,
# like `50:name *= "Firefox"`. picom-trans is recommended over this.
# Note we don't make any guarantee about possible conflicts with other
# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.
# example:
# opacity-rule = [ "80:class_g = 'URxvt'" ];
#
# opacity-rule = []
#################################
# Corners #
#################################
# Sets the radius of rounded window corners. When > 0, the compositor will
# round the corners of windows. Does not interact well with
# `transparent-clipping`.
corner-radius = 3
# Exclude conditions for rounded corners.
rounded-corners-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'"
];
#################################
# Background-Blurring #
#################################
# Parameters for background blurring, see the *BLUR* section for more information.
# blur-method =
# blur-size = 12
#
# blur-deviation = false
#
# blur-strength = 5
# Blur background of semi-transparent / ARGB windows.
# Bad in performance, with driver-dependent behavior.
# The name of the switch may change without prior notifications.
#
blur-background = false
# Blur background of windows when the window frame is not opaque.
# Implies:
# blur-background
# Bad in performance, with driver-dependent behavior. The name may change.
#
# blur-background-frame = false
# Use fixed blur strength rather than adjusting according to window opacity.
# blur-background-fixed = false
# Specify the blur convolution kernel, with the following format:
# example:
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1";
#
# blur-kern = ""
blur-kern = "3x3box";
# Exclude conditions for background blur.
# blur-background-exclude = []
blur-background-exclude = [
"window_type = 'dock'",
"window_type = 'desktop'",
"_GTK_FRAME_EXTENTS@:c"
];
#################################
# General Settings #
#################################
# Enable remote control via D-Bus. See the man page for more details.
# dbus = true
# Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
# daemon = false
# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
# `xrender` is the default one.
#
# backend = "glx"
backend = "xrender";
# Enable/disable VSync.
# vsync = false
vsync = true;
# Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
# dbus = false
# Try to detect WM windows (a non-override-redirect window with no
# child that has 'WM_STATE') and mark them as active.
#
# mark-wmwin-focused = false
mark-wmwin-focused = true;
# Mark override-redirect windows that doesn't have a child window with 'WM_STATE' focused.
# mark-ovredir-focused = false
mark-ovredir-focused = true;
# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
#
# detect-rounded-corners = false
detect-rounded-corners = true;
# Detect '_NET_WM_WINDOW_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_WINDOW_OPACITY' of client windows to frame windows.
#
# detect-client-opacity = false
detect-client-opacity = true;
# Use EWMH '_NET_ACTIVE_WINDOW' to determine currently focused window,
# rather than listening to 'FocusIn'/'FocusOut' event. Might have more accuracy,
# provided that the WM supports it.
#
# use-ewmh-active-win = false
# Unredirect all windows if a full-screen opaque window is detected,
# to maximize performance for full-screen windows. Known to cause flickering
# when redirecting/unredirecting windows.
#
# unredir-if-possible = false
# Delay before unredirecting the window, in milliseconds. Defaults to 0.
# unredir-if-possible-delay = 0
# Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
# unredir-if-possible-exclude = []
# Use 'WM_TRANSIENT_FOR' to group windows, and consider windows
# in the same group focused at the same time.
#
# detect-transient = false
detect-transient = true;
# Use 'WM_CLIENT_LEADER' to group windows, and consider windows in the same
# group focused at the same time. This usually means windows from the same application
# will be considered focused or unfocused at the same time.
# 'WM_TRANSIENT_FOR' has higher priority if detect-transient is enabled, too.
#
# detect-client-leader = false
# Resize damaged region by a specific number of pixels.
# A positive value enlarges it while a negative one shrinks it.
# If the value is positive, those additional pixels will not be actually painted
# to screen, only used in blur calculation, and such. (Due to technical limitations,
# with use-damage, those pixels will still be incorrectly painted to screen.)
# Primarily used to fix the line corruption issues of blur,
# in which case you should use the blur radius value here
# (e.g. with a 3x3 kernel, you should use `--resize-damage 1`,
# with a 5x5 one you use `--resize-damage 2`, and so on).
# May or may not work with *--glx-no-stencil*. Shrinking doesn't function correctly.
#
# resize-damage = 1
# Specify a list of conditions of windows that should be painted with inverted color.
# Resource-hogging, and is not well tested.
#
# invert-color-include = []
# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
# Might cause incorrect opacity when rendering transparent content (but never
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
#
# glx-no-stencil = false
# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
# Recommended if it works.
#
# glx-no-rebind-pixmap = false
# Disable the use of damage information.
# This cause the whole screen to be redrawn everytime, instead of the part of the screen
# has actually changed. Potentially degrades the performance, but might fix some artifacts.
# The opposing option is use-damage
#
# no-use-damage = false
use-damage = true;
# Use X Sync fence to sync clients' draw calls, to make sure all draw
# calls are finished before picom starts drawing. Needed on nvidia-drivers
# with GLX backend for some users.
#
# xrender-sync-fence = false
# GLX backend: Use specified GLSL fragment shader for rendering window
# contents. Read the man page for a detailed explanation of the interface.
#
# window-shader-fg = "default"
# Use rules to set per-window shaders. Syntax is SHADER_PATH:PATTERN, similar
# to opacity-rule. SHADER_PATH can be "default". This overrides window-shader-fg.
#
# window-shader-fg-rule = [
# "my_shader.frag:window_type != 'dock'"
# ]
# Force all windows to be painted with blending. Useful if you
# have a glx-fshader-win that could turn opaque pixels transparent.
#
# force-win-blend = false
# Do not use EWMH to detect fullscreen windows.
# Reverts to checking if a window is fullscreen based only on its size and coordinates.
#
# no-ewmh-fullscreen = false
# Dimming bright windows so their brightness doesn't exceed this set value.
# Brightness of a window is estimated by averaging all pixels in the window,
# so this could comes with a performance hit.
# Setting this to 1.0 disables this behaviour. Requires --use-damage to be disabled. (default: 1.0)
#
# max-brightness = 1.0
# Make transparent windows clip other windows like non-transparent windows do,
# instead of blending on top of them.
#
# transparent-clipping = false
# Specify a list of conditions of windows that should never have transparent
# clipping applied. Useful for screenshot tools, where you need to be able to
# see through transparent parts of the window.
#
# transparent-clipping-exclude = []
# Set the log level. Possible values are:
# "trace", "debug", "info", "warn", "error"
# in increasing level of importance. Case doesn't matter.
# If using the "TRACE" log level, it's better to log into a file
# using *--log-file*, since it can generate a huge stream of logs.
#
# log-level = "debug"
log-level = "warn";
# Set the log file.
# If *--log-file* is never specified, logs will be written to stderr.
# Otherwise, logs will to written to the given file, though some of the early
# logs might still be written to the stderr.
# When setting this option from the config file, it is recommended to use an absolute path.
#
# log-file = "/path/to/your/log/file"
# Show all X errors (for debugging)
# show-all-xerrors = false
# Write process ID to a file.
# write-pid-path = "/path/to/your/log/file"
# Window type settings
#
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
# "unknown", "desktop", "dock", "toolbar", "menu", "utility",
# "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
# "tooltip", "notification", "combo", and "dnd".
#
# Following per window-type options are available: ::
#
# fade, shadow:::
# Controls window-type-specific shadow and fade settings.
#
# opacity:::
# Controls default opacity of the window type.
#
# focus:::
# Controls whether the window of this type is to be always considered focused.
# (By default, all window types except "normal" and "dialog" has this on.)
#
# full-shadow:::
# Controls whether shadow is drawn under the parts of the window that you
# normally won't be able to see. Useful when the window has parts of it
# transparent, and you want shadows in those areas.
#
# clip-shadow-above:::
# Controls wether shadows that would have been drawn above the window should
# be clipped. Useful for dock windows that should have no shadow painted on top.
#
# redir-ignore:::
# Controls whether this type of windows should cause screen to become
# redirected again after been unredirected. If you have unredir-if-possible
# set, and doesn't want certain window to cause unnecessary screen redirection,
# you can set this to `true`.
#
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; };
dock = { shadow = false; clip-shadow-above = true; }
dnd = { shadow = false; }
popup_menu = { opacity = 0.8; }
dropdown_menu = { opacity = 0.8; }
};

View File

@@ -7,6 +7,7 @@
title_inactive_bg_color = "#4C566A" title_inactive_bg_color = "#4C566A"
always_split_with_profile = True always_split_with_profile = True
[keybindings] [keybindings]
help = ""
[profiles] [profiles]
[[default]] [[default]]
background_color = "#12204d" background_color = "#12204d"

View File

@@ -1,52 +0,0 @@
conky.config = {
use_spacer='none',
use_xft=true,
font='DejaVu Sans:size=9',
text_buffer_size=2048,
update_interval=600.0,
total_run_times=0,
own_window=true,
own_window_transparent=true,
own_window_type='normal',
own_window_hints='undecorated,skip_taskbar,skip_pager',
own_window_class='Conky-arch',
own_window_argb_visual=true,
own_window_argb_value=0,
draw_shades=false,
draw_outline=false,
draw_borders=false,
stippled_borders=0,
double_buffer=true,
default_color='white',
default_shade_color='black',
--Minimum size of text area
maximum_width=1200 ,
minimum_width=1200 ,
--alignment=top_right,
--gap_x=20,
--gap_y=20,
no_buffers=true,
net_avg_samples=2,
override_utf8_locale=true,
use_spacer=none,
short_units=on,
color1 = '0099ff', -- Arch News
color2 = '0000ff', --Titles
color3 = '3a3a3a', --Dates
color4 = 'dddddd', --Code tag
default_outline_color='black',--'00ccee',
lua_load = '~/.conky/arch/lua.lua'
};
conky.text = [[
${color1}${font DejaVu Sans:normal:size=24}${alignc}Arch-news
${lua_parse conky_print}
]];

View File

@@ -1,84 +0,0 @@
${alignr}${font DejaVu Sans:size=8}Retrieved: 09/14/2018
${color2}${font DejaVu Sans:size=12}libutf8proc>=2.1.1-3 update requires manual intervention
${color}${font}The libutf8proc package prior to version 2.1.1-3 had an incorrect soname link. This has been fixed in 2.1.1-3, so the upgrade will need to overwrite the untracked soname link created by ldconfig. If
you get an error
${color4}${font DejaVu Sans:italic:size=9}libutf8proc: /usr/lib/libutf8proc.so.2 exists in filesystem${color}${font}
when updating, use
${color4}${font DejaVu Sans:italic:size=9}pacman -Suy --overwrite usr/lib/libutf8proc.so.2${color}${font}
to perform the upgrade.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 07/14/2018
${color2}${font DejaVu Sans:size=12}js52 52.7.3-2 upgrade requires intervention
${color}${font}Due to the SONAME of ${color4}${font DejaVu Sans:italic:size=9}/usr/lib/libmozjs-52.so${color}${font} not matching its file name, ldconfig created an untracked file ${color4}${font DejaVu Sans:italic:size=9}/usr/lib/libmozjs-52.so.0${color}${font}. This is now fixed and both files are present in the package.
To pass the upgrade, remove ${color4}${font DejaVu Sans:italic:size=9}/usr/lib/libmozjs-52.so.0${color}${font} prior to upgrading.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 05/04/2018
${color2}${font DejaVu Sans:size=12}glibc 2.27-2 and pam 1.3.0-2 may require manual intervention
${color}${font}The new version of glibc removes support for NIS and NIS+. The default ${color4}${font DejaVu Sans:italic:size=9}/etc/nsswitch.conf${color}${font} file provided by ${color4}${font DejaVu Sans:italic:size=9}filesystem${color}${font} package already reflects this change. Please make sure to merge pacnew file if it
exists prior to upgrade.
NIS functionality can still be enabled by installing ${color4}${font DejaVu Sans:italic:size=9}libnss_nis${color}${font} package. There is no replacement for NIS+ in the official repositories.
${color4}${font DejaVu Sans:italic:size=9}pam 1.3.0-2${color}${font} no longer ships pam_unix2 module and ${color4}${font DejaVu Sans:italic:size=9}pam_unix_*.so${color}${font} compatibility symlinks. Before upgrading, review PAM configuration files in the ${color4}${font DejaVu Sans:italic:size=9}/etc/pam.d${color}${font} directory and replace removed modules with ${color4}${font DejaVu Sans:italic:size=9}pam
_unix.so${color}${font}. Users of pam_unix2 should also reset their passwords after such change. Defaults provided by ${color4}${font DejaVu Sans:italic:size=9}pambase${color}${font} package do not need any modifications.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 04/20/2018
${color2}${font DejaVu Sans:size=12}zita-resampler 1.6.0-1 -> 2 update requires manual intervention
${color}${font}The zita-resampler 1.6.0-1 package was missing a library symlink that has been readded in 1.6.0-2. If you installed 1.6.0-1, ldconfig would have created this symlink at install time, and it will
conflict with the one included in 1.6.0-2. In that case, remove /usr/lib/libzita-resampler.so.1 manually before updating.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 02/22/2018
${color2}${font DejaVu Sans:size=12} The end of i686 support
${color}${font}Following 9 months of deprecation period${color}${font}, support for the i686 architecture effectively ends today. By the end of November, i686 packages will be removed from our mirrors and later from the packages
archive. The [multilib] repository is not affected.
For users unable to upgrade their hardware to x86_64, an alternative is a community maintained fork named Arch Linux 32${color}${font}. See their website for details on migrating existing installations.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 11/08/2017
${color2}${font DejaVu Sans:size=12}Perl library path change
${color}${font}The perl package now uses a versioned path for compiled modules. This means that modules built for a non-matching perl version will not be loaded any more and must be rebuilt.
A pacman hook warns about affected modules during the upgrade by showing output like this:
You must rebuild all affected packages against the new perl package before you can use them again. The change also affects modules installed directly via CPAN. Rebuilding will also be necessary again
with future major perl updates like 5.28 and 5.30.
Please note that rebuilding was already required for major updates prior to this change, however now perl will no longer try to load the modules and then fail in strange ways.
If the build system of some software does not detect the change automatically, you can use ${color4}${font DejaVu Sans:italic:size=9}perl -V:vendorarch${color}${font} in your PKGBUILD to query perl for the correct path. There is also ${color4}${font DejaVu Sans:italic:size=9}sitearch${color}${font} for software
that is not packaged with pacman.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 09/02/2017
${color2}${font DejaVu Sans:size=12}Deprecation of ABS tool and rsync endpoint
${color}${font}Due to high maintenance cost of scripts related to the Arch Build System, we have decided to deprecate the ${color4}${font DejaVu Sans:italic:size=9}abs${color}${font} tool and thus rsync as a way of obtaining PKGBUILDs.
The ${color4}${font DejaVu Sans:italic:size=9}asp${color}${font} tool, available in [extra], provides similar functionality to ${color4}${font DejaVu Sans:italic:size=9}abs${color}${font}. ${color4}${font DejaVu Sans:italic:size=9}asp export pkgname${color}${font} can be used as direct alternative; more information about its usage can be found in the documentation${color}${font}.
Additionally Subversion sparse checkouts, as described here${color}${font}, can be used to achieve a similar effect. For fetching all PKGBUILDs, the best way is cloning the svntogit${color}${font} mirrors.
While the ${color4}${font DejaVu Sans:italic:size=9}extra/abs${color}${font} package has been already dropped, the rsync endpoint (rsync://rsync.archlinux.org/abs) will be disabled by the end of the month.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 05/15/2017
${color2}${font DejaVu Sans:size=12}ca-certificates-utils 20170307-1 upgrade requires manual intervention
${color}${font}The upgrade to <strong>ca-certificates-utils 20170307-1${color}${font} requires manual intervention because a symlink which used to be generated post-install has been moved into the package proper.
As deleting the symlink may leave you unable to download packages, perform this upgrade in three steps:${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 03/15/2017
${color2}${font DejaVu Sans:size=12}mesa with libglvnd support is now in testing
${color}${font}${color4}${font DejaVu Sans:italic:size=9}mesa${color}${font}-17.0.0-3 can now be installed side-by-side with ${color4}${font DejaVu Sans:italic:size=9}nvidia${color}${font}-378.13 driver without any libgl/libglx hacks, and with the help of Fedora and upstream xorg-server patches.
First step was to remove the libglx symlinks with xorg-server-1.19.1-3 and associated mesa/nvidia drivers through the removal of various libgl packages. It was a tough moment because it was breaking
optimus system, ${color4}${font DejaVu Sans:italic:size=9}xorg-server${color}${font} configuration needs manual updating.
The second step is now here, with an updated 10-nvidia-drm-outputclass.conf${color}${font} file that should help to have an "out-of-the-box" working ${color4}${font DejaVu Sans:italic:size=9}xorg-server${color}${font} experience with optimus system.
Please test this extensively and post your feedback in this forum thread${color}${font} or in our bugtracker${color}${font}.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 02/27/2017
${color2}${font DejaVu Sans:size=12}Phasing out i686 support
${color}${font}Due to the decreasing popularity of i686 among the developers and the community, we have decided to phase out the support of this architecture.
The decision means that February ISO will be the last that allows to install 32 bit Arch Linux. The next 9 months are deprecation period, during which i686 will be still receiving upgraded packages.
Starting from November 2017, packaging and repository tools will no longer require that from maintainers, effectively making i686 unsupported.
However, as there is still some interest in keeping i686 alive, we would like to encourage the community to make it happen with our guidance. The arch-ports${color}${font} mailing list and #archlinux-ports IRC
channel on Freenode will be used for further coordination.
The [multilib] repository will not be affected by this change.${color3}${font DejaVu Sans:size=8}${alignr} Uppdated: 01/25/2017

View File

@@ -1,67 +0,0 @@
#!/bin/bash
# Written by Peter Garceau
# Based on the RDF Feed Display Script by Hellf[i]re v0.1
#
# This script is designed for the Arch Linux News Feed.
#
# This script depends on curl.
# pacman -Sy curl
#
# Usage:
# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh}
#
# Usage Example
# ${execi 300 /home/youruser/scripts/conky-rss.sh}
#Try to download feed
RES=$(curl -fs https://www.archlinux.org/feeds/news/)
SUCCESS=$?
if [ $SUCCESS == 0 ]
then
echo $RES > ~/.conky/arch/cache
fi
#RSS Setup
LINES=4 #Number of headlines
FEED=$(cat ~/.conky/arch/cache)
if [ "$FEED" ]
then
IFS=$'\n'
TITLES=($(echo $FEED |
sed -e 's/></>\n</g' |
sed -n '/<title>/p'))
ITEMS=($(echo $FEED |
sed -e 's/<item>/\n<item>/g'))
unset IFS
OUTPUT='1'
i=1
while [ $i -le $LINES ]
do
OUTPUT+='\n'
OUTPUT+=$(echo ${TITLES[$i]} | sed -n '/<title>/p' | \
sed -e 's/<title>//' | sed -e 's/<\/title>//')
OUTPUT+='\n'
OUTPUT+=$(echo ${ITEMS[$i]} | sed -e 's/.*<pubDate>\(.*\)<\/pubDate>.*/\1/' | \
awk '{print $1 " " $2 " " $3}')
OUTPUT+='\n'
OUTPUT+=$(echo ${ITEMS[$i]} | sed -e 's/.*<description>\(.*\)<\/description>.*/\1/' | \
sed -e 's/&lt;\/p&gt; &lt;p&gt;/\n/g' | sed -e 's/&lt;\/p&gt;//g' | \
sed -e 's/&lt;p&gt;//g')
i=$(($i + 1))
done
echo -e $OUTPUT
echo -e $OUTPUT | sed -e 's/&lt;/</g' | sed -e 's/&gt;/>/g' | \
sed -e 's/<ul>/\\n/g' | sed -e 's/<\/ul>/\\n/g' | sed -e 's/<li>/\\n• /g' | sed -e 's/<\/li>//g' | \
sed -e 's/<a href=[^>]*>/\\3/g' | sed -e 's/<\/a>/\\d/g' | \
sed -e 's/<strong>/\\b/g' | sed -e 's/<\/strong>/\\r/g' | \
sed -e 's/<pre>//g' | sed -e 's/<\/pre>//g' | \
sed -e 's/<code>/\\i/g' | sed -e 's/<\/code>/\\r/g' \
> ~/.conky/arch/feed
fi
#Do not update anything if curl fails

View File

@@ -1,174 +0,0 @@
line_width = 200
lipsum = [[
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur eget dolor a dui interdum rhoncus. Aenean congue nunc quis sem ultrices, vel fringilla tellus dignissim. Vivamus vitae purus ligula. Quisque ante elit, ultrices id aliquam a, porttitor quis risus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nunc elementum nisl nec efficitur mattis. Donec viverra tempor enim nec dictum. Suspendisse quam neque, posuere eu magna sit amet, rhoncus finibus risus. Phasellus tristique ac lacus eu ultricies. Quisque varius purus at eros rutrum hendrerit. Donec efficitur justo eu scelerisque mollis. Fusce dictum aliquam convallis. Phasellus eget nunc lacus. Nunc urna dui, tempor pharetra consectetur non, elementum sed purus. Phasellus consectetur quis libero et semper.
Pellentesque condimentum sem quis diam commodo convallis. Morbi et ligula sagittis, venenatis tortor ut, molestie dui. Nam egestas, purus eu efficitur mollis, ex neque convallis felis, at egestas nisi dolor sed enim. Pellentesque a felis facilisis orci dapibus porttitor. Aenean et viverra nulla, interdum eleifend neque. Nunc sem justo, vulputate et arcu eget, dignissim lobortis dui. Vivamus laoreet feugiat elit.
Fusce euismod nibh vitae orci gravida pretium. Quisque feugiat lacinia tortor eget sagittis. Morbi in mauris sit amet dui vehicula egestas. Curabitur sit amet facilisis lectus. Donec id turpis eleifend, hendrerit turpis eu, tristique velit. Curabitur pulvinar facilisis tincidunt. In hac habitasse platea dictumst. Donec convallis erat id neque pretium, non gravida felis imperdiet. Vivamus hendrerit, nunc id rutrum tristique, arcu leo auctor sapien, id fringilla mauris erat sed justo. Etiam pharetra quis enim sit amet imperdiet. Vestibulum condimentum massa vel ullamcorper malesuada. Duis libero eros, facilisis in suscipit in, varius id ipsum.
Donec in orci ac leo dapibus maximus sed eget tortor. Sed blandit eros lectus, et venenatis erat aliquam sed. Vestibulum risus ex, laoreet at malesuada non, egestas ut lacus. Quisque sed malesuada leo. Ut id ligula accumsan, commodo massa eget, porta mauris. Mauris a lectus ac tellus ornare aliquet quis at arcu. Curabitur nec sem sodales, mattis velit non, tempor arcu. Morbi sit amet maximus lacus, nec venenatis est. Curabitur et congue dui. Nullam lacinia augue non quam hendrerit facilisis.
Curabitur molestie mauris eget tempor mattis. Donec velit arcu, iaculis quis leo et, sodales venenatis erat. Maecenas in malesuada erat, vitae iaculis odio. Praesent id ultrices sem. In hac habitasse platea dictumst. In aliquet, nisl laoreet bibendum sodales, justo lacus aliquam mi, non elementum urna odio et nunc. Nulla interdum, ante in vestibulum pellentesque, nunc enim iaculis urna, eget convallis lectus ex sed tortor. Morbi suscipit malesuada felis at aliquam.
]]
text = [[
<p>
<H2>The string library</H2>
<p>
Lua supplies a range of useful functions for processing and manipulating strings in its standard library. More details are supplied in the <a href="/wiki/StringLibraryTutorial" >StringLibraryTutorial</a>. Below are a few examples of usage of the string library.
<DL>
<dt><dd><pre class="code">
&gt; = <span class="library">string.byte</span>(<span class="string">"ABCDE"</span>, 2) <span class="comment">-- return the ASCII value of the second character</span>
66
&gt; = <span class="library">string.char</span>(65,66,67,68,69) <span class="comment">-- return a string constructed from ASCII values</span>
ABCDE
&gt; = <span class="library">string.find</span>(<span class="string">"hello Lua user"</span>, <span class="string">"Lua"</span>) <span class="comment">-- find substring "Lua"</span>
7 9
&gt; = <span class="library">string.find</span>(<span class="string">"hello Lua user"</span>, <span class="string">"l+"</span>) <span class="comment">-- find one or more occurrences of "l"</span>
3 4
&gt; = <span class="library">string.format</span>(<span class="string">"%.7f"</span>, <span class="library">math.pi</span>) <span class="comment">-- format a number</span>
3.1415927
&gt; = <span class="library">string.format</span>(<span class="string">"%8s"</span>, <span class="string">"Lua"</span>) <span class="comment">-- format a string</span>
Lua
</pre>
</DL>
<p>
<H2>Coercion</H2>
<p>
Lua performs automatic conversion of numbers to strings and vice versa where it is appropriate. This is called <em>coercion</em>.
<DL>
<dt><dd><pre class="code">
&gt; = <span class="string">"This is Lua version "</span> .. 5.1 .. <span class="string">" we are using."</span>
This is Lua version 5.1 we are using.
&gt; = <span class="string">"Pi = "</span> .. <span class="library">math.pi</span>
Pi = 3.1415926535898
&gt; = <span class="string">"Pi = "</span> .. 3.1415927
Pi = 3.1415927
</pre>
</DL>
As shown above, during coercion, we do not have full control over the formatting of the conversion. To format the number as a string as we would like we can use the <code>string.format()</code> function. e.g.,
<DL>
<dt><dd><pre class="code">
&gt; = <span class="library">string.format</span>(<span class="string">"%.3f"</span>, 5.1)
5.100
&gt; = <span class="string">"Lua version "</span> .. <span class="library">string.format</span>(<span class="string">"%.1f"</span>, 5.1)
Lua version 5.1
</pre>
]]
text = text:gsub("\n"," ")
function indent_entry(contents,init,break_at)
if contents:len() <= break_at then
return contents -- Done
end
local begin_tag,end_tag = contents:find("<(.-)>",init)
if not begin_tag or begin_tag > break_at then
-- No tag exists or next tag is behind preferred break
-- Find last space before break, if no space break word at break_at
for i=break_at,init,-1 do -- Iterate backwards over string
if contents:sub(i,i) == " " then
break_at = i
break;
end
end
contents = contents:sub(1,break_at) .. "\n" .. contents:sub(break_at+1)
init = break_at+1 -- Not necessarily same value as passed to the function
break_at = break_at + line_width
debug = "No tag or tag behind break."
elseif end_tag < break_at then
-- Next tag is before preferred break
-- Increase break_at by length of tag and iterate (init = end_tag)
init = end_tag
break_at = break_at + 1 + end_tag - begin_tag
debug = "Tag entirely before break"
else
-- Case break_at in the middle of tag:
-- Increase break at by length of tag
init = end_tag + 1
break_at = break_at + 1 + end_tag - begin_tag
debug = "Tag in the middle of break"
end
return indent_entry(contents,init,break_at)
end
function parse_paragraph(par)
return indent_entry(par:gsub("\n", " "),1,line_width)
end
function substitute_tags(content)
return content:gsub("<code>",("${color4}${font %s}"):format(font_i(9)))
:gsub("<b>",("${font_b %s}"):format(font_b(9)))
:gsub("</(.-)>","${color}${font}")
:gsub("<a(.-)>","")
end
function parse_entry(contents)
local ret = ""
for paragraph in contents:gmatch("<p>(.-)</p>") do
if ret ~= "" then
ret = ret .. "\n\n" -- Add line break on all except first entry
end
ret = ret .. parse_paragraph(paragraph)
end
return substitute_tags(ret)
end
function format_entry(entry)
local entry_contents = parse_entry(entry.summary)
local res = ('${color2}${font %s}%s\n'):format(font(12),entry.title)
res = ('%s${color}${font}%s'):format(res,entry_contents)
res = ('%s${color3}${font %s}${alignr} Uppdated: %s\n\n'):format(res,font(8),os.date("%x",entry.updated_parsed))
return res
end
function conky_print()
local f = assert(get_file_handle('rb'))
local content = f:read("*all")
f:close()
return content
end
function fetch_feed()
-- Fetch over http
local http_request = require "http.request"
local url = "https://www.archlinux.org/feeds/news/"
local headers, stream = assert(http_request.new_from_uri(url):go())
local body = assert(stream:get_body_as_string())
if headers:get ":status" ~= "200" then
error(body)
end
a,s,c = headers:geti(3)
p="%a+, (%d+) (%a+) (%d+) (%d+):(%d+):(%d+) GMT"
day,month,year,hour,min,sec=s:match(p)
MON={Jan=1,Feb=2,Mar=3,Apr=4,May=5,Jun=6,Jul=7,Aug=8,Sep=9,Oct=10,Nov=11,Dec=12}
month=MON[month]
offset=os.time()-os.time(os.date("!*t"))
retrieved = os.date("%x",os.time({day=day,month=month,year=year,hour=hour,min=min,sec=sec})+offset)
-- Parse
local feedparser = require("feedparser")
entries = feedparser.parse(body).entries
s = entries[2].summary
local res = ('${alignr}${font %s}Retrieved: %s\n'):format(font(8),retrieved)
for key,entry in pairs(entries) do
res = res .. format_entry(entry)
end
-- Save to cache
local file = get_file_handle("w")
io.output(file)
io.write(res)
io.close(file)
return parsed
end
function font(size)
return ('DejaVu Sans:size=%d'):format(size)
end
function font_b(size)
return ('DejaVu Sans:bold:size=%d'):format(size)
end
function font_i(size)
return ('DejaVu Sans:italic:size=%d'):format(size)
end
function get_file_handle(opt)
local filename = '/home/kuba/.conky/arch/cache'
return io.open(filename, opt)
end
s = fetch_feed()

View File

@@ -1,54 +0,0 @@
conky.config = {
use_spacer='none',
use_xft=true,
font='DejaVu Sans:size=9',
text_buffer_size=2048,
update_interval=600,
total_run_times=0,
own_window=true,
own_window_transparent=true,
own_window_type='normal',
own_window_hints='undecorated,skip_taskbar,skip_pager',
own_window_class='Conky-gmail',
own_window_argb_visual=true,
own_window_argb_value=0,
draw_shades=false,
draw_outline=false,
draw_borders=false,
stippled_borders=0,
double_buffer=true,
default_color='white',
default_shade_color='black',
--Minimum size of text area
maximum_width=1200 ,
minimum_width=1200 ,
--alignment=top_right,
--gap_x=20,
--gap_y=20,
no_buffers=true,
net_avg_samples=2,
override_utf8_locale=true,
use_spacer=none,
short_units=on,
default_color=000,
default_shade_color=black,
color1 = '0099ff',
color2 = '0000ff',
color3 = '3a3a3a',
color4 = 'dddddd',
default_outline_color='2edd2e'
};
conky.text = [[
${alignc}${font FontAwesome:size=24}${font Liberation Sans:size=24}mail${font}
${color7}${hr}${color}
# ${execp ~/.conky/gmail/gmail_imap.py}
]];

View File

@@ -1,116 +0,0 @@
#! /usr/bin/env python3
import sys
import imaplib
import email
import email.header
import datetime
from textwrap import wrap # For pretty printing assistance
import json
import time
import os.path
from os.path import expanduser
WRAP_LIMIT = 80
path = "/home/kuba/.conky/gmail/last.json"
def process_mailbox(M):
rv, data = M.search(None, "ALL")
if rv != 'OK':
print ("No messages found!")
return
numbers = data[0].split()
ln = len(numbers)
timestamp = str(round(time.time()))
parsed_data = {} #Find and save last 10 emails
parsed_data['timestamp'] = timestamp
emails = []
for num in numbers[ln:ln-10:-1]:
rv, data = M.fetch(num, '(RFC822)')
if rv != 'OK':
print ("ERROR getting message"), num
return
eml = {}
msg = email.message_from_bytes(data[0][1])
eml.update({'subject' : decode_field(msg['Subject'])})
eml.update({'sender' : decode_field(msg['From'])})
date_tuple = email.utils.parsedate_tz(msg['Date'])
if date_tuple:
local_date = datetime.datetime.fromtimestamp(
email.utils.mktime_tz(date_tuple))
eml.update({'date' : local_date.strftime("%a, %d %b %Y %H:%M:%S")})
emails.append(eml)
parsed_data['emails'] = emails
with open(path, 'w') as outfile:
json.dump(parsed_data, outfile)
def fetch_mail():
M = imaplib.IMAP4_SSL('imap.gmail.com')
try:
json_data=open(expanduser('~')+'/.conky/scripts/.passwords.json')
data = json.load(json_data)
username=data['gmail']['username']
password=data['gmail']['password']
rv, data = M.login(username, password)
except imaplib.IMAP4.error:
print ("LOGIN FAILED!!! ")
sys.exit(1)
rv, data = M.select()
if rv == 'OK':
# print("Processing mailbox...\n")
process_mailbox(M)
M.close()
else:
print("ERROR: Unable to open mailbox ", rv)
M.logout()
def fill(text, width):
'''A custom method to assist in pretty printing'''
if len(text) < width:
return text + ' '*(width-len(text))
else:
return text
def decode_field(data):
decode = email.header.decode_header(data)[0]
if decode[1] == None or decode[1] == 'unknown-8bit':
return str(decode[0])
else:
return str(decode[0], decode[1])
def print_output(data):
timestamp = int(data['timestamp'])
updated = time.strftime("%m/%d %H:%M", time.gmtime(timestamp))
print ("${alignr}Updated: ${color white}%s" % updated)
for mail in data['emails']:
subject = mail['subject']
sender = mail['sender']
dte = mail['date']
if(len(subject) > WRAP_LIMIT - 3):
print ("${color1}%s..." % subject)
else:
print ("${color1}%s" % subject)
# Does file exist?
if not (os.path.isfile(path)):
fetch_mail()
with open(path) as infile:
data = json.load(infile)
# Is data recently fetched?
ts = int(data['timestamp'])
now = round(time.time())
if (ts + 3600 < now):
fetch_mail()
with open(path) as infile:
data = json.load(infile)
# Format output
print_output(data)

View File

View File

@@ -1,147 +0,0 @@
line_width = 200
function indent_entry(contents,init,break_at)
if contents:len() <= break_at then
return contents -- Done
end
local begin_tag,end_tag = contents:find("<(.-)>",init)
if not begin_tag or begin_tag > break_at then
-- No tag exists or next tag is behind preferred break
-- Find last space before break, if no space break word at break_at
for i=break_at,init,-1 do -- Iterate backwards over string
if contents:sub(i,i) == " " then
break_at = i
break;
end
end
contents = contents:sub(1,break_at) .. "\n" .. contents:sub(break_at+1)
init = break_at+1 -- Not necessarily same value as passed to the function
break_at = break_at + line_width
debug = "No tag or tag behind break."
elseif end_tag < break_at then
-- Next tag is before preferred break
-- Increase break_at by length of tag and iterate (init = end_tag)
init = end_tag
break_at = break_at + 1 + end_tag - begin_tag
debug = "Tag entirely before break"
else
-- Case break_at in the middle of tag:
-- Increase break at by length of tag
init = end_tag + 1
break_at = break_at + 1 + end_tag - begin_tag
debug = "Tag in the middle of break"
end
return indent_entry(contents,init,break_at)
end
function parse_paragraph(par)
return indent_entry(par:gsub("\n", " "),1,line_width)
end
function substitute_tags(content)
return content:gsub("<code>",("${color4}${font %s}"):format(font_i(9)))
:gsub("<b>",("${font_b %s}"):format(font_b(9)))
:gsub("</(.-)>","${color}${font}")
:gsub("<a(.-)>","")
end
function parse_entry(contents)
local ret = ""
for paragraph in contents:gmatch("<p>(.-)</p>") do
if ret ~= "" then
ret = ret .. "\n\n" -- Add line break on all except first entry
end
ret = ret .. parse_paragraph(paragraph)
end
return substitute_tags(ret)
end
function format_entry(entry)
local entry_contents = parse_entry(entry.summary)
local res = ('${color2}${font %s}%s\n'):format(font(12),entry.title)
res = ('%s${color}${font}%s'):format(res,entry_contents)
res = ('%s${color3}${font %s}${alignr} Uppdated: %s\n\n'):format(res,font(8),os.date("%x",entry.updated_parsed))
return res
end
function conky_print()
local f = assert(get_file_handle('rb'))
local content = f:read("*all")
f:close()
return content
end
function fetch_feed()
local imap4 = require "imap4"
local Message = require "pop3.message"
local connection = imap4('imap.gmail.com', 993)
assert(connection:isCapable('IMAP4rev1'))
connection:login('****', '****')
-- Select INBOX with read only permissions.
local info = connection:examine('INBOX')
print(info.exist, info.recent)
-- List info on the 4 most recent mails.
for _,v in pairs(connection:fetch('RFC822', (info.exist-4)..':*')) do
print("-------------------------")
local msg = Message(v.RFC822)
print("ID: ", msg:id())
print("subject: ", msg:subject())
print("to: ", msg:to())
print("from: ", msg:from())
print("from addr: ", msg:from_address())
print("reply: ", msg:reply_to())
print("reply addr: ", msg:reply_address())
print("trunc: ", msg:is_truncated())
for i,v in ipairs(msg:full_content()) do
if v.text then print(" ", i , "TEXT: ", v.type, #v.text)
else print(" ", i , "FILE: ", v.type, v.file_name or v.name, #v.data) end
end
end
-- close connection
connection:logout()
-- Fetch over http
local http_request = require "http.request"
local url = "https://www.archlinux.org/feeds/news/"
local headers, stream = assert(http_request.new_from_uri(url):go())
local body = assert(stream:get_body_as_string())
if headers:get ":status" ~= "200" then
error(body)
end
a,s,c = headers:geti(3)
p="%a+, (%d+) (%a+) (%d+) (%d+):(%d+):(%d+) GMT"
day,month,year,hour,min,sec=s:match(p)
MON={Jan=1,Feb=2,Mar=3,Apr=4,May=5,Jun=6,Jul=7,Aug=8,Sep=9,Oct=10,Nov=11,Dec=12}
month=MON[month]
offset=os.time()-os.time(os.date("!*t"))
retrieved = os.date("%x",os.time({day=day,month=month,year=year,hour=hour,min=min,sec=sec})+offset)
-- Parse
local feedparser = require("feedparser")
entries = feedparser.parse(body).entries
s = entries[2].summary
local res = ('${alignr}${font %s}Retrieved: %s\n'):format(font(8),retrieved)
for key,entry in pairs(entries) do
res = res .. format_entry(entry)
end
-- Save to cache
local file = get_file_handle("w")
io.output(file)
io.write(res)
io.close(file)
return parsed
end
function font(size)
return ('DejaVu Sans:size=%d'):format(size)
end
function font_b(size)
return ('DejaVu Sans:bold:size=%d'):format(size)
end
function font_i(size)
return ('DejaVu Sans:italic:size=%d'):format(size)
end
function get_file_handle(opt)
local filename = '/home/kuba/.conky/arch/cache'
return io.open(filename, opt)
end
s = fetch_feed()

View File

@@ -1,54 +0,0 @@
conky.config = {
use_spacer='none',
use_xft=true,
font='Liberation Sans:Bold:size=24',
text_buffer_size=2048,
update_interval=1.0,
total_run_times=0,
own_window=true,
own_window_transparent=true,
own_window_type='normal',
own_window_hints='undecorated,skip_taskbar,skip_pager',
own_window_class='Conky-music',
own_window_argb_visual=true,
own_window_argb_value=0,
draw_shades=false,
draw_outline=false,
draw_borders=false,
stippled_borders=0,
double_buffer=true,
draw_blended=false,
default_color='white',
default_shade_color='black',
--Minimum size of text area
maximum_width=1200 ,
--alignment='top_left',
--gap_x=1940,
--gap_y=0,
no_buffers=true,
net_avg_samples=2,
override_utf8_locale=true,
use_spacer=none,
short_units=on,
default_color='dddddd',
color1 = 'C7FF8E',
color2 = '000000',
color7 = '333333'
};
conky.text = [[
${if_existing /tmp/kuba_now_playing }
${color2}${exec cat /tmp/kuba_now_playing 2> /dev/null}${color}
${image /tmp/kuba_now_playing_cover.png -p -f 3 0,0 -s 200x200}
${else}
Not playing
${endif}
]];

View File

@@ -1,26 +0,0 @@
#!/bin/bash
# Written by Demetrio Ferro <ferrodemetrio@gmail.com> <https://twitter.com/DemetrioFerro>
# Distributed under license GPLv3+ GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY. YOU USE AT YOUR OWN RISK. THE AUTHOR
# WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY
# OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.
# See the GNU General Public License for more details.
first_cover=""
while :
do
if [ -e ~/.conky/music/meta ]
then
new_cover=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="mpris:artUrl") print $(i+2)}')
if [ "$new_cover" != "$first_cover" ]
then
first_cover="$new_cover"
wget -O ~/.conky/music/last_album_pic.png $new_cover
fi
fi
sleep 1
done

View File

@@ -1,22 +0,0 @@
#!/bin/bash
old_meta=""
while :
do
if [ "$(playerctl status)" = "Playing" ]
then
new_meta=$(playerctl metadata)
if [ "$new_meta" != "$old_meta" ]
then
echo $new_meta > ~/.conky/music/meta
old_meta=$new_meta
fi
else
new_meta=''
if [ -e ~/.conky/music/meta ]
then
rm ~/.conky/music/meta
fi
fi
sleep 1
done

View File

@@ -1,16 +0,0 @@
#!/bin/bash
width=26
space=' ' #20 spaces
if [ -f $META_FILE ]; then
artist=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="xesam:artist") print $(i+2)}')
album=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="xesam:album") print $(i+2)}')
title=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="xesam:title") print $(i+2)}')
out=$(echo "$artist"; echo "$title"; echo "$album")
out=$(echo "$out" | fmt -s --width $width)
mapfile -t var <<< "$out"
for word in "${var[@]}"; do
echo "$space $word"
done
else
echo "Nothing playing"
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -1,58 +0,0 @@
#!/bin/bash
fetch_art(){
first_cover=""
if [ -e ~/.conky/music/meta ]
then
new_cover=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="mpris:artUrl") print $(i+2)}')
if [ "$new_cover" != "$first_cover" ]
then
first_cover="$new_cover"
wget -O ~/.conky/music/last_album_pic.png $new_cover
fi
fi
}
fetch_meta(){
old_meta=""
if [ "$(playerctl status)" = "Playing" ]
then
new_meta=$(playerctl metadata)
if [ "$new_meta" != "$old_meta" ]
then
echo $new_meta > ~/.conky/music/meta
old_meta=$new_meta
fi
else
new_meta=''
if [ -e ~/.conky/music/meta ]
then
rm ~/.conky/music/meta
fi
fi
}
running=false
while :
do
if [ $running = false ]; then
spotify_process_id=$(pidof spotify)
if [[ ! -z $spotify_process_id ]]; then
~/.conky/music/fetch_meta.sh & meta_PID=$!
~/.conky/music/fetch_art.sh & art_PID=$!
running=true
fi
else
spotify_process_id=$(pidof spotify)
if [[ -z $spotify_process_id ]]; then
if [[ ! -z $meta_PID ]]; then
kill $meta_PID
fi
if [[ ! -z $art_PID ]]; then
kill $art_PID
fi
running=false
fi
fi
sleep 10
done

View File

@@ -1,63 +0,0 @@
#!/usr/bin/env python3
import os
import urllib.request
import gi
gi.require_version('Playerctl', '2.0')
from gi.repository import Playerctl, GLib
metadata_file = '/tmp/kuba_now_playing'
album_cover_file = '/tmp/kuba_now_playing_cover.png'
manager = Playerctl.PlayerManager()
last_spotify_metadata = None # Keep this as spotify gives several notifications
def on_play(player, status, manager):
# print('player is playing: {}'.format(player.props.player_name))
pass
def download_album_cover(url):
image = urllib.request.urlopen(url)
with open(album_cover_file,'wb') as output:
output.write(image.read())
space = ' '
def on_metadata(player, metadata, manager):
global last_spotify_metadata
if last_spotify_metadata == metadata:
return
last_spotify_metadata = metadata
keys = metadata.keys()
with open(metadata_file, 'w+') as f:
f.write('{}{}\n'.format(space, metadata['xesam:artist'][0]))
f.write('{}{}\n'.format(space, metadata['xesam:title']))
f.write('{}{}'.format(space, metadata['xesam:album']))
download_album_cover(metadata['mpris:artUrl'])
def init_player(name):
# choose if you want to manage the player based on the name
if name.name in ['spotify']:#, 'vlc', 'cmus']:
player = Playerctl.Player.new_from_name(name)
#player.connect('playback-status::playing', on_play, manager)
player.connect('metadata', on_metadata, manager)
manager.manage_player(player)
return player
def on_name_appeared(manager, name):
player = init_player(name)
# if player != None:
# print('player has appeared: {}'.format(player.props.player_name))
def on_player_vanished(manager, player):
print('player has exited: {}'.format(player.props.player_name))
os.remove(metadata_file)
manager.connect('name-appeared', on_name_appeared)
manager.connect('player-vanished', on_player_vanished)
for name in manager.props.player_names:
init_player(name)
main = GLib.MainLoop()
main.run()

View File

@@ -1,74 +0,0 @@
#!/usr/bin/env python3
import pathlib
import re
from datetime import datetime
LOG_PATH = pathlib.Path("/var/log/pacman.log")
def get_log():
with LOG_PATH.open() as fp:
log_text = fp.read()
return log_text
def parse_pacman_line(line):
if len(line) > 0:
date_str = line[:18]
pacman_indicator = line[19:27]
message = line[28:]
if pacman_indicator == "[PACMAN]":
parsed_date = datetime.strptime(date_str,
"[%Y-%m-%d %H:%M]")
return {"date": parsed_date,
"message": message}
return None
def get_last_sync(log_text):
last_sync = None
for line in log_text.split("\n"):
parsed_line = parse_pacman_line(line)
if parsed_line is None:
continue
else:
if parsed_line["message"] == "synchronizing package lists":
last_sync = parsed_line["date"]
return last_sync
def get_last_system_upgrade(log_text):
last_upgrade = None
for line in log_text.split("\n"):
parsed_line = parse_pacman_line(line)
if parsed_line is None:
continue
else:
if parsed_line["message"] == "starting full system upgrade":
last_upgrade = parsed_line["date"]
return last_upgrade
def get_diffs(t):
now = datetime.now()
diff = now - t
if diff.days != 0:
return "{}d".format(diff.days)
elif diff.seconds > 3600:
return "{}h".format(diff.seconds // 3600)
else:
return "{}m".format(diff.seconds // 60)
if __name__ == "__main__":
text = get_log()
last_sync = get_last_sync(text)
last_upgrade = get_last_system_upgrade(text)
last_sync_diff = get_diffs(last_sync)
last_upgrade_diff = get_diffs(last_upgrade)
print("S: {} U: {}".format(last_sync_diff,
last_upgrade_diff))

View File

@@ -1,42 +0,0 @@
{
"gmail":
{
"username":"jakub.fojt96@gmail.com",
"password":"donotforget"
},
"github":
{
"username": "kuben",
"password": "githubpassword",
"fav_repos" : ["madhur.github.com", "portablejekyll", "GAnalytics", "wunder-java", "msysgit-2.0.0"]
},
"feedly":
{
"access_token": "feedly_access_token",
"access_code" : "feedly_access_code",
"refresh_token" : "feedly_refresh_token"
},
"twitter":
{
"key": "xxxxxxxx",
"secret":"xxxxxxxx",
"access_token": "xxxxxxxx",
"user": "your twitter screen name"
},
"pocket":
{
"key": "xxxxx",
"request_token":"xxxxxx",
"access_token" : "xxxxxxx"
},
"so" :
{
"userid":"stackoverflow_user_id"
},
"weather":
{
"location_code":"SWXX0043"
}
}

View File

@@ -1,10 +0,0 @@
cat /proc/mounts | awk '{ if ( $1 ~ /\/dev/ )
{
num_elem = split($2,str_array,"/")
if (str_array[num_elem] == "")
{
str_array[num_elem] = "/";
}
printf "%5.5s: ${fs_free %s} / ${fs_size %s}\n${fs_bar 6 %s}\n", str_array[num_elem], $2, $2, $2
}
}'

View File

@@ -1,17 +0,0 @@
#!/bin/bash
msgcount=$(fbcmd NOTIFY | grep MESSAGES_UNREAD | grep -oE "[[:digit:]]{1,}")
notifycount=$(fbcmd NOTICES unread | grep -c :title)
friendcount=$(fbcmd NOTIFY | grep FRIEND_REQUESTS | grep -oE "[[:digit:]]{1,}")
currenttime=$(date +%I:%M)
if [[ "$msgcount" -eq "0" ]] && [[ "$notifycount" -eq "0" ]] && [[ "$friendcount" -eq "0" ]]
then
echo '${color}No new updates ${alignr}Updated: ${color white}'$currenttime
else
echo '${color white}'$msgcount'${color aaaaaa} NEW MESSAGE(S) ${alignr}Updated: ${color white}'$currenttime
echo '${color white}'$notifycount'${color aaaaaa} NEW NOTIFICATION(S)'
echo '${color white}'$friendcount'${color aaaaaa} NEW Friend Request(s)'
fi

View File

@@ -1,71 +0,0 @@
#!/usr/bin/env python
from feedly import FeedlyClient
import json
from subprocess import call
from os.path import expanduser
import time
#Categories to ignore, you can add yours
ignored=["global.all", "global.must", "global.uncategorized", "Security", "Ignore", "GMAT", "sharepoint", "madhur"]
FEEDLY_REDIRECT_URI = "http://localhost"
def get_feedly_client(token=None):
if token:
return FeedlyClient(token=token, sandbox=False)
else:
return FeedlyClient(
client_id=FEEDLY_CLIENT_ID,
client_secret=FEEDLY_CLIENT_SECRET,
sandbox=False
)
def auth(request):
feedly = get_feedly_client()
# Redirect the user to the feedly authorization URL to get user code
code_url = feedly.get_code_url(FEEDLY_REDIRECT_URI)
return redirect(code_url)
def callback(request):
code=request.GET.get('code','')
if not code:
return HttpResponse('The authentication is failed.')
feedly = get_feedly_client()
#response of access token
res_access_token = feedly.get_access_token(FEEDLY_REDIRECT_URI, code)
# user id
if 'errorCode' in res_access_token.keys():
return HttpResponse('The authentication is failed.')
id = res_access_token['id']
access_token=res_access_token['access_token']
def feed(access_token):
'''get user's subscription'''
feedly = get_feedly_client()
user_subscriptions = feedly.get_user_subscriptions(access_token)
json_data=open(expanduser('~')+'/.conky/scripts/.passwords.json')
data = json.load(json_data)
access_token=data['feedly']['access_token']
client = get_feedly_client(access_token)
categories = client.get_user_categories(access_token)
counts = client.get_unread_count(access_token)
text=""
count=0
for item in counts['unreadcounts']:
itemcount = item['count']
itemname = item['id'][51:]
if(itemcount > 0 and itemname not in ignored and "user/23bbb2c4-62b9-4bb9-a756-556cef1512f9/category/" in item['id']):
count = count + itemcount
text=text + "${color1}%s${alignr}${color white} %d" %(itemname, itemcount) +"\n"
print "${color1}Total unread: ${color white}%s ${alignr}${color1}Updated: ${color white}%s" %(count, time.strftime("%I:%M"))
print text
#call(['notify-send','Feedly Updated'])

View File

@@ -1,123 +0,0 @@
#!/usr/bin/env python
import requests
import json
class FeedlyClient(object):
def __init__(self, **options):
self.client_id = options.get('client_id')
self.client_secret = options.get('client_secret')
self.sandbox = options.get('sandbox', True)
if self.sandbox:
default_service_host = 'sandbox.feedly.com'
else:
default_service_host = 'cloud.feedly.com'
self.service_host = options.get('service_host', default_service_host)
self.additional_headers = options.get('additional_headers', {})
self.token = options.get('token')
self.secret = options.get('secret')
def get_code_url(self, callback_url):
scope = 'https://cloud.feedly.com/subscriptions'
response_type = 'code'
request_url = '%s?client_id=%s&redirect_uri=%s&scope=%s&response_type=%s' % (
self._get_endpoint('v3/auth/auth'),
self.client_id,
callback_url,
scope,
response_type
)
return request_url
def get_access_token(self,redirect_uri,code):
params = dict(
client_id=self.client_id,
client_secret=self.client_secret,
grant_type='authorization_code',
redirect_uri=redirect_uri,
code=code
)
quest_url=self._get_endpoint('v3/auth/token')
res = requests.post(url=quest_url, params=params)
return res.json()
def refresh_access_token(self,refresh_token):
'''obtain a new access token by sending a refresh token to the feedly Authorization server'''
params = dict(
refresh_token=refresh_token,
client_id=self.client_id,
client_secret=self.client_secret,
grant_type='refresh_token',
)
quest_url=self._get_endpoint('v3/auth/token')
res = requests.post(url=quest_url, params=params)
return res.json()
def get_user_subscriptions(self,access_token):
'''return list of user subscriptions'''
headers = {'Authorization': 'OAuth '+access_token}
quest_url=self._get_endpoint('v3/subscriptions')
res = requests.get(url=quest_url, headers=headers)
return res.json()
def get_user_categories(self,access_token):
'''return list of user subscriptions'''
headers = {'Authorization': 'OAuth '+access_token}
quest_url=self._get_endpoint('v3/categories')
res = requests.get(url=quest_url, headers=headers)
return res.json()
def get_unread_count(self,access_token):
'''return list of user subscriptions'''
headers = {'Authorization': 'OAuth '+access_token}
quest_url=self._get_endpoint('v3/markers/counts')
res = requests.get(url=quest_url, headers=headers)
return res.json()
def get_feed_content(self,access_token,streamId,unreadOnly,newerThan):
'''return contents of a feed'''
headers = {'Authorization': 'OAuth '+access_token}
quest_url=self._get_endpoint('v3/streams/contents')
params = dict(
streamId=streamId,
unreadOnly=unreadOnly,
newerThan=newerThan
)
res = requests.get(url=quest_url, params=params,headers=headers)
return res.json()
def mark_article_read(self, access_token, entryIds):
'''Mark one or multiple articles as read'''
headers = {'content-type': 'application/json',
'Authorization': 'OAuth ' + access_token
}
quest_url = self._get_endpoint('v3/markers')
params = dict(
action="markAsRead",
type="entries",
entryIds=entryIds,
)
res = requests.post(url=quest_url, data=json.dumps(params), headers=headers)
return res
def save_for_later(self, access_token, user_id, entryIds):
'''saved for later.entryIds is a list for entry id.'''
headers = {'content-type': 'application/json',
'Authorization': 'OAuth ' + access_token
}
request_url = self._get_endpoint('v3/tags') + '/user%2F' + user_id + '%2Ftag%2Fglobal.saved'
params = dict(
entryIds=entryIds
)
res = requests.put(url=request_url, data=json.dumps(params), headers=headers)
return res
def _get_endpoint(self, path=None):
url = "https://%s" % (self.service_host)
if path is not None:
url += "/%s" % path
return url

View File

@@ -1,42 +0,0 @@
#! /usr/bin/env python
import urllib2
import json
import zlib
import base64
from subprocess import call
from os.path import expanduser
import time
json_data=open(expanduser('~')+'/.conky/scripts/.passwords.json')
data = json.load(json_data)
username=data['github']['username']
password=data['github']['password']
#Put repos to publish
repos = data['github']['fav_repos']
request = urllib2.Request("https://api.github.com/users/" + username)
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
j = urllib2.urlopen(request)
json_data = j.read()
j_obj = json.loads(json_data)
print "${color1}Followers: ${color white}%d ${alignr}${color1}Updated: ${color white}%s" %(j_obj['followers'], time.strftime("%I:%M"))
for repo in repos:
repourl = "https://api.github.com/repos/"+ username +"/" + repo
request = urllib2.Request(repourl)
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
j = urllib2.urlopen(request)
json_data = j.read()
j_obj = json.loads(json_data)
print "${color white}%s ${goto 200}${color1}Starred: ${color white}%d ${color1}${alignr}Forks: ${color white}%d" %(j_obj['name'], j_obj['stargazers_count'], j_obj['forks_count'])

View File

@@ -1,70 +0,0 @@
#! /usr/bin/env python3
import urllib.request
import urllib # For BasicHTTPAuthentication
import feedparser # For parsing the feed
from textwrap import wrap # For pretty printing assistance
import json
from os.path import expanduser
import sys
import time
_URL = "https://mail.google.com/gmail/feed/atom/unread"
WRAP_LIMIT = 50
def auth():
json_data=open(expanduser('~')+'/.conky/scripts/.passwords.json')
data = json.load(json_data)
username=data['gmail']['username']
password=data['gmail']['password']
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='New mail feed',
uri='https://mail.google.com/',
user= username,
passwd= password)
opener = urllib.request.build_opener(auth_handler)
# ...and install it globally so it can be used with urlopen.
urllib.request.install_opener(opener)
'''The method to do HTTPBasicAuthentication'''
f = opener.open(_URL)
feed = f.read()
return feed
def fill(text, width):
'''A custom method to assist in pretty printing'''
if len(text) < width:
return text + ' '*(width-len(text))
else:
return text
def readmail(feed):
'''Parse the Atom feed and print a summary'''
atom = feedparser.parse(feed)
print ("${color white}You have %s new mails${color} ${alignr}Updated: ${color white}%s" % ((len(atom.entries)), time.strftime("%I:%M")))
for i in range(len(atom.entries)):
if(i>10):
break
if(len(atom.entries[i].title) > WRAP_LIMIT):
#print ("%s" % (fill(wrap(atom.entries[i].title, 50)[0]+" ...", 55)))
print ("${color1}%s" % (wrap(atom.entries[i].title, WRAP_LIMIT)[0]+" ..."))
else:
print ("${color1}%s" % (wrap(atom.entries[i].title, WRAP_LIMIT)[0]))
def countmail(feed):
'''Parse the Atom feed and print a summary'''
atom = feedparser.parse(feed)
print ("Emails: %s new" %len(atom.entries))
if __name__ == "__main__":
f = auth() # Do auth and then get the feed
if(len(sys.argv) > 1):
countmail(f)
else:
readmail(f) # Let the feed be chewed by feedparse

View File

@@ -1,26 +0,0 @@
#! /usr/bin/env python
import urllib2
import urllib
import json
from subprocess import call
from os.path import expanduser
import time
json_data=open(expanduser('~')+'/.conky/scripts/.passwords.json')
data = json.load(json_data)
key=data['pocket']['key']
access_token=data['pocket']['access_token']
data = {'consumer_key': key, 'access_token': access_token}
data = urllib.urlencode(data)
request = urllib2.Request("https://getpocket.com/v3/stats")
j = urllib2.urlopen(request, data)
json_data = j.read()
j_obj = json.loads(json_data)
print "${color1}Pocket Unread: ${alignr}${color white}%d" %(j_obj['count_unread'])

View File

@@ -1,31 +0,0 @@
#! /usr/bin/env python
import urllib2
import json
import zlib
from subprocess import call
import sys
import time
from os.path import expanduser
json_data=open(expanduser('~')+'/.conky/scripts/.passwords.json')
data = json.load(json_data)
userid=data['so']['userid']
so = 'https://api.stackexchange.com/2.2/users/'+userid+'?order=desc&sort=reputation&site=stackoverflow'
j = urllib2.urlopen(so)
json_data = j.read()
if j.info()['Content-Encoding'] == 'gzip':
json_data = zlib.decompress(json_data, zlib.MAX_WBITS + 16)
j_obj = json.loads(json_data)
if(len(sys.argv) > 1):
print "%s: %s" %("Reputation", j_obj['items'][0]['reputation'])
else:
print "${color}%s: ${alignr}${color white} %s" %("Stackoverflow Reputation", j_obj['items'][0]['reputation'])
print " ${color}%s: ${alignr}${color white} %s" %("Month", j_obj['items'][0]['reputation_change_month'])
print " ${color}%s: ${alignr}${color white} %s" %("Week", j_obj['items'][0]['reputation_change_week'])
print " ${color}%s: ${alignr}${color white} %s" %("Day", j_obj['items'][0]['reputation_change_day'])
#call(['notify-send','Conky Updated'])

View File

@@ -1,24 +0,0 @@
#! /usr/bin/env python
import urllib2
import json
import zlib
import base64
from subprocess import call
from os.path import expanduser
json_data=open(expanduser('~')+'/.conky/scripts/.passwords.json')
data = json.load(json_data)
access_token=data['twitter']['access_token']
user = data['twitter']['user']
request = urllib2.Request("https://api.twitter.com/1.1/users/show.json?screen_name=" + user)
bearer_value = 'Bearer %s' % access_token
request.add_header("Authorization", bearer_value)
j = urllib2.urlopen(request)
json_data = j.read()
j_obj = json.loads(json_data)
print "${color1}Twitter Followers: ${alignr}${color white}%d" %(j_obj['followers_count'])

View File

@@ -1,53 +0,0 @@
conky.config = {
use_spacer='none',
use_xft=true,
font='Open Sans Light:size=11',
text_buffer_size=2048,
update_interval=3600.0,
total_run_times=0,
own_window=true,
own_window_transparent=true,
own_window_type='normal',
own_window_hints='undecorated,skip_taskbar,skip_pager',
own_window_class='Conky-weather',
own_window_argb_visual=true,
own_window_argb_value=0,
draw_shades=false,
draw_outline=false,
draw_borders=false,
stippled_borders=0,
double_buffer=true,
draw_blended=false,
default_color='white',
default_shade_color='black',
--Minimum size of text area
maximum_width=1200 ,
alignment=bottom_right,
gap_x=20,
gap_y=20,
border_inner_margin=15,
border_outer_margin=0,
no_buffers=true,
net_avg_samples=2,
override_utf8_locale=true,
use_spacer=none,
short_units=on,
default_color=white,
color1 = 'ffffff',
color7 = '333333'
-- default_outline_color='black',--'00ccee',
-- lua_load = '~/.conky/arch/lua.lua'
};
conky.text = [[
${execp ~/.conky/weather/weather.py 890869}
]];

View File

@@ -1,53 +0,0 @@
conky.config = {
use_spacer='none',
use_xft=true,
font='Open Sans Light:size=11',
text_buffer_size=2048,
update_interval=3600.0,
total_run_times=0,
own_window=true,
own_window_transparent=true,
own_window_type='normal',
own_window_hints='undecorated,skip_taskbar,skip_pager',
own_window_class='Conky-weather',
own_window_argb_visual=true,
own_window_argb_value=0,
draw_shades=false,
draw_outline=false,
draw_borders=false,
stippled_borders=0,
double_buffer=true,
draw_blended=false,
default_color='white',
default_shade_color='black',
--Minimum size of text area
maximum_width=1200 ,
alignment=bottom_right,
gap_x=20,
gap_y=20,
border_inner_margin=15,
border_outer_margin=0,
no_buffers=true,
net_avg_samples=2,
override_utf8_locale=true,
use_spacer=none,
short_units=on,
default_color=white,
color1 = 'ffffff',
color7 = '333333'
-- default_outline_color='black',--'00ccee',
-- lua_load = '~/.conky/arch/lua.lua'
};
conky.text = [[
${execp ~/.conky/weather/weather.py 909319}
]];

View File

@@ -1 +0,0 @@
{"timestamp": "1546242922", "location": {"city": "Gothenburg", "country": "Sweden", "region": " Vastra Gotaland"}, "wind": {"chill": "25", "direction": "165", "speed": "27.36"}, "atmosphere": {"humidity": "93", "pressure": "34473.45", "rising": "0", "visibility": "20.28"}, "astronomy": {"sunrise": "8:56 am", "sunset": "3:36 pm"}, "lat": "57.701328", "long": "11.96689", "condition": {"code": "26", "date": "Mon, 31 Dec 2018 08:00 AM CET", "temp": "0", "text": "Cloudy"}, "forecast": [{"code": "26", "date": "31 Dec 2018", "day": "Mon", "high": "7", "low": "-1", "text": "Cloudy"}, {"code": "24", "date": "01 Jan 2019", "day": "Tue", "high": "7", "low": "3", "text": "Windy"}, {"code": "32", "date": "02 Jan 2019", "day": "Wed", "high": "2", "low": "0", "text": "Sunny"}, {"code": "30", "date": "03 Jan 2019", "day": "Thu", "high": "1", "low": "-2", "text": "Partly Cloudy"}, {"code": "28", "date": "04 Jan 2019", "day": "Fri", "high": "6", "low": "0", "text": "Mostly Cloudy"}, {"code": "30", "date": "05 Jan 2019", "day": "Sat", "high": "4", "low": "0", "text": "Partly Cloudy"}, {"code": "28", "date": "06 Jan 2019", "day": "Sun", "high": "5", "low": "0", "text": "Mostly Cloudy"}, {"code": "30", "date": "07 Jan 2019", "day": "Mon", "high": "5", "low": "2", "text": "Partly Cloudy"}, {"code": "30", "date": "08 Jan 2019", "day": "Tue", "high": "3", "low": "0", "text": "Partly Cloudy"}, {"code": "30", "date": "09 Jan 2019", "day": "Wed", "high": "3", "low": "0", "text": "Partly Cloudy"}]}

View File

@@ -1 +0,0 @@
{"timestamp": "1546242922", "location": {"city": "Vasteras", "country": "Sweden", "region": " Vastmanland"}, "wind": {"chill": "19", "direction": "190", "speed": "16.09"}, "atmosphere": {"humidity": "100", "pressure": "34541.18", "rising": "0", "visibility": "7.24"}, "astronomy": {"sunrise": "8:53 am", "sunset": "3:2 pm"}, "lat": "59.61998", "long": "16.53591", "condition": {"code": "26", "date": "Mon, 31 Dec 2018 08:00 AM CET", "temp": "-3", "text": "Cloudy"}, "forecast": [{"code": "28", "date": "31 Dec 2018", "day": "Mon", "high": "4", "low": "-3", "text": "Mostly Cloudy"}, {"code": "28", "date": "01 Jan 2019", "day": "Tue", "high": "6", "low": "0", "text": "Mostly Cloudy"}, {"code": "23", "date": "02 Jan 2019", "day": "Wed", "high": "0", "low": "-3", "text": "Breezy"}, {"code": "30", "date": "03 Jan 2019", "day": "Thu", "high": "-2", "low": "-5", "text": "Partly Cloudy"}, {"code": "28", "date": "04 Jan 2019", "day": "Fri", "high": "2", "low": "-3", "text": "Mostly Cloudy"}, {"code": "30", "date": "05 Jan 2019", "day": "Sat", "high": "3", "low": "-1", "text": "Partly Cloudy"}, {"code": "28", "date": "06 Jan 2019", "day": "Sun", "high": "1", "low": "-1", "text": "Mostly Cloudy"}, {"code": "28", "date": "07 Jan 2019", "day": "Mon", "high": "1", "low": "0", "text": "Mostly Cloudy"}, {"code": "30", "date": "08 Jan 2019", "day": "Tue", "high": "0", "low": "-3", "text": "Partly Cloudy"}, {"code": "30", "date": "09 Jan 2019", "day": "Wed", "high": "-1", "low": "-3", "text": "Partly Cloudy"}]}

View File

@@ -1,84 +0,0 @@
#! /usr/bin/env python3
import urllib
import json
#from subprocess import call
import sys
import time
import os.path
import urllib.parse
import urllib.request
#import time
woeid=sys.argv[1]
path="/home/kuba/.conky/weather/last-"+woeid+".json"
#Try to download new data; overwrite existing file
def fetch_data():
base_url = "https://query.yahooapis.com/v1/public/yql"
sel_url = "?q=select%20location,wind,atmosphere,astronomy,item%20from%20weather.forecast"
where_url = "%20where%20u='c'%20and%20woeid%20=%20" + woeid
format_url = "&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"
yql_url = base_url + sel_url + where_url + format_url
try:
result = urllib.request.urlopen(yql_url).read()
data = json.loads(result)
ch = data['query']['results']['channel']
timestamp = str(round(time.time()))
parsed_data = {}#Don't save everything
parsed_data['timestamp'] = timestamp
for s in ['location', 'wind', 'atmosphere', 'astronomy']:
parsed_data.update({s : ch[s]})
for s in ['lat','long','condition','forecast']:
parsed_data.update({s : ch['item'][s]})
with open(path, 'w') as outfile:
json.dump(parsed_data, outfile)
except urllib.error.URLError:
pass
return
def print_output(data):
timestamp = int(data['timestamp'])
city = data['location']['city']
country = data['location']['country']
current_condition = data['condition']['text']
current_code = data['condition']['code']
current_temp = data['condition']['temp']
#weather_date = data['condition']['date']
speed_unit = "km/h"
speed = data['wind']['speed']
humidity = data['atmosphere']['humidity']
forecast = []
for forec in data['forecast']:
forecast.append((forec['day'], forec['low'], forec['high'] , forec['code']))
print ("${font Open Sans:size=15:style=Light}%s, %s " % (city, country), end = '')
print ("${font :size=6}${alignr}${color7}Updated: ${color white}%s ${color7}Fetched: ${color white}%s" % (time.strftime("%I:%M"), time.strftime("%m/%d %H:%M", time.gmtime(timestamp))))
print ("${color7}${hr}${color}")
print ("${voffset -5}${font Open Sans:size=60:style=Light}%s°${font}" %(current_temp))
print ("${offset 250}${voffset -65}%s" %(current_condition))
print ("${image ~/.conky/.conky-google-now/%s.png -p 180,45 -s 60x60}" %(current_code))
print ("${image ~/.conky/.conky-google-now/wind.png -p 245,62 -s 15x15}${goto 35}${offset 250}${voffset -12}%s %s" %(speed, speed_unit), end = '')
print ("${goto 400}%s ${goto 530} %s" %(forecast[0][0].upper(), forecast[1][0].upper()))
print ("${image ~/.conky/.conky-google-now/humidity.png -p 245,81 -s 15x15}${goto 35}${offset 250}%s %s" %(humidity,"%"), end = '')
print ("${goto 400}%s°${color6}%s°${color}${goto 530}%s°${color6}%s°${color}${voffset 15}" %(forecast[0][2], forecast[0][1], forecast[1][2], forecast[1][1]))
print ("${image ~/.conky/.conky-google-now/%s.png -p 440,65 -s 30x30}${image ~/.conky/.conky-google-now/%s.png -p 570,65 -s 30x30}${voffset -10}" %(forecast[0][3], forecast[1][3]))
return
#Open existing file and check if it's not too old
if not (os.path.isfile(path)):
fetch_data()
with open(path) as infile:
data = json.load(infile)
ts = int(data['timestamp'])
now = round(time.time())
if (ts + 3600 < now):
fetch_data()
ts = now
print_output(data)

View File

@@ -7,8 +7,11 @@
process = git-lfs filter-process process = git-lfs filter-process
required = true required = true
[credential] [credential]
helper = cache --timeout=3600 helper = libsecret
[color] [color]
ui = auto ui = auto
[pull] [pull]
ff = only ff = only
[init]
deafaultBranch = main
defaultBranch = main

12
.gitmodules vendored
View File

@@ -1,6 +1,6 @@
[submodule ".i3/lemonbar"] [submodule "scripts/healthy-disk-usage"]
path = .i3/lemonbar path = scripts/healthy-disk-usage
url = https://isabeljake.duckdns.org/gitea/kuba/lemonbar.git url = https://isabeljake.duckdns.org/gitea/kuba/healthy-disk-usage.git
[submodule "Pictures/Wallpapers"] [submodule ".i3"]
path = Pictures/Wallpapers path = .i3
url = https://isabeljake.duckdns.org/gitea/kuba/wallpapers.git url = https://isabeljake.duckdns.org/gitea/kuba/i3-config.git

1
.i3 Submodule

Submodule .i3 added at 6f3a75a596

View File

@@ -1,13 +0,0 @@
sleep 2
nextcloud &
volnoti &
conky -c ~/.conky/arch/.conkyrc-arch &
conky -c ~/.conky/gmail/.conkyrc-gmail &
conky -c ~/.conky/weather/.conkyrc-weather1 &
conky -c ~/.conky/weather/.conkyrc-weather2 &
conky -c ~/.conky/music/.conkyrc-music &
python ~/.conky/music/playerctl_listen.py &
sh ~/.conky/music/launcher.sh &
source ~/.python-venv.kuba/bin/activate
python ~/.i3/lemonbar/i3_lemonbar_launcher.py --debug >> /tmp/kuba_lemonbar_launcher.log &
compton -b # --config=/home/kuba/.compton.conf

View File

@@ -1,158 +0,0 @@
# General setup
####
set $mod Mod4
set $TERMINAL terminator --profile=nord
font pango:FontAwesome 11
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
focus_follows_mouse no
mouse_warping none
workspace_auto_back_and_forth yes
#force_display_urgency_hint 500 ms
#
#
# Key bindings
####
# start a terminal
bindsym $mod+Return exec $TERMINAL
# kill focused window
bindsym $mod+Shift+q kill
# start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run
bindsym $mod+Shift+d exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# alternatively, you can use the cursor keys:
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# alternatively, you can use the cursor keys:
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+g split h
# split in vertical orientation
bindsym $mod+v split v
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+Shift+Return focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
#bindsym $mod+d focus child
# switch to workspace
bindsym $mod+1 workspace number $w1
bindsym $mod+2 workspace number $w2
bindsym $mod+3 workspace number $w3
bindsym $mod+4 workspace number $w4
bindsym $mod+5 workspace number $w5
bindsym $mod+6 workspace number $w6
bindsym $mod+7 workspace number $w7
bindsym $mod+8 workspace number $w8
bindsym $mod+9 workspace number $w9
bindsym $mod+0 workspace number $w10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number $w1
bindsym $mod+Shift+2 move container to workspace number $w2
bindsym $mod+Shift+3 move container to workspace number $w3
bindsym $mod+Shift+4 move container to workspace number $w4
bindsym $mod+Shift+5 move container to workspace number $w5
bindsym $mod+Shift+6 move container to workspace number $w6
bindsym $mod+Shift+7 move container to workspace number $w7
bindsym $mod+Shift+8 move container to workspace number $w8
bindsym $mod+Shift+9 move container to workspace number $w9
bindsym $mod+Shift+0 move container to workspace number $w10
bindsym $mod+o move workspace to output right
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit i3 (logs you out of your X session)
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"
#
#
# Define modes
####
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" {
bindsym l exec --no-startup-id .i3/i3exit.sh lock, mode "default"
bindsym e exec --no-startup-id .i3/i3exit.sh logout, mode "default"
bindsym s exec --no-startup-id .i3/i3exit.sh suspend, mode "default"
bindsym h exec --no-startup-id .i3/i3exit.sh hibernate, mode "default"
bindsym r exec --no-startup-id .i3/i3exit.sh reboot, mode "default"
bindsym Shift+s exec --no-startup-id .i3/i3exit.sh shutdown, mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"; exec sh .i3/lemonbar/set_mode.sh mode normal
bindsym Escape mode "default"; exec sh .i3/lemonbar/set_mode.sh mode normal
}
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym h resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym j resize shrink height 10 px or 10 ppt
bindsym l resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Up resize grow height 10 px or 10 ppt
bindsym Down resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"

View File

@@ -1,114 +0,0 @@
set $w1 1 main
set $w2 2 web
set $w3 3 mu
set $w4 4 work
set $w5 5 terms
set $w6 6 stats
set $w7 7
set $w8 8
set $w9 9
set $w10 10 games
set $below_barY 24
#set $volX 1400
#set $brX 1485
#set $calX 1650
set $htopX 400
set $pavuX 800
for_window [class="Terminator"] border pixel 0
for_window [class="YADWIN"] floating enable
for_window [class="FLOAT_PAVU"] floating enable
for_window [class="FLOAT_PAVU"] resize set 800 540
for_window [class="FLOAT_PAVU"] border pixel 3
for_window [class="FLOAT_PAVU"] move absolute position $pavuX px $below_barY px
for_window [class="FLOAT_TERM"] floating enable
for_window [class="FLOAT_TERM"] move absolute position $htopX px $below_barY px
for_window [class="FLOAT_TERM"] border pixel 3
for_window [title="Memory"] floating enable
for_window [class="Matplotlib"] floating enable
for_window [class="Chromium"] border pixel 0
for_window [class="^.*"] border pixel 0
for_window [window_type="toolbar"] border pixel 3
for_window [window_type="splash"] border pixel 3
for_window [window_type="dialog"] border pixel 3
for_window [window_type="utility"] border pixel 3
for_window [window_role="pop-up"] floating enable
for_window [title="VMD 1.9.3 OpenGL Display"] floating enable
for_window [title="Terminator Preferences"] floating enable
for_window [title="Figure *"] floating enable
#for_window [title="VMD"] floating enable
assign [class="firefox"] → $w2
assign [class="Chromium"] → $w2
assign [class="libreoffice*"] → $w4
assign [class="soffice*"] → $w4
assign [class="MATLAB*"] → $w4
assign [window_role="ranger"] → $w1
assign [window_role="terms"] → $w5
assign [window_role="stats"] → $w6
assign [class="Minecraft*"] → $w10
assign [title="Feed The Beast Launcher*"] → $w10
#Spotify bug, assign doesn't work
for_window [class="Spotify"] move to workspace $w3
# Gaps settings
####
gaps inner 0
gaps outer 0
workspace 1 gaps inner 10
workspace 4 gaps inner 10
workspace 5 gaps inner 10
workspace 6 gaps inner 60
# Multimedia Bindings
####
# pulse audio volume control
bindsym XF86AudioRaiseVolume exec ~/.i3/scripts/level.sh -v up
bindsym XF86AudioLowerVolume exec ~/.i3/scripts/level.sh -v down
bindsym XF86AudioMute exec ~/.i3/scripts/level.sh -v toggle
bindsym XF86MonBrightnessUp exec ~/.i3/scripts/level.sh -b up
bindsym XF86MonBrightnessDown exec ~/.i3/scripts/level.sh -b down
bindsym $mod+F8 exec playerctl play-pause
bindsym $mod+F9 exec playerctl next
bindsym $mod+F7 exec playerctl previous
bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrevious exec playerctl previous
bindsym Print exec scrot '%Y-%m-%d-%T_$wx$h_scrot.png' -e 'mv $f ~/Pictures/screenshots/'
bindsym Shift + Print exec scrot -s '%Y-%m-%d-%T_$wx$h_scrot.png' -e 'mv $f ~/Pictures/screenshots/'
bindsym $mod+space exec sh ~/.i3/scripts/lang.sh next
# Exiting
####
bindsym XF86Sleep exec sh ~/.i3/i3exit.sh lock
bindsym XF86PowerOff mode "$mode_system"; exec sh .i3/lemonbar/set_mode.sh mode power
####
# layout settings
####
bindsym $mod+u exec feh --bg-scale /home/kuba/Pictures/Wallpapers/AxEcN\ -\ Imgur.jpg
#exec compton -b
#workspace 1 main
exec --no-startup-id $TERMINAL --role "ranger" -x ranger
#exec --no-startup-id i3-msg 'workspace 5 terms"
exec --no-startup-id $TERMINAL --role "terms"
exec --no-startup-id $TERMINAL --role "terms"
#workspace 6 stats;
exec --no-startup-id i3-msg 'append_layout /home/kuba/.i3/workspace_6.json; rename workspace to "6 stats"'
#Set appropriate background image before starting conkys
exec --no-startup-id feh --bg-scale /home/kuba/Pictures/Wallpapers/6_stats
#Start conky's in .i3/.autostart
exec sh ~/.i3/.autostart

View File

@@ -1,46 +0,0 @@
#!/bin/sh
lock() {
# Credit: https://github.com/petvas/i3lock-blur
# TODO Handle several screens
TMPBG=/tmp/screen_locked.png
LOCK=~/.i3/lock.png
RES=$(xrandr | grep 'current' | sed -E 's/.*current\s([0-9]+)\sx\s([0-9]+).*/\1x\2/')
#ffmpeg -f x11grab -video_size $RES -y -i $DISPLAY -i $LOCK -filter_complex \
# "boxblur=5:1,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" \
# -vframes 1 $TMPBG -loglevel quiet
ffmpeg -f x11grab -video_size $RES -y -i $DISPLAY -filter_complex \
"boxblur=5:1" -vframes 1 $TMPBG -loglevel quiet
i3lock -i $TMPBG
rm $TMPBG
}
case "$1" in
lock)
lock
;;
logout)
i3-msg exit
;;
suspend)
lock && sudo pm-suspend
;;
lidclose)
lock && sudo pm-suspend
;;
hibernate)
lock && sudo pm-hibernate
;;
reboot)
systemctl reboot
;;
shutdown)
systemctl poweroff
;;
*)
echo "Usage: $0 {lock|logout|suspend|hibernate|reboot|shutdown}"
exit 2
esac
exit 0

Submodule .i3/lemonbar deleted from c03598c5b2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,32 +0,0 @@
#!/bin/bash
# Launches a yad window to change the brightness (or volume, not in use)
panel_fifo="/tmp/i3_lemonbar1_${USER}"
panel_commands="/tmp/i3_lemonbar2_${USER}"
if [ "$1" == "-b" ]; then
CLASS="YADWINBR"
ICON='☼'
COLOR='yellow'
elif [ "$1" == "-v" ]; then
CLASS="YADWINV"
ICON='🔈'
COLOR='white'
else
exit 1
fi
LEVEL=$(bc <<< "scale=0; $(brillo -G)/1")
[[ "$3" == "-t" ]] && TIMER="--timeout=1"
declare -a YADARGS=("--sticky" "--undecorated" "--on-top" "--class=$CLASS"
"--scale" "--text='<span color=\"$COLOR\" font=\"20\">$ICON</span>'"
"--value" "$LEVEL" "--no-buttons"
"--geometry=15x150" "--vertical" "--text-align" "center" "$TIMER" "--print-partial")
YARGS=${YADARGS[@]}
FIFO="$2"
(echo "kill_unfocus $BASHPID" > $FIFO; exec sh -c "yad $YARGS") | \
while read out; do
~/.i3/scripts/level.sh -b set $out
done

View File

@@ -1,9 +0,0 @@
#!/bin/sh
STATUS=`xset q | awk '{for (I=1;I<=NF;I++) if ($I == "DPMS" && $(I+1) == "is") {print $(I+2)};}'`
if [ "$STATUS" == "Enabled" ]; then
xset -dpms
yad --timeout 1 --text "<span font=\"20\">DPMS Disabled</span>" --no-buttons --sticky --on-top
else
xset dpms
yad --timeout 1 --text "<span font=\"20\">DPMS Enabled</span>" --no-buttons --sticky --on-top
fi

View File

@@ -1,34 +0,0 @@
#!/bin/bash
panel_fifo="/tmp/i3_lemonbar1_${USER}"
panel_commands="/tmp/i3_lemonbar2_${USER}"
function show(){
setxkbmap -print | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}'
}
if [ $# -lt 1 ]; then
echo LANG$(show)
fi
if [ "$1" == "next" ]; then
cur=$(show)
next='se'
if [ "$cur" == "se" ]; then
next='pl'
fi
setxkbmap $next
if [ -e $panel_fifo ]; then
echo -e "LANG$next" > "${panel_fifo}"
fi
if [ -e $panel_commands ]; then
echo -e "setlang $next" > "${panel_commands}"
fi
elif [ "$1" == "qset" ]; then
next=$2
setxkbmap $next
if [ -e $panel_fifo ]; then
echo -e "LANG$next" > "${panel_fifo}"
fi
elif [ "$1" == "show" ]; then
show
else
exit 1
fi

View File

@@ -1,33 +0,0 @@
#!/bin/bash
panel_fifo="/tmp/i3_lemonbar1_${USER}"
panel_commands="/tmp/i3_lemonbar2_${USER}"
if [[ "$1" == "-b" ]]; then
icon="-s /usr/share/pixmaps/volnoti/display-brightness-symbolic.svg"
if [[ "$2" == "up" ]]; then
level=$(brillo -A 5 -u 100000; brillo)
elif [[ "$2" == "down" ]]; then
level=$(brillo -U 5 -u 100000; brillo)
elif [[ "$2" == "set" ]]; then
level=$(brillo -S $3; brillo)
fi
echo "BRIGHT$level" > $panel_fifo
elif [[ "$1" == "-v" ]]; then
if [[ "$2" == "up" ]]; then
amixer -q set Master 5%+
elif [[ "$2" == "down" ]]; then
amixer -q set Master 5%-
elif [[ "$2" == "toggle" ]]; then
amixer -q set Master toggle
fi
level=$(~/.i3/lemonbar/get_vol.sh)
if [[ "$level" == "MUTE" ]]; then
level="-m"
elif [[ "$level" == "NONE" ]]; then
echo "Missing"
fi
fi
if [[ "$2" != "set" ]]; then
volnoti-show $icon $level
fi

View File

@@ -1,9 +0,0 @@
#!/bin/bash
[[ "$1" == "up" ]] && amixer set Master 5%+
[[ "$1" == "down" ]] && amixer set Master 5%-
[[ "$1" == "mute" ]] && amixer sset Master toggle
VOL=$(amixer get Master | grep 'Front Left:' | cut -c 31-33)
[[ $(amixer get Master | grep "\[off\]") ]] && sudo -u kuba volnoti-show -m $VOL && exit
sudo -u kuba volnoti-show $VOL

View File

@@ -1,127 +0,0 @@
{
"layout": "splith",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.65,
"type": "con",
"nodes": [
{
"border": "normal",
"floating": "auto_off",
"layout": "splith",
"percent": 0.5,
"type": "con",
"nodes": [
{
"border": "none",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 10,
"width": 10,
"x": 0,
"y": 0
},
"name": "Conky (kuba-Arch)",
"percent": 1,
"swallows": [
{
"class": "Conky-arch"
}
],
"type": "con"
}
]
},
{
"border": "none",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 434,
"width": 722,
"x": 0,
"y": 0
},
"name": "Conky (kuba-Arch)",
"percent": 0.5,
"swallows": [
{
"class": "Conky-gmail"
}
],
"type": "con"
}
]
},
{
"border": "normal",
"floating": "auto_off",
"layout": "splitv",
"percent": 0.35,
"type": "con",
"nodes": [
{
"border": "none",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 32,
"width": 32,
"x": 0,
"y": 0
},
"name": "Conky (kuba-Arch)",
"percent": 0.20,
"swallows": [
{
"class": "Conky-weather"
}
],
"type": "con"
},
{
"border": "none",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 32,
"width": 32,
"x": 0,
"y": 0
},
"name": "Conky (kuba-Arch)",
"percent": 0.20,
"swallows": [
{
"class": "Conky-weather"
}
],
"type": "con"
},
{
"border": "none",
"current_border_width": 2,
"floating": "auto_off",
"geometry": {
"height": 10,
"width": 10,
"x": 0,
"y": 0
},
"name": "Conky (kuba-Arch)",
"percent": 0.60,
"swallows": [
{
"class": "Conky-music"
}
],
"type": "con"
}
]
}
]
}

View File

@@ -5,18 +5,18 @@
i3config="/tmp/i3_${USER}_config" i3config="/tmp/i3_${USER}_config"
rm -f $i3config rm -f $i3config
if [ -f ~/.i3/base.config ]; then if [ -f "$HOME/.i3/base.config" ]; then
cat ~/.i3/base.config >> $i3config cat "$HOME/.i3/base.config" >> $i3config
fi fi
if [ "`hostname`" = "kubaArch-Laptop" ] && [ -f ~/.i3/home.config ]; then if [ "`hostname`" = "kubaArch-Laptop" ] && [ -f "$HOME/.i3/home.config" ]; then
cat ~/.i3/home.config >> $i3config cat "$HOME/.i3/home.config" >> $i3config
elif [ "`hostname`" = "kubaDesktop" ] && [ -f ~/.i3/home.config ]; then elif [ "`hostname`" = "kubaDesktop" ] && [ -f "$HOME/.i3/home.config" ]; then
cat ~/.i3/home.config >> $i3config cat "$HOME/.i3/home.config" >> $i3config
elif [ "`hostname`" = "JakubArch" ] && [ -f ~/.i3/work.config ]; then elif [ "`hostname`" = "JakubArch" ] && [ -f "$HOME/.i3/work.config" ]; then
cat ~/.i3/work.config >> $i3config cat "$HOME/.i3/work.config" >> $i3config
fi fi
#exec i3 -c $i3config -V >> ~/${WM}.log 2>&1 #exec i3 -c $i3config -V >> ~/${WM}.log 2>&1
sh ~/scripts/displays.sh auto sh "$HOME/.i3/scripts/displays.sh" auto
exec i3 -c $i3config exec i3 -c $i3config

View File

@@ -0,0 +1,33 @@
qnode() {
[ $# -lt 1 ] && echo "Usage qnode JOBID" && return 0
squeue --noheader --jobs $1 -o %R
}
qssh() {
[ $# -lt 1 ] && echo "Usage qssh JOBID" && return 0
ssh $(qnode $1)
}
taillog() { [ $# -lt 1 ] && echo "Usage taillog LOGFILE [JOBIDs ..]" && return 0
if [ $# -lt 2 ] ; then
tail "$1"
else
tail "$1" "$1.$2"{.e,.o}
fi
}
catlog() { [ $# -lt 1 ] && echo "Usage catlog LOGFILE [JOBIDs ..]" && return 0
if [ $# -lt 2 ] ; then
cat "$1" | less
else
cat "$1" "$1.$2"{.e,.o} | less
fi
}
watchlog() { [ $# -lt 2 ] && echo "Usage watchlog INTERVAL LOGFILE [JOBIDs ..]" && return 0;
if [ $# -lt 3 ] ; then
watch -n $1 tail "$2"
else
watch -n $1 tail "$2" "$2.$3"{.e,.o}
fi
}

131
.modules.kuba/.tools.sh Normal file
View File

@@ -0,0 +1,131 @@
# Inspect .npz files
npz_py_str="$(cat << EOM
from sys import argv
import numpy as np
try:
import matplotlib.pyplot as plt
print('Imported matplotlib.pyplot as plt')
except ImportError:
pass
class Wrap:
def __init__(self, fname):
n = np.load(fname, allow_pickle=True)
globs = globals()
if isinstance(n, np.lib.npyio.NpzFile):
files = n.files
print('Contains files', files)
for f in files:
setattr(self, f, n[f])
globs[f] = n[f]
else:
print('Loaded data of shape', n.shape)
setattr(self, 'data', n)
globs['data'] = n
argv = argv[argv.index('--')+1:]
archives = [Wrap(arg) for arg in argv]
archive = archives[-1]
print('Global namespace populated with "archive", "archives" and all files')
for i, fname in enumerate(argv):
print(f' {i:<3.0f}: {fname}')
EOM
)"
npz_preview() {
if [ $# -lt 1 ]; then
echo "Please specify file to open as argument"
return
fi
python -ic "$npz_py_str" -- "$@"
}
npz_previewi() {
if [ $# -lt 1 ]; then
echo "Please specify file to open as argument"
return
fi
ipython -i -c "$npz_py_str" -- "$@"
}
rsync_wrap() {
cmd="rsync -a -R -r --copy-links --exclude .git --exclude __pycache__ --progress"
if [ $# == 0 ]; then
echo "Usage rsync_wrap [...]
Useful for synchronizing repositories
Calls $cmd [...]"
return
fi
$cmd $@
}
rsync_wrap_huge() {
cmd="rsync -a -R -r --copy-links --size-only --exclude .git --exclude __pycache__ --progress"
if [ $# == 0 ]; then
echo "Usage rsync_wrap_huge [...]
Useful for synchronizing repositories. Does not do checksum
Calls $cmd [...]"
return
fi
$cmd $@
}
if command -v xclip &> /dev/null; then
alias selc="xclip -sel primary -i"
alias selv="xclip -sel primary -o"
alias clipc="xclip -sel clip -i"
alias clipv="xclip -sel clip -o"
fi
watch_modify() {
if [ $# -lt 2 ]; then
echo "Usage watch_modify FILE CMD ARGS...
Run CMD ARGS... when file FILE is updated
"
return
fi
file="$1"
base="$(basename "$file")"
dir="$(dirname "$file")"
inotifywait -r -m -e modify "$dir" | while read file_path file_event file_name; do
[ "$base" == "$file_name" ] && echo ${@:2} && ${@:2}
done
}
pdftoclipboard() {
if [ $# -lt 1 ]; then
echo "Usage pdftoclipboard FILE [DPI]
Convert pdf file FILE to png and copy to clipboard. Default DPI is 600
"
return
fi
file="$1"
dpi="${2:-600}"
pdftoppm -png -r "$dpi" "$file" | xclip -sel clip -t image/png -i
}
gitgrepsed() {
if [ $# -lt 2 ]; then
echo "Usage gitgrepsed SEARCH REPLACE
Search and replace in git repository.
Alias for git grep -l \$SEARCH | xargs sed -i "s/\$SEARCH/\$REPLACE/g"
"
return
fi
search="$1"
replace="$2"
git grep -l "$search" | xargs sed -i "s/$search/$replace/g"
}

View File

@@ -1,27 +0,0 @@
whatis("Ase")
conflict("ASE")
function ld (m)
if not ( isloaded(m) ) then
load(m)
end
end
ld("iccifort/2019.5.281")
ld("impi/2018.5.288")
ld("imkl/2019.5.281")
ld("Python/3.7.4")
ld("Tkinter/3.7.4")
ld("matplotlib/3.1.1-Python-3.7.4")
ld("clusterappl") -- Sets up MYNOBACKUP
local nobackup = os.getenv("MYNOBACKUP")
local root = pathJoin(nobackup, "git/ase/dev")
prepend_path("PYTHONPATH", root)
prepend_path("PATH", pathJoin(root, "tools"))
prepend_path("PATH", pathJoin(root, "bin"))
execute {cmd='complete -o default -C "/usr/bin/python3 ' .. root .. '/ase/cli/complete.py" ase', modeA={"load"}}

View File

@@ -1,25 +0,0 @@
whatis([==[
Creates $USERAPPL environment variable and adds paths
]==])
local pyver = subprocess([[python --version 2>&1 | sed 's/.*\([23]\.[0-9]\).*/\1/']])
if pyver:sub(1, 1) == "2" then
LmodError("Must have Python 3 loaded")
end
local home = os.getenv("HOME")
local nobackup = pathJoin(home, "nobackup")
local userappl = pathJoin(nobackup, "appl")
local git = pathJoin(nobackup, "git")
local pythonp = pathJoin(userappl, "lib", "python" .. pyver, "site-packages")
local binp = pathJoin(userappl, "bin")
local libp = pathJoin(userappl, "lib")
setenv("MYNOBACKUP", nobackup)
setenv("USERAPPL", userappl)
prepend_path("PYTHONPATH", pythonp)
prepend_path("PYTHONPATH", ".")
prepend_path("PATH", binp)
prepend_path("LD_LIBRARY_PATH", libp)
execute {cmd='`snakemake --bash-completion`', modeA={"load"}}

View File

@@ -1,7 +0,0 @@
local name = myModuleName()
local version = myModuleVersion()
local home = os.getenv("HOME")
local setups_root = pathJoin(home, "gpaw-setups", version)
prepend_path("GPAW_SETUP_PATH", pathJoin(setups_root, "gpaw-setups-" .. version))
prepend_path("GPAW_SETUP_PATH", pathJoin(setups_root, "gpaw-basis-pvalence-" .. version))

View File

@@ -1,26 +0,0 @@
whatis([==[My compiled version of GPAW]==])
unload("GPAW")
function ld (m)
if not ( isloaded(m) ) then
load(m)
end
end
ld("clusterappl")
local nobackup = os.getenv("MYNOBACKUP")
local root = pathJoin(nobackup, "git/gpaw/20.1.0")
ld("Python/3.6.7-env-nsc1-gcc-2018a-eb")
-- ld("Python/3.6.3-anaconda-5.0.1-nsc1")
ld("ASE/3.18.0-nsc1")
ld("gpaw-setups/0.9.20000")
setenv("OMP_NUM_THREADS", 1)
prepend_path("PATH", pathJoin(root, "tools"))
prepend_path("PYTHONPATH", root)
prepend_path("PYTHONPATH", pathJoin(root, "build/lib.linux-x86_64-3.7"))
execute {cmd='complete -o default -C "/usr/bin/python3 ' .. root .. '/gpaw/cli/complete.py" gpaw', modeA={"load"}}

View File

@@ -1 +0,0 @@
dev.lua

View File

@@ -1,23 +0,0 @@
whatis([==[My compiled version of GPAW]==])
unload("GPAW")
function ld (m)
if not ( isloaded(m) ) then
load(m)
end
end
ld("ase/dev")
ld("libxc/4.3.4")
ld("gpaw-setups/0.9.20000")
local _, version = splitFileName(myModuleVersion())
local nobackup = os.getenv("MYNOBACKUP")
local root = pathJoin(nobackup, "git/gpaw", version)
setenv("OMP_NUM_THREADS", 1)
prepend_path("PATH", pathJoin(root, "tools"))
prepend_path("PYTHONPATH", root)
prepend_path("PYTHONPATH", pathJoin(root, "build/lib.linux-x86_64-3.7"))
execute {cmd='complete -o default -C "/usr/bin/python3 ' .. root .. '/gpaw/cli/complete.py" gpaw', modeA={"load"}}

View File

@@ -1 +0,0 @@
dev.lua

View File

@@ -1,15 +0,0 @@
local name, version = splitFileName(myModuleFullName())
local platform = "linux-x86_64-ubuntu-3.8"
local platform = capture("python -c \"import distutils.util; import sys; print(distutils.util.get_platform() + '-' + sys.version[0:3],end='')\"");
local home = os.getenv("HOME")
local gpaw_root = pathJoin(home, "git/gpaw", version)
load("gpaw-setups/0.9.20000")
setenv("OMP_NUM_THREADS", 1)
prepend_path("PYTHONPATH", ".")
prepend_path("PYTHONPATH", gpaw_root)
prepend_path("PYTHONPATH", pathJoin(gpaw_root, "build/lib." .. platform))
prepend_path("PATH", pathJoin(gpaw_root, "tools"))
prepend_path("PATH", pathJoin(gpaw_root, "build/bin." .. platform))
execute {cmd='complete -o default -C "/usr/bin/python3 ' .. gpaw_root .. '/gpaw/cli/complete.py" gpaw', modeA={"load"}}

View File

@@ -1 +0,0 @@
jfojt.lua

View File

@@ -1 +0,0 @@
jfojt.lua

3
.modules.kuba/node.lua Normal file
View File

@@ -0,0 +1,3 @@
local home = os.getenv("HOME")
local pkg = pathJoin(home, "node-v21.1.0-linux-x64")
prepend_path("PATH", pathJoin(pkg, "bin"))

View File

@@ -3,6 +3,16 @@ Defines useful SLURM aliases
]==]) ]==])
set_alias("si", 'sinfo -e -o "%9P %4a %8s %.10l %11A %6z %.7m %40N"') set_alias("si", 'sinfo -e -o "%9P %4a %8s %.10l %11A %6z %.7m %40N"')
set_alias("q", 'squeue -u $USER -o "%7A %56j %2t %16S %.10M %.10L %.2D %4N"') set_alias("q", 'squeue -u $USER -o "%8A %56j %2t %16S %.10M %.10L %.2D %4N"')
set_alias("ql", 'squeue -u $USER -o "%8A %7K %56j %2t %3r %16S %.10M %.10L %.4D %8N %4f"') set_alias("ql", 'squeue -u $USER -o "%8A %7K %56j %2t %3r %16S %.10M %.10L %.4D %8N %4f"')
set_alias("qll", 'squeue -u $USER -o "%8A %7K %150j %2t %3r %16S %.10M %.10L %.4D %8N %4f"')
set_alias("qa", 'squeue -o "%8A %10u %.6Q %24j %2t %3r %16S %.10M %.10L %.4D %16N" -S t,-p | less') set_alias("qa", 'squeue -o "%8A %10u %.6Q %24j %2t %3r %16S %.10M %.10L %.4D %16N" -S t,-p | less')
set_alias("qq", 'squeue -u $USER -o "%8A %7K %76j %9F %2t %.10L"')
set_alias("qid", 'squeue -h -u $USER -o "%A"')
set_alias("scancelall", 'squeue -h -u $USER -o "%A" | xargs scancel')
local path = splitFileName(myFileName());
local loadscript = pathJoin(path, '.' .. myModuleName() .. '.sh');
execute{cmd='source ' .. loadscript, modeA={"load"}}
execute{cmd='unset -f qnode qssh watchlog catlog taillog;', modeA={"unload"}}

12
.modules.kuba/tools.lua Normal file
View File

@@ -0,0 +1,12 @@
whatis([==[
Loads useful tools
]==])
local path = splitFileName(myFileName());
local loadscript = pathJoin(path, '.' .. myModuleName() .. '.sh');
execute{cmd='source ' .. loadscript, modeA={"load"}}
execute{cmd='unset -f npz_preview npz_previewi ' ..
'rsync_wrap rsync_wrap_huge selc selv cliipc clipv watch_modify pdftoclipboard gitgrepsed' ..
'rsync_wrap rsync_wrap_huge selc selv cliipc clipv watch_modify' ..
';', modeA={"unload"}}

View File

@@ -15,15 +15,15 @@ Host aino
User jakub User jakub
Port 22209 Port 22209
Host tahoe Host puffinus
HostName tahoe.fy.chalmers.se HostName puffinus.fy.chalmers.se
User jakub User jakub
Port 22209 Port 22209
Host geym Host sharknado
HostName geym.fy.chalmers.se HostName 130.239.81.182
User jakub User ubuntu
Port 22209 IdentityFile ~/.ssh/jupyterhub_rsa
Host pi4 Host pi4
HostName 192.168.0.200 HostName 192.168.0.200
@@ -48,11 +48,7 @@ Host vera2
User fojt User fojt
Host tetralith Host tetralith
Hostname tetralith1.nsc.liu.se Hostname tetralith.nsc.liu.se
User x_jakfo
Host tetralith2
Hostname tetralith2.nsc.liu.se
User x_jakfo User x_jakfo
Host remote11 Host remote11
@@ -63,21 +59,10 @@ Host remote11
ControlPersist yes ControlPersist yes
ControlPath ~/.ssh/socket-%r@%h:%p ControlPath ~/.ssh/socket-%r@%h:%p
Host beskow Host dardel
Hostname beskow.pdc.kth.se Hostname dardel.pdc.kth.se
User fojt User fojt
GSSAPIAuthentication yes IdentityFile ~/.ssh/id-ed25519-pdc
GSSAPIKeyExchange yes
GSSAPIDelegateCredentials yes
PreferredAuthentications gssapi-keyex,gssapi-with-mic
Host tegner
Hostname tegner.pdc.kth.se
User fojt
GSSAPIAuthentication yes
GSSAPIKeyExchange yes
GSSAPIDelegateCredentials yes
PreferredAuthentications gssapi-keyex,gssapi-with-mic
Host * Host *
ForwardAgent no ForwardAgent no

11
.ssh/rc
View File

@@ -3,3 +3,14 @@
if [ ! -S ~/.ssh/ssh_auth_sock ] && [ -S "$SSH_AUTH_SOCK" ]; then if [ ! -S ~/.ssh/ssh_auth_sock ] && [ -S "$SSH_AUTH_SOCK" ]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi fi
# Taken from the sshd(8) manpage.
if read proto cookie && [ -n "$DISPLAY" ]; then
if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
# X11UseLocalhost=yes
echo add unix:`echo $DISPLAY | cut -c11-` $proto $cookie
else
# X11UseLocalhost=no
echo add $DISPLAY $proto $cookie
fi | xauth -q -
fi

View File

@@ -1,14 +1,24 @@
# Prefix
unbind C-b unbind C-b
set-option -g prefix C-a set-option -g prefix C-a
bind-key C-a send-prefix bind-key C-a send-prefix
# Mouse and colors
set -g mouse on set -g mouse on
set -g default-terminal "screen-256color"
# pane movement # pane movement
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'" bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
# ssh socket, important to create symlink in ~/.ssh/rc # Update the session environment upon attaching
set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock set-option -g update-environment 'SSH_AUTH_SOCK SSH_CONNECTION DISPLAY'
set-hook -g client-attached 'run-shell /bin/update_display.sh'
# Rename the session to the path
set-option -g status-interval 5
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{pane_current_path}'
# Shorten delay for relaying Esc (to e.g. vim). Too short and PgUp will not work # Shorten delay for relaying Esc (to e.g. vim). Too short and PgUp will not work
set -sg escape-time 20 set -sg escape-time 20

141
.vimrc
View File

@@ -2,41 +2,50 @@ let mapleader = ","
set nocompatible " be iMproved, required set nocompatible " be iMproved, required
filetype off " required filetype off " required
let vundle_dir="~/.vim/bundle/Vundle.vim" let plug_fpath="~/.vim/autoload/plug.vim"
if filereadable(expand(vundle_dir) . "/README.md") if filereadable(expand(plug_fpath))
" set the runtime path to include Vundle and initialize call plug#begin()
let &rtp .= "," . vundle_dir
call vundle#begin()
Plugin 'VundleVim/Vundle.vim' " let Vundle manage Vundle, required Plug 'scrooloose/nerdtree'
Plug 'vim-scripts/c.vim'
Plug 'jeetsukumaran/vim-buffergator'
Plug 'ericcurtin/CurtineIncSw.vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'rhysd/vim-clang-format'
Plug 'godlygeek/tabular'
Plug 'airblade/vim-gitgutter'
Plug 'jeetsukumaran/vim-pythonsense'
Plug 'easymotion/vim-easymotion'
Plug 'cpiger/NeoDebug'
Plug 'ivan-krukov/vim-snakemake'
Plug 'nvie/vim-flake8'
Plug 'ludovicchabant/vim-gutentags'
Plug 'junegunn/vim-peekaboo'
if has('python3') && empty($VIM_DISABLE_YCM)
Plug 'ycm-core/YouCompleteMe', { 'do': './install.py' }
endif
Plug 'dense-analysis/ale'
Plug 'tpope/vim-unimpaired'
Plug 'JuliaEditorSupport/julia-vim'
Plug 'tell-k/vim-autopep8'
Plug 'tell-k/vim-autoflake'
Plug 'jpalardy/vim-slime'
Plug 'preservim/tagbar'
Plug 'wellle/context.vim'
Plugin 'scrooloose/nerdtree' call plug#end()
Plugin 'c.vim'
Plugin 'jeetsukumaran/vim-buffergator'
Plugin 'ericcurtin/CurtineIncSw.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'rhysd/vim-clang-format'
" Plugin 'shougo/neocomplete'
Plugin 'godlygeek/tabular'
Plugin 'airblade/vim-gitgutter'
Plugin 'jeetsukumaran/vim-pythonsense'
Plugin 'easymotion/vim-easymotion'
Plugin 'cpiger/NeoDebug'
Plugin 'ivan-krukov/vim-snakemake'
Plugin 'nvie/vim-flake8'
Plugin 'ludovicchabant/vim-gutentags'
Plugin 'junegunn/vim-peekaboo'
Plugin 'ycm-core/YouCompleteMe'
call vundle#end() " required
else else
let vundle_repo="https://github.com/VundleVim/Vundle.vim.git" let plug_url="https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
echo "Vundle not installed, type :CloneVundle to clone the vundle repo and install it" echo "Plug not installed, type :CurlPlug to download and install plug"
command! CloneVundle execute "!git clone " . vundle_repo . " " . vundle_dir | source $MYVIMRC | echo "Cloned Vundle. Do :PluginInstall" command! CurlPlug execute "!curl -fLo " . plug_fpath . " --create-dirs " . plug_url | source $MYVIMRC | echo "Curled Plug. Do :PlugInstall"
endif endif
set tabstop=4 " show existing tab with 4 spaces width
set shiftwidth=4 " when indenting with '>', use 4 spaces width
set expandtab " On pressing tab, insert 4 spaces
if !exists("vimrc_autocmds_loaded") if !exists("vimrc_autocmds_loaded")
let vimrc_autocmds_loaded = 1 let vimrc_autocmds_loaded = 1
@@ -52,6 +61,10 @@ if !exists("vimrc_autocmds_loaded")
au BufRead,BufNewFile *.md setlocal textwidth=80 | setlocal colorcolumn=80 au BufRead,BufNewFile *.md setlocal textwidth=80 | setlocal colorcolumn=80
au BufRead,BufNewFile *.py setlocal colorcolumn=100 au BufRead,BufNewFile *.py setlocal colorcolumn=100
au FileType html setlocal shiftwidth=2 tabstop=2 au FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
autocmd FileType javascriptreact setlocal shiftwidth=2 tabstop=2
autocmd FileType typescript setlocal shiftwidth=2 tabstop=2
autocmd FileType typescriptreact setlocal shiftwidth=2 tabstop=2
if exists(":NERDTree") if exists(":NERDTree")
" Open NERDTree if no file specified " Open NERDTree if no file specified
@@ -63,8 +76,6 @@ if !exists("vimrc_autocmds_loaded")
au BufLeave,FocusLost,InsertEnter * set nornu au BufLeave,FocusLost,InsertEnter * set nornu
endif endif
set updatetime=1000 " Default is 4s, but reduce it to make things more real time, like git gutter set updatetime=1000 " Default is 4s, but reduce it to make things more real time, like git gutter
highlight Search ctermbg=5
highlight ColorColumn ctermbg=4
filetype plugin indent on " required filetype plugin indent on " required
syntax on syntax on
@@ -79,10 +90,6 @@ autocmd GUIEnter * set visualbell t_vb=
vnoremap > ><CR>gv vnoremap > ><CR>gv
vnoremap < <<CR>gv vnoremap < <<CR>gv
set tabstop=4 " show existing tab with 4 spaces width
set shiftwidth=4 " when indenting with '>', use 4 spaces width
set expandtab " On pressing tab, insert 4 spaces
set mouse=a set mouse=a
set hlsearch set hlsearch
set scrolloff=5 " Don't let cursor be within 5 lines from top or bottom set scrolloff=5 " Don't let cursor be within 5 lines from top or bottom
@@ -124,10 +131,21 @@ noremap Y y$
command! -bang -range=% -complete=file -nargs=* W <line1>,<line2>write<bang> <args> command! -bang -range=% -complete=file -nargs=* W <line1>,<line2>write<bang> <args>
command! -bang Q quit<bang> command! -bang Q quit<bang>
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlPMixed'
let g:ctrlp_working_path_mode = 'ra' " Look for .git .hg .svn .bzr _darcs
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn|data|logs)$',
\ 'file': '\v\.(exe|so|dll)$',
\ }
" Gutentags configuration " Gutentags configuration
if !executable('ctags') if !executable('ctags')
let g:gutentags_enabled = 0 let g:gutentags_enabled = 0
else else
nmap <F1> :CtrlPTag<CR>
nmap <F4> :TagbarToggle<CR>
let g:gutentags_add_default_project_roots = 0 let g:gutentags_add_default_project_roots = 0
let g:gutentags_project_root = ['.git'] let g:gutentags_project_root = ['.git']
@@ -200,6 +218,21 @@ let g:ycm_python_interpreter_path = '~/.python-venv.kuba/bin/python'
"let g:ycm_autoclose_preview_window_after_insertion = 1 " Close after leaving insert mode "let g:ycm_autoclose_preview_window_after_insertion = 1 " Close after leaving insert mode
let g:ycm_autoclose_preview_window_after_completion = 1 " Close after accepting completion let g:ycm_autoclose_preview_window_after_completion = 1 " Close after accepting completion
" ALE
let g:ale_linters = {
\ 'python': ['flake8'],
\ 'c': ['gcc']
\}
let g:ale_virtualtext_cursor = 'disable'
let g:ale_set_highlights = 1
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '--'
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
let g:ale_c_parse_makefile = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_set_loclist = 1
" fugitive.vim looks for tags in .git " fugitive.vim looks for tags in .git
" set tags +=~/tags " Recursively move upwards in tree, searching in subfolders for tags file " set tags +=~/tags " Recursively move upwards in tree, searching in subfolders for tags file
@@ -221,6 +254,24 @@ set statusline+=\ %l:%c"
set statusline+=%#MoreMsg# set statusline+=%#MoreMsg#
set statusline+=\ " set statusline+=\ "
" Colors
" Useful for testing:
" :runtime syntax/colortest.vim
" :runtime syntax/hitest.vim
highlight SignColumn ctermbg=NONE
highlight GitGutterAdd ctermbg=NONE ctermfg=DarkGreen
highlight GitGutterChange ctermbg=NONE ctermfg=Yellow
highlight GitGutterDelete ctermbg=NONE ctermfg=DarkRed
highlight GitGutterDelete ctermbg=NONE ctermfg=DarkRed
highlight Search ctermbg=Brown ctermfg=LightRed
highlight ColorColumn ctermbg=DarkBlue
highlight Visual ctermbg=LightBlue
highlight DiffChange ctermbg=black ctermfg=lightgreen
highlight ALEInfo ctermbg=DarkBlue ctermfg=White
highlight ALEWarning ctermbg=DarkBlue ctermfg=Black
highlight ALEError ctermbg=DarkRed ctermfg=Black
highlight SpellCap ctermbg=DarkBlue ctermfg=Black
highlight SpellBad ctermbg=DarkRed ctermfg=Black
" flake8 " flake8
let g:flake8_show_in_gutter=1 let g:flake8_show_in_gutter=1
@@ -290,6 +341,20 @@ nmap <F2> :NERDTreeToggle<CR>
nmap <F3> :NERDTreeFind<CR> nmap <F3> :NERDTreeFind<CR>
map <F5> :call CurtineIncSw()<CR> map <F5> :call CurtineIncSw()<CR>
let g:context_enabled = 0
map <F6> :ContextToggle<CR>
map cp :ContextPeek<CR>
" Julialang
let g:latex_to_unicode_auto = 1
noremap <expr> <F7> LaTeXtoUnicode#Toggle()
noremap! <expr> <F7> LaTeXtoUnicode#Toggle()
autocmd FileType python noremap <buffer> :call Autoflake()<CR> :call Autopep8()<CR>
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": "default", "target_pane": "{last}"}
nmap <Leader>cf :cd %:p:h <CR> " Change dir to parent of current file nmap <Leader>cf :cd %:p:h <CR> " Change dir to parent of current file
nmap <Leader>cg :cd $git_root_location <CR> " Change dir to git root nmap <Leader>cg :cd $git_root_location <CR> " Change dir to git root
nmap <Leader>vs :sp $HOME/.vimrc <CR> nmap <Leader>vs :sp $HOME/.vimrc <CR>
@@ -332,3 +397,7 @@ nmap <Leader>p :set paste! <CR>
map <Leader>n :noh<CR> map <Leader>n :noh<CR>
vmap <Leader>T :'<,'> Tabularize / vmap <Leader>T :'<,'> Tabularize /
nnoremap <leader>c :execute "set colorcolumn=" . (&colorcolumn == "" ? "120" : "")<CR> nnoremap <leader>c :execute "set colorcolumn=" . (&colorcolumn == "" ? "120" : "")<CR>
" Insert "Embed IPython" command
:command InsIPython :normal oimport IPython<CR>IPython.embed()<ESC><up>^
nmap <Leader>i :InsIPython <CR>

View File

@@ -1,33 +0,0 @@
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
WM=i3
if (( $# == 1 ))
then
WM=$1
fi
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
export EDITOR="vim"
export CUPS_GSSSERVICENAME=HTTP
[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources
rm -f "~/${WM}.log.old"
mv -f "~/${WM}.log" "~/${WM}.log.old"
rm -f "~/${WM}.log"
rm -f "~/${WM}.log"
if [ "$WM" = "i3" ]; then
. ~/.i3initrc
else
exec $WM >> "~/${WM}.log" 2>&1
fi

View File

@@ -1,3 +0,0 @@
if [ "$1" = "i3" ]; then
. ~/.i3initrc
fi

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -1,4 +0,0 @@
[Dolphin]
PreviewsShown=true
Timestamp=2013,5,20,10,21,15
Version=3

6
scripts/.directory Executable file
View File

@@ -0,0 +1,6 @@
[Dolphin]
Timestamp=2014,5,7,20,54,5
Version=3
[Settings]
HiddenFilesShown=true

View File

@@ -1,11 +0,0 @@
#!/bin/bash
# To generate list of large packages
# pacman -Qi | grep 'Name\|Size\|Description' | cut -d: -f2 | paste - - - | awk -F'\t' 'BEGIN{ s["MiB"]=1024; s["KiB"]=1;} {split($3, a, " "); print a[1] * s[a[2]], "KiB", $1}' | sort -n
LARGE_PKGS='linux jdk10-openjdk jre8-openjdk-headless jre10-openjdk-headless gimp gcc-list webkit2gtk gcc python chromium dropbox spotify mono bazel valgrind texlive-core linux-firmware'
echo -n "==> Looking for old packages to prune"
paccache -rk1
echo -n "==> Looking for old large packages to prune"
paccache -rk0 $LARGE_PKGS

View File

@@ -1,43 +0,0 @@
#!/bin/bash
function primary() {
xrandr | grep primary | awk '{print $1}'
}
displays=$(xrandr --listactivemonitors | grep -v Monitors | awk '{print $NF}')
case "$1" in
"auto")
echo "$displays" | while read display; do
xrandr --output $display --auto
done
;;
"connected")
echo "$displays"
;;
"lemonbar")
echo "DISP ${displays[@]}" | sed "s/ /:/g"
;;
*)
# -F Fix strings, -x exactly, -q quiet
if echo "$displays" | grep -Fqx "$1"; then
case "$2" in
"off")
action="--off"
;;
"mirror")
action="--same-as $(primary)"
;;
"left")
action="--left-of $(primary) --auto"
;;
"right")
action="--right-of $(primary) --auto"
;;
*)
exit 1
;;
esac
xrandr --output $1 $action
fi
esac

File diff suppressed because it is too large Load Diff

View File

@@ -1,220 +0,0 @@
#define DEBUG
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fts.h>
#include <string.h>
#include <errno.h>
#include <math.h>
#include <stdarg.h>
#include "health.h"
#include "utils.h"
//ustring ok_str = NEW_USTRING("OK");
//ustring warn_str = NEW_USTRING("WARN");
//ustring arrow_str = NEW_USTRING("├─");
//ustring arrow_last_str = NEW_USTRING("└─");
ustring ok_str = {.str = "OK", .bytes = strlen("OK") };
ustring warn_str = {.str = "WARN ☠", .bytes = strlen("WARN ☠")};
ustring arrow_str = {.str = "├─", .bytes = strlen("├─")};
ustring arrow_last_str = {.str ="└─", .bytes = strlen("└─")};
// fts_path doesn't append trailing slash
struct dir_status top_dir_var[] = {
WATCH_DIR("/var/cache", "1.5G"),
WATCH_DIR("/var/log", "0.5G")
};
struct dir_status top_dir_home[] = {
WATCH_DIR("/home/kuba/.cache", "3G"),
WATCH_DIR("/home/kuba/Downloads", "1G")
};
struct dir_status top_dir_usr[] = {
WATCH_DIR("/usr/local", "5G"),
WATCH_DIR("/usr/lib", "5G"),
WATCH_DIR("/usr/share", "5G"),
WATCH_DIR("/usr/bin", "1G")
};
struct dir_status watched_dirs[] = {
WATCH_DIR_SUBS("/var", "2.5G", top_dir_var),
WATCH_DIR_SUBS("/home/kuba", "20G", top_dir_home),
WATCH_DIR_SUBS("/usr", "15G", top_dir_usr),
WATCH_DIR("/boot", "80M"),
WATCH_DIR("/etc", "20M"),
WATCH_DIR("/root", "10M"),
WATCH_DIR("/run", "10M"),
WATCH_DIR("/srv", "1M"),
WATCH_DIR("/opt", "1G")
};
int main(int argc, char* const argv[])
{
INIT_USTRING(ok_str);
INIT_USTRING(warn_str);
INIT_USTRING(arrow_str);
INIT_USTRING(arrow_last_str);
// Traverse top directories and do some nice formatting
char buf[80];
for (int i = 0; i < sizeof(watched_dirs)/sizeof(struct dir_status); i++){
struct dir_status *dir = watched_dirs + i;
disk_usage(dir);
format_directory_entry(buf, dir, 0, 0);
}
exit(0);
if (argc<2)
{
printf("Usage: %s <path-spec>\n", argv[0]);
exit(255);
}
return 0;
}
//Maybe just remove this, the effect is not noticable
off_t traverse_nochildren(FTS *file_system, const short dir_level)
{
FTSENT *node = NULL;
struct stat *st = NULL;
off_t tot_size = 0;
while( (node = fts_read(file_system)) != NULL)
{
// Add to size
st = node->fts_statp;
if (st) tot_size += (off_t) 512*st->st_blocks;
else debug("st null pointer, skipping\n");
if (node->fts_info == FTS_DP)
{
indent_debug(node->fts_level);
debug("Exiting %s\n", node->fts_path);
// Directory being visited in post-order. Only action is to
// return if back at the starting level
if (node->fts_level == dir_level) return tot_size;
}
}
return 0;// This is bad
}
void traverse_children(FTS *file_system, struct dir_status *dir, const short dir_level)
{
FTSENT *node = NULL;
struct stat *st = NULL;
off_t tot_size = 0;
top_loop:while( (node = fts_read(file_system)) != NULL)
{
//indent_debug(node->fts_level);
//debug("%s\n", node->fts_name);
if (node->fts_info == FTS_D)
{
if(strcmp(node->fts_path, dir->path) == 0) {
continue; // Do nothing
}
indent_debug(node->fts_level);
debug("Entering %s\n", node->fts_path);
// Directory being visited in pre-order. Do not count size except
// after returning from a recursion step. Determine if the current
// node is one of the children.
for (int i = 0; i < dir->n_children; i++) {
struct dir_status *sub_dir = dir->children+i;
if(strcmp(node->fts_path, sub_dir->path) == 0){
// Entering one of the child-directories
indent_debug(node->fts_level);
debug("Entering special %s\n", node->fts_path);
traverse_children(file_system, sub_dir, node->fts_level);
tot_size += sub_dir->size;
goto top_loop;
}
}
// Child directory not in list, call traverse_nochildren instead
tot_size += traverse_nochildren(file_system, node->fts_level);
continue; // Does the same as goto above
}
// Add to size
st = node->fts_statp;
if (st) tot_size += (off_t) 512*st->st_blocks;
else debug("st null pointer, skipping\n");
if (node->fts_info == FTS_DP)
{
indent_debug(node->fts_level);
debug("Exiting %s\n", node->fts_path);
// Directory being visited in post-order. Only action is to save
// size and return if back at the starting level
if (node->fts_level == dir_level){
dir->size = tot_size;
return;
}
}
}
}
int disk_usage(struct dir_status *top_dir)
{
char *paths[] = { top_dir->path, NULL};
FTS* file_system = NULL;
file_system = fts_open(paths, FTS_PHYSICAL, NULL);
if (file_system == NULL) return 1;
traverse_children(file_system, top_dir, 0);
fts_close(file_system);
return 0;
}
const int max_length = 60;
const int max_path_length = 40;
void format_directory_entry(char *buf, struct dir_status *dir, int level, int last_subdir)
{
int n = 0; //Keeps track of where in buffer we are
int delta_n = 0; // Keeps track of how much shorter the string appears
// than the number of bytes
// First fill with apropriate amount of spaces and └ or ├ charcters
if (level > 0) {
ustring *arr = last_subdir?&arrow_last_str:&arrow_str;
n = 4*level - arr->chars;
delta_n += arr->chars - arr->bytes;
memset(buf, ' ', n);
strncpy(buf+n, arr->str, arr->bytes);
n += arr->bytes;
}
// Path and size
n += snprintf(buf + n, max_path_length, "%s -- ", dir->path);
n += pretty_bytes(buf + n, dir->size);
memset(buf + n, ' ', max_length - n); // max_length - n for simplicity
// Right-justify WARN or OK status
ustring *ok = directory_ok(dir->size, dir->warn_at)?&ok_str:&warn_str;
delta_n += ok->chars - ok->bytes;
snprintf(buf + max_length - ok->bytes - 2 - delta_n, ok->bytes+2
, "%s\n", ok->str);// 2 leaves space for \n and null
printf("%s", buf);
// Loop through children
for (int i = 0; i < dir->n_children; i++){
int last = (i == dir->n_children - 1);
format_directory_entry(buf, dir->children + i, (level + 1), last);
}
if(level == 0) printf("\n");
}
int directory_ok(off_t size, char *warn_at){
off_t warn = pretty_bytes_to_num(warn_at);
return size < warn;
}

View File

@@ -1,43 +0,0 @@
#ifndef HEALTH_H
#define HEALTH_H
#include <sys/types.h>
#include "utils.h"
/*
* path - Path of the directory without trailing slash
* warn_at - How large is the directory allowed to be before a warning is
* issued. In human readable form (see utils.c:pretty_bytes)
* children - List of all watched sub-directories
* n_children - Number of elements in children
* size - Size of directory, this is filled in by disk_usage()
*/
struct dir_status {
char * const path;
char * const warn_at;
struct dir_status *children;
int n_children;
off_t size;
};
#define WATCH_DIR(pth,wrn) {.path = pth, .warn_at = wrn, .n_children=0, .size=0}
#define WATCH_DIR_SUBS(pth,wrn,subs) {.path = pth, .warn_at = wrn, .size=0 \
, .children=subs, .n_children=sizeof(subs)/sizeof(struct dir_status)}
off_t traverse_nochildren(FTS *file_system, const short dir_level);
void traverse_children(FTS *file_system, struct dir_status *dir, const short dir_level);
int disk_usage(struct dir_status *top_dir);
//ustring ok_ustr = {.str = "OK", .bytes = 2, .chars = 2};
//NEW_USTRING(ok_str, "OK");
//NEW_USTRING(warn_str, "WARN");
//NEW_USTRING(arrow_str, "├─");
//NEW_USTRING(arrow_last_str,"└─");
//INIT_USTRING(ok_str);
//INIT_USTRING(warn_str);
//INIT_USTRING(arrow_str);
//INIT_USTRING(arrow_last_str);
void format_directory_entry(char *buf, struct dir_status *dir, int level, int last_subdir);
int directory_ok(off_t size, char *warn_at);
#endif

View File

@@ -1,24 +0,0 @@
CFLAGS = -Wall
LDFLAGS = -lm
CC = gcc
default: health
optim: CFLAGS += -O3
optim: health
debug: CFLAGS += -g
debug: health
OBJECTS=health.o utils.o
health: $(OBJECTS)
$(CC) $(CFLAGS) -o health $(OBJECTS) $(LDFLAGS)
health.o: health.c health.h
$(CC) $(CFLAGS) -c health.c
utils.o: utils.c utils.h
$(CC) $(CFLAGS) -c utils.c
clean:
rm -f *.o

View File

@@ -1,87 +0,0 @@
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>
#include <math.h>
#include "utils.h"
void indent(int i)
{
for (; i > 0; i--) printf(" ");
}
// Prints to the provided buffer a nice number of bytes (KB, MB, GB, etc)
// Returns bytes written
int pretty_bytes(char* buf, long long bytes)
{
const char* suffixes[7];
suffixes[0] = "B";
suffixes[1] = "KB";
suffixes[2] = "MB";
suffixes[3] = "GB";
suffixes[4] = "TB";
suffixes[5] = "PB";
suffixes[6] = "EB";
uint s = 0; // which suffix to use
double count = bytes;
while (count >= 1024 && s < 7)
{
s++;
count /= 1024;
}
if (count - floor(count) == 0.0)
return sprintf(buf, "%d %s", (int)count, suffixes[s]);
else
return sprintf(buf, "%.1f %s", count, suffixes[s]);
}
long long pretty_bytes_to_num(char* buf)
{
// First letter of suffix in order
const char suffixes[7] = {'B', 'K', 'M', 'G', 'T', 'P', 'E'};
char suffix;
float fnum;
long long num = 1;
int n;
errno = 0;
n = sscanf(buf,"%f%c", &fnum, &suffix);
if (n == 2) {
//TODO error handling
} else if (errno != 0) {
perror("scanf");
} else {
fprintf(stderr, "No matching characters\n");
}
for (int s=0;s<sizeof(suffixes); s++){
if (suffix == suffixes[s]) break;
num *= 1024;
}
return (long long )(num*fnum);
}
size_t utf8len(const char *s)
{
size_t len = 0;
for (; *s; ++s) if ((*s & 0xC0) != 0x80) ++len;
return len;
}
void debug(const char *format, ...){
#ifdef DEBUG
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
#endif
}
void indent_debug(int i){
#ifdef DEBUG
indent(i);
#endif
}

View File

@@ -1,25 +0,0 @@
#ifndef UTILS_H
#define UTILS_H
#include <sys/types.h>
#include <string.h>
size_t utf8len(const char *s);
typedef struct {
const char *str;
const size_t bytes;
size_t chars;
} ustring;
#define NEW_USTRING(string) {.str = string, .bytes = strlen(string)}//; varname.chars=utf8len(string)}
#define INIT_USTRING(varname) (varname).chars = utf8len(varname.str)
long long pretty_bytes_to_num(char* buf);
int pretty_bytes(char* buf, long long bytes);
void debug(const char *format, ...);
void indent (int i);
void indent_debug (int i);
#endif

View File

@@ -1,24 +0,0 @@
#!/bin/bash
#function get_index(){
# for i in "${!xra_out[@]}"; do
# if [[ "${xra_out[$i]}" = "$value" ]]; then
# echo "${i}";
# break
# fi
# done
#}
#xra_out=($(xrandr | grep ' connected' | awk '{print $1}'))
#in=($@)
#for i in `seq 0 2 ${#in[@]}`; do
# value="${in[$i]}"
# idx=$(get_index)
# if [ ! -z "$idx" ]; then
# screen_idx="$idx"
# #"${xra_out[$idx-1]}"
# paths[${screen_idx%:}]="--bg-scale ${in[$i+1]}"
# fi
#done
##echo "${paths[@]}"
#str=`printf -v var "%s\n" "${System[@]}"`
#sh -c "feh ${paths[@]}"
feh --bg-scale "$@"