Compare commits

..

3 Commits

Author SHA1 Message Date
64b1011bb7
Updated
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
2021-01-16 18:14:25 +01:00
4507e6638f
Updated
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
2021-01-13 00:27:38 +01:00
64710f3369
Updated
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
2021-01-12 22:31:36 +01:00
12 changed files with 928 additions and 11 deletions

26
.config/iptables Executable file
View File

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

View File

@ -1,6 +1,6 @@
=====================NEWS====================================
https://wtf.roflcopter.fr/rss-bridge/?action=display&bridge=Facebook&context=User&u=infoKONINpl&media_type=all&limit=-1&format=Mrss "~infoKONIN - Facebook"
https://wtf.roflcopter.fr/rss-bridge/?action=display&bridge=Facebook&context=User&u=gminakleczew&media_type=all&limit=-1&format=Mrss "~Gmina Kleczew - Facebook"
shttps://wtf.roflcopter.fr/rss-bridge/?action=display&bridge=Facebook&context=User&u=gminakleczew&media_type=all&limit=-1&format=Mrss "~Gmina Kleczew - Facebook"
https://wtf.roflcopter.fr/rss-bridge/?action=display&bridge=Facebook&context=User&u=portalLM&media_type=all&limit=-1&format=Mrss "~Portal lm.pl - Facebook"
https://nitter.net/MZ_GOV_PL/rss "~MZ_GOV_PL - Twitter"
http://www.epoznan.pl/rss.php "~Epoznan - Website"
@ -18,4 +18,52 @@ http://rss.uptimerobot.com/u674346-753d02ab763f3725330347d4419a7569 "~UpTimeRobo
https://mirror.animetosho.org/feed/rss2?only_tor=1&q=%5BHorribleSubs%5D%20Sword%20Art%20Online%20720p&filter%5B0%5D%5Bt%5D=nyaa_class&filter%5B0%5D%5Bv%5D=trusted "~Sword Art Online"
=====================YOUTUBE=================================
https://www.youtube.com/feeds/videos.xml?channel_id=UCzuvRWjh7k1SZm1RvqvIx4w "~Krzysztof Gonciarz"
============================================================
https://www.youtube.com/feeds/videos.xml?channel_id=UC3QOjSZmJuYgb98BAzKfzig "~Zapytaj Beczkę"
https://www.youtube.com/feeds/videos.xml?channel_id=UC2eYFnH61tmytImy1mTYvhA "~Luke Smith"
https://www.youtube.com/feeds/videos.xml?channel_id=UC2qQkGwReBfucb6yWr7idRA "~Asia Ladowska"
https://www.youtube.com/feeds/videos.xml?channel_id=UC5ZSM0kOGhtLdtZiqM2noWw "~StudyWithInSpo"
https://www.youtube.com/feeds/videos.xml?channel_id=UC84AaEtr7hlaYYwXDSKAbNg "~Ignacy z Japonii"
https://www.youtube.com/feeds/videos.xml?channel_id=UC8JbbaZ_jgdsoUqrZ2bXtQQ "~Lekko Stronniczy"
https://www.youtube.com/feeds/videos.xml?channel_id=UC8q23MpiyWjv9vd4r85oj1A "~Daniel Rakowiecki"
https://www.youtube.com/feeds/videos.xml?channel_id=UC9Vi25H6lQvPqcepJCJ3sEg "~Emma"
https://www.youtube.com/feeds/videos.xml?channel_id=UCAD-xOOaUI6N7Uq9laOVbcw "~Rene Rene"
https://www.youtube.com/feeds/videos.xml?channel_id=UCAEQl0BbYrPyTnsWVBJuIqQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCaG-Uk3PSpHexeUJaJC_TPw
https://www.youtube.com/feeds/videos.xml?channel_id=UCAkBZtIl-a0fBLcY7JCPSQw
https://www.youtube.com/feeds/videos.xml?channel_id=UCB-4hoTjsE3VIFI862C5SZA
https://www.youtube.com/feeds/videos.xml?channel_id=UCE5Au4LfcBHxTQR_yLbncrQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCe6nK69Yc1zna7QSJEfA9pw
https://www.youtube.com/feeds/videos.xml?channel_id=UCEbYhDd6c6vngsF5PQpFVWg
https://www.youtube.com/feeds/videos.xml?channel_id=UCELsE3w85wy7hXFmU2eRn_w
https://www.youtube.com/feeds/videos.xml?channel_id=UCfegHHvKywKjJ69Ymcb6j0w
https://www.youtube.com/feeds/videos.xml?channel_id=UCFGud6qsbaAjuP6WaXAJj3Q
https://www.youtube.com/feeds/videos.xml?channel_id=UCH2OHdQF5c2r2M_l_vPiXRA
https://www.youtube.com/feeds/videos.xml?channel_id=UCIDf8pzX2oZmjXtqMwHn0xg
https://www.youtube.com/feeds/videos.xml?channel_id=UCIj6yjWVKPKO5zNLBjQ8Beg
https://www.youtube.com/feeds/videos.xml?channel_id=UCJ24N4O0bP7LGLBDvye7oCA
https://www.youtube.com/feeds/videos.xml?channel_id=UCJkmbV_cndEe6Af8b5qVyoQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCJLLl6AraX1POemgLfhirwg
https://www.youtube.com/feeds/videos.xml?channel_id=UCjS2aGCvsnhExcWRAI8T4Pw
https://www.youtube.com/feeds/videos.xml?channel_id=UCMsi03EhTUsUs2OtPus6XDQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCMTkC2dA25yFsmtaevpYWfg
https://www.youtube.com/feeds/videos.xml?channel_id=UCnOo8dtBgwJbdwl4HxqPHwg
https://www.youtube.com/feeds/videos.xml?channel_id=UCO8DQrSp5yEP937qNqTooOw
https://www.youtube.com/feeds/videos.xml?channel_id=UCoJjEsNkU-Md3xB6BursT0Q
https://www.youtube.com/feeds/videos.xml?channel_id=UCoXxgqIOTa8qCM7Hd7RiURw
https://www.youtube.com/feeds/videos.xml?channel_id=UCPc_saLjikyw-1sscFsHIsA
https://www.youtube.com/feeds/videos.xml?channel_id=UCPKgIhTC3BdkAwMw6s-GEug
https://www.youtube.com/feeds/videos.xml?channel_id=UCRxAgfYexGLlu1WHGIMUDqw
https://www.youtube.com/feeds/videos.xml?channel_id=UCs02jgjMVeirmDHaxAXApkg
https://www.youtube.com/feeds/videos.xml?channel_id=UCsnGwSIHyoYN0kiINAGUKxg
https://www.youtube.com/feeds/videos.xml?channel_id=UCv9wKjBogC5AVG54s_Imn0A
https://www.youtube.com/feeds/videos.xml?channel_id=UCvbEYH_h8k-hHq2oS-7zIdQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCVbn813ctsoChuTT4LuLqrA
https://www.youtube.com/feeds/videos.xml?channel_id=UCVVt5tbZEzfQSIsHUh3b_vg
https://www.youtube.com/feeds/videos.xml?channel_id=UCw3T7SvPYDHCkdMhC0NcKsw
https://www.youtube.com/feeds/videos.xml?channel_id=UCWcz2SQMCcijkVta0hSERIA
https://www.youtube.com/feeds/videos.xml?channel_id=UCWFKCr40YwOZQx8FHU_ZqqQ
https://www.youtube.com/feeds/videos.xml?channel_id=UCXRJfVWEjv9qxooSbOkFmkw
https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw
https://www.youtube.com/feeds/videos.xml?channel_id=UCZgyxIrQnTDLwwEr9VSkoPA
https://www.youtube.com/feeds/videos.xml?channel_id=UCZKqIdmPtIU6DOTmWxzudKw
=============================================================

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

@ -0,0 +1,14 @@
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(markdown-command "/usr/bin/pandoc")
'(package-selected-packages
'(helm treemacs-persp treemacs-magit treemacs-icons-dired treemacs-projectile treemacs-evil lsp-java flycheck-haskell haskell-mode apache-mode auto-complete-clang markdown-mode company-ansible ansible-doc ansible yaml-mode flymake-yaml dockerfile-mode robe flymake-ruby magit multiple-cursors dired-sidebar dracula-theme flymake-shell flycheck-bashate flymake-shellcheck company move-text ox-reveal htmlize smex switch-window use-package)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)

View File

@ -21,7 +21,9 @@
(menu-bar-mode 0)
;; Enable IDO mode
(ido-mode 1)
(setq ido-enable-flex-matching t)
;;(setq ido-everywhere t)
;;(ido-mode 1)
(global-set-key (kbd "C-x b") 'ido-switch-buffer)
;; Remove working cl
@ -152,6 +154,14 @@
(require 'flymake-shell)
(add-hook 'sh-set-shell-hook 'flymake-shell-load)
;; Default font
(defun rc/get-default-font ()
(cond
((eq system-type 'windows-nt) "Consolas-13")
((eq system-type 'gnu/linux) "xos4 Terminus Bold 16")))
(add-to-list 'default-frame-alist `(font . ,(rc/get-default-font)))
;; Theme
(use-package dracula-theme
:ensure t
@ -166,6 +176,29 @@
(require 'dired-sidebar)
(global-set-key (kbd "C-x d") 'dired-sidebar-toggle-sidebar)
;; Smex
(require 'smex)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
;;buffer-move
(require 'buffer-move)
(global-set-key (kbd "<C-S-up>") 'buf-move-up)
(global-set-key (kbd "<C-S-down>") 'buf-move-down)
(global-set-key (kbd "<C-S-left>") 'buf-move-left)
(global-set-key (kbd "<C-S-right>") 'buf-move-right)
;; Multiple-cursors
(use-package multiple-cursors
:ensure t
:config
)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
;; Magit
(use-package magit
:ensure t
@ -210,10 +243,7 @@
:defer t)
;; YAML
(use-package flymake-yaml
:ensure t
:config
)
(require 'flymake-yaml)
(use-package yaml-mode
:ensure t
@ -273,8 +303,153 @@
(add-hook 'flycheck-mode-hook #'flycheck-haskell-setup)
;; Java
;; lsp-install-server
;; jdtls
(use-package lsp-java
:ensure t
:config
(global-set-key (kbd "C-.") 'lsp-execute-code-action)
)
(global-set-key (kbd "<f9>") 'dap-breakpoint-toggle)
(global-set-key (kbd "<f10>") 'dap-next)
(global-set-key (kbd "<f11>") 'dap-step-in)
(global-set-key (kbd "<f12>") 'lsp-jt-browser)
(global-set-key (kbd "<C-f12>") 'dap-stop-thread)
(global-set-key (kbd "<C-?>") 'comment-or-uncomment-region)
(add-hook 'dap-stopped-hook
(lambda (arg) (call-interactively #'dap-hydra)))
(setq dap-auto-configure-features '(sessions locals controls tooltip))
(require 'lsp-java)
(add-hook 'java-mode-hook #'lsp)
(require 'dap-java)
;; Treemacs
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display t
treemacs-file-event-delay 5000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-forward-on-expand nil
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-width 35
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(pcase (cons (not (null (executable-find "git")))
(not (null treemacs-python-executable)))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple))))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-evil
:after treemacs evil
:ensure t)
(use-package treemacs-projectile
:after treemacs projectile
:ensure t)
(use-package treemacs-icons-dired
:after treemacs dired
:ensure t
:config (treemacs-icons-dired-mode))
(use-package treemacs-magit
:after treemacs magit
:ensure t)
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
:after treemacs persp-mode ;;or perspective vs. persp-mode
:ensure t
:config (treemacs-set-scope-type 'Perspectives))
;;; --- Look & Feel ---
;; Helm
(use-package helm
:ensure t
:config
)
(add-hook 'helm-minibuffer-set-up-hook
'helm-hide-minibuffer-maybe)
(setq helm-autoresize-max-height 0)
(setq helm-autoresize-min-height 20)
(helm-autoresize-mode 1)
(helm-mode 1)
;; Disable scroll bar
(scroll-bar-mode -1)
;; Copy
(setq select-active-regions nil)
(setq mouse-drag-copy-region t)
(global-set-key [mouse-2] 'mouse-yank-at-click)
;; Zoom in/out.
(global-set-key (kbd "M-+") 'text-scale-increase)
(global-set-key (kbd "M--") 'text-scale-decrease)

View File

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

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

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

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

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

View File

@ -5,7 +5,7 @@ chosen=$(echo -e "$choices" | dmenu -i)
case "$chosen" in
Lock) slock ;;
Suspend) loginctl suspend && slock ;;
Suspend) sudo s2ram && slock ;;
Reboot) sudo reboot ;;
Shutdown) sudo shutdown -h now ;;
esac

22
.local/bin/twitch Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
CLIENT_ID=SET_CLIENT_ID_HERE
OAUTH_TOKEN=SET_OAUTH_TOKEN_HERE
if [ -z "$1" ]; then
curl -s \
-H 'Accept: application/vnd.twitchtv.v5+json' \
-H "Client-ID: ${TWITCH_CLIENT_ID:-$CLIENT_ID}" \
-H "Authorization: OAuth ${TWITCH_OAUTH_TOKEN:-$OAUTH_TOKEN}" \
-X GET 'https://api.twitch.tv/kraken/streams/followed' | \
ramda \
'tap (res) -> if res.error then console.error(res); process.exit(1)' \
'.streams' \
'map pick-dot-paths [\channel.name, \channel.status, \game, \viewers]' \
'map flat' \
'map (rename-keys-by split(".") >> last)' \
'-> if is-empty(it) then "No one you are following is streaming right now." else it' \
-o table
else
streamlink -p mpv twitch.tv/$1 ${2:-best}
fi

3
.local/bin/video-convert Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
FILE=$(echo $1 | cut -d. -f1)
ffmpeg -i $1 -b:a 128k -codec:v libx265 -b:v 1500k -vf scale=1280:720 $FILE-convered.mp4

View File

@ -28,7 +28,8 @@ bitlbee -D&
sudo /usr/bin/rdate -s ntp.task.gda.pl && sudo /sbin/hwclock --systohc
megasync &
#mega-cmd-server --debug-full > /var/log/megacmd/megacmd.log&
setxkbmap pl&
ibus-daemon&
#setxkbmap pl&
# Two monitors are enabled?

5
.zshrc
View File

@ -22,6 +22,7 @@ plugins=(rake ruby vagrant knife knife_ssh kitchen )
ZSH_DISABLE_COMPFIX=true
source $ZSH/oh-my-zsh.sh
source $HOME/.password
source $HOME/Linux/configs/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh &>> /dev/null
source $HOME/Linux/configs/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh &>> /dev/null
source $HOME/.plannaplan &>> /dev/null
@ -50,8 +51,8 @@ export FZF_DEFAULT_OPTS='--height 40% --layout=reverse'
export EIX_LIMIT_COMPACT=0
export TERMINAL="st"
export QT_SCALE_FACTOR=1.5
export VISUAL='nvim'
export EDITOR='nvim'
export VISUAL='vim'
export EDITOR='vim'
alias svm="sudo vim /etc/portage/make.conf"
alias svr="sudo vim /etc/portage/repos.conf"
alias svp="sudo vim /etc/portage/package.use"