Merge branch 'master' of frogit:geoffrey/dotfiles

This commit is contained in:
Geoffrey Frogeye 2018-01-30 19:08:04 +01:00
commit 2ebe91cccf
41 changed files with 1524 additions and 1843 deletions

3
.gitmodules vendored
View file

@ -1,3 +0,0 @@
[submodule "dotsync"]
path = dotsync
url = git@github.com:dotphiles/dotsync.git

View file

View file

@ -3,7 +3,7 @@
mkdir -p $HOME/.local/share/fonts
echo $(for i in "" "%20Bold" "%20Oblique" "%20Bold%20Oblique"; do
cd $HOME/.local/share/fonts
wget http://raw.githubusercontent.com/powerline/fonts/master/DejaVuSansMono/DejaVu%20Sans%20Mono$i%20for%20Powerline.ttf
wget -c http://raw.githubusercontent.com/powerline/fonts/master/DejaVuSansMono/DejaVu%20Sans%20Mono$i%20for%20Powerline.ttf
done)
wget "https://aur.archlinux.org/cgit/aur.git/plain/icons.ttf?h=ttf-font-icons" -O $HOME/.local/share/fonts/icons.ttf
wget -c "https://aur.archlinux.org/cgit/aur.git/plain/icons.ttf?h=ttf-font-icons" -O $HOME/.local/share/fonts/icons.ttf

View file

@ -1 +1 @@
profile
.profile

9
bashrc
View file

@ -48,22 +48,21 @@ alias pacman='pacman --color auto'
alias dmesg='dmesg --ctime'
# Frequent mistakes
alias sl=ls
alias al=la
alias mdkir=mkdir
alias systemclt=systemctl
# Shortcuts for commonly used commands
alias ll="ls -l $LS_OPTIONS"
alias la="ls -la $LS_OPTIONS"
alias al=sl
alias x='startx; logout'
alias s='sudo -s -E'
alias po='eval $(proxy off)'
alias nw="sudo systemctl restart NetworkManager"
alias mc="machines"
alias tracefiles="strace -f -t -e trace=file"
alias vpn="sudo systemctl start openvpn-client@$HOSTNAME"
alias vpno="sudo systemctl stop openvpn-client@$HOSTNAME"
alias vpns="sudo systemctl status openvpn-client@$HOSTNAME"
alias vpnr="sudo systemctl restart openvpn-client@$HOSTNAME"
# Superseding commands with better ones if they are present
if which vim &> /dev/null; then
alias vi='vim'

1
bower Symbolic link
View file

@ -0,0 +1 @@
.cache/bower

1
cargo Symbolic link
View file

@ -0,0 +1 @@
.cache/cargo

View file

@ -1,26 +0,0 @@
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=47
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=1
shadow_other_users=0
show_thread_names=0
show_program_path=0
highlight_base_name=1
highlight_megabytes=0
highlight_threads=1
tree_view=0
header_margin=0
detailed_cpu_time=0
cpu_count_from_zero=0
update_process_names=0
account_guest_in_cpu_meter=0
color_scheme=0
delay=15
left_meters=AllCPUs Memory Swap
left_meter_modes=1 1 1
right_meters=Tasks LoadAverage Uptime
right_meter_modes=2 2 2

View file

@ -38,7 +38,7 @@ bindsym button2 kill
bindsym $mod+F2 exec --no-startup-id ~/.config/i3/dmenu_run
bindsym Mod1+F2 exec --no-startup-id ~/.config/i3/dmenu_run
bindsym $mod+c exec --no-startup-id ~/.config/i3/passmenu
bindsym $mod+c exec --no-startup-id ~/.config/i3/passmenu --type
#bindsym $mod+x exec --no-startup-id ~/.config/i3/clipmenu
bindsym $mod+asterisk exec --no-startup-id ~/.config/i3/sshmenu
bindsym $mod+dollar exec --no-startup-id ~/.config/i3/sshmenu root
@ -145,14 +145,19 @@ set $WS10 10
# Workspace output
workspace "$WS1" output LVDS1
workspace "$WS2" output VGA1
workspace "$WS2" output HDMI1
workspace "$WS3" output LVDS1
workspace "$WS4" output VGA1
workspace "$WS4" output HDMI1
workspace "$WS5" output LVDS1
workspace "$WS6" output VGA1
workspace "$WS6" output HDMI1
workspace "$WS7" output LVDS1
workspace "$WS8" output VGA1
workspace "$WS8" output HDMI1
workspace "$WS9" output LVDS1
workspace "$WS10" output VGA1
workspace "$WS10" output HDMI1
# switch to workspace
bindsym $mod+1 workspace $WS1
@ -234,7 +239,7 @@ assign [class="Clementine"] $WS10
assign [title="TweetDeck"] $WS8
# Open specific applications in floating mode
for_window [title="alsamixer"] floating enable border pixel 2
for_window [title="pacmixer"] floating enable border pixel 2
for_window [class="Firefox"] layout tabbed
for_window [class="qutebrowser"] layout tabbed
@ -356,7 +361,6 @@ bindsym $mod+F5 exec --no-startup-id xautolock -enable
# Autostart applications
exec --no-startup-id autorandr --change # Screen configuration and everything that depends on it
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Password remembering
exec --no-startup-id gnome-keyring-daemon # Password remembering
exec --no-startup-id numlockx on # Activate Num lock
@ -367,6 +371,7 @@ exec --no-startup-id dunst # Notifications
exec --no-startup-id keynav # Keyboard cursor controller
#exec --no-startup-id $HOME/.config/i3/clipmenud # Clipboard manager
exec --no-startup-id mpd # Music Player Daemon
exec --no-startup-id autorandr --change # Screen configuration and everything that depends on it
set $ignore #ff00000

View file

@ -1,2 +1,2 @@
#!/bin/sh
dmenu -fn 'DejaVu Sans Mono-10' -nb '#48483e' -nf '#f1ebeb' -sb '#8fc029' -sf '#272822' -l 8 -f -i -h 19 "$@"
dmenu -fn 'DejaVu Sans Mono-10' -nb '#48483e' -nf '#f1ebeb' -sb '#8fc029' -sf '#272822' -l 8 -f "$@"

View file

@ -8,17 +8,23 @@ if [[ $1 == "--type" ]]; then
shift
fi
if PASS=$(which gopass 2> /dev/null); then
password_files="$($PASS ls --flat)"
elif PASS=$(which pass 2> /dev/null); then
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
else
exit
fi
password=$(printf '%s\n' "${password_files[@]}" | $HOME/.config/i3/dmenu_cmd -p "Passwords" "$@")
[[ -n $password ]] || exit
if [[ $typeit -eq 0 ]]; then
pass show -c "$password" 2>/dev/null
$PASS show -c "$password"
else
xdotool - <<<"type --clearmodifiers -- $(pass show "$password" | head -n 1)"
xdotool - <<<"type --clearmodifiers -- $($PASS show "$password" | head -n 1)"
fi

5
config/i3/test Normal file
View file

@ -0,0 +1,5 @@
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/**/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
echo -e "${password_files[@]}"

View file

@ -1,84 +0,0 @@
general {
output_format = "i3bar"
colors = true
interval = 1
}
order += "disk /home"
order += "disk /"
order += "path_exists VPN"
order += "ethernet usb0"
order += "wireless wlan1"
order += "wireless wlan0"
order += "ethernet eth0"
order += "cpu_usage"
order += "battery 0"
#order += "load"
order += "volume master"
order += "tztime local"
wireless wlan0 {
format_up = " (%quality at %essid, %bitrate) %ip"
format_down = ""
}
wireless wlan1 {
format_up = " (%quality at %essid, %bitrate) %ip"
format_down = ""
}
ethernet eth0 {
# if you use %speed, i3status requires the cap_net_admin capability
format_up = " %ip"
format_down = ""
}
ethernet usb0 {
# if you use %speed, i3status requires the cap_net_admin capability
format_up = " %ip"
format_down = "📱"
}
cpu_usage {
format = " %usage"
}
battery 0 {
format = "%status %percentage"
format_down = ""
status_chr = ""
status_bat = ""
status_full = ""
path = "/sys/class/power_supply/BAT%d/uevent"
low_threshold = 10
}
path_exists VPN {
# path exists when a VPN tunnel launched by nmcli/nm-applet is active
path = "/proc/sys/net/ipv4/conf/tun0"
format = "🔐"
}
tztime local {
format = "🕘 %d/%m/%Y %H:%M:%S"
timezone = "Europe/Paris"
}
load {
format = "%5min"
}
disk "/" {
format = " %avail / %total"
}
disk "/home" {
format = " %avail / %total"
}
volume master {
format = "🔈 %volume"
format_muted = "🔇 %volume"
device = "default"
mixer = "Master"
mixer_idx = 0
}

View file

@ -76,7 +76,7 @@ enable-ipc = true
inherit = bar/base
modules-center = mpd
modules-right = eth wlan xbacklight volume battery date
modules-right = vpncheck eth wlan bbswitch xbacklight volume battery date
tray-position = right
tray-padding = 2
@ -84,7 +84,7 @@ tray-transparent = false
[bar/secondary]
inherit = bar/base
modules-right = cpu memory temperature ethMore wlanMore filesystem xbacklight volume date
modules-right = cpu memory temperature vpncheck ethMore wlanMore filesystem bbswitch xbacklight volume date
[module/filesystem]
@ -174,6 +174,13 @@ icon-repeatone = 1
toggle-on-foreground = ${theme.foreground}
toggle-off-foreground = #55
[module/bbswitch]
type = custom/script
exec = grep -o '\w\+$' /proc/acpi/bbswitch
exec-if = test -f /proc/acpi/bbswitch
interval = 5
prefix =
format-foreground = ${theme.redF}
[module/xbacklight]
type = internal/xbacklight
@ -212,6 +219,13 @@ interval = 2
format-foreground = ${theme.greenF}
label =  %gb_free%
[module/vpncheck]
type = custom/script
exec = echo 
exec-if = pgrep openvpn
interval = 5
format-foreground = ${theme.blueF}
[module/eth]
type = internal/network
interface = ${env:ethI:eth0}

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
face
.face

1
gem Symbolic link
View file

@ -0,0 +1 @@
.cache/gem

View file

@ -6,3 +6,5 @@
excludesfile = ~/.gitignore
[push]
default = matching
[alias]
git = !exec git

1
go Symbolic link
View file

@ -0,0 +1 @@
.cache/go

2
icon
View file

@ -1 +1 @@
face
.face

1
m2 Symbolic link
View file

@ -0,0 +1 @@
.cache/m2

1
npm Symbolic link
View file

@ -0,0 +1 @@
.cache/npm

1
nv Symbolic link
View file

@ -0,0 +1 @@
.cache/nv

3
scripts/arch-kexec Executable file
View file

@ -0,0 +1,3 @@
#!/usr/bin/env bash
sudo kexec -l /boot/vmlinuz-linux --initrd=/boot/initramfs-linux.img --reuse-cmdlin
sudo systemctl kexec

65
scripts/archive Executable file
View file

@ -0,0 +1,65 @@
#!/usr/bin/env python3
import os
import argparse
parser = argparse.ArgumentParser(description="Place a folder in ~/Documents in ~/Documents/Archives and symlink it")
parser.add_argument('dir', metavar='DIRECTORY', type=str, help="The directory to archive")
parser.add_argument('-d', '--dry', action='store_true')
args = parser.parse_args()
# Finding directories
assert('HOME' in os.environ), "Home directory unknown"
docs = os.path.realpath(os.path.join(os.environ['HOME'], 'Documents'))
assert(os.path.isdir(docs)), "Documents folder not found"
arcs = os.path.join(docs, 'Archives')
assert(os.path.isdir(arcs)), "Archives folder not found"
def archive(docdir):
docdir = os.path.realpath(args.dir)
assert(os.path.isdir(docdir)), docdir + " must be a directory"
assert(docdir.startswith(docs)), "Directory is not in the document folder"
assert(not docdir.startswith(arcs)), "Directory is already in the archive folder"
reldir = os.path.relpath(docdir, docs)
print("ARC", reldir)
arcdir = os.path.join(arcs, reldir)
parentArcdir = os.path.realpath(os.path.join(arcdir, '..'))
parentDocdir = os.path.realpath(os.path.join(docdir, '..'))
linkDest = os.path.relpath(arcdir, parentDocdir)
# BULLSHIT
# If the directory exists
if os.path.isdir(arcdir):
return
# for f in os.listdir(arcdir):
# assert(os.path.isdir(f)), "Something unknown in Archive dir")
# archive(os.path.join(arcdir, f))
# If the directory doesn't exist, create the directories under it and move all the folder
else:
if args.dry:
print("mkdir -p", parentArcdir)
else:
os.makedirs(parentArcdir, exist_ok=True)
if args.dry:
print("mv", docdir, arcdir)
else:
os.rename(docdir, arcdir)
if args.dry:
print("ln -s", linkDest, docdir)
else:
os.symlink(linkDest, docdir)
def unarchive(arcdir):
return
archive(args.dir)

12
scripts/cudarun Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
if [ -z $DISPLAY ]
then
sudo tee /proc/acpi/bbswitch <<< ON
"$@"
rmmod nvidia_uvm
rmmod nvidia
sudo tee /proc/acpi/bbswitch <<< OFF
else
PATH="/opt/cuda/bin:$PATH" LD_LIBRARY_PATH="/opt/cuda/lib64:$LD_LIBRARY_PATH" VBLANK=0 VGL_READBACK=pbo optirun -c yuv "$@"
fi

View file

@ -142,7 +142,39 @@ function _debloc-ldconfig {
find $DEBLOC_ROOT{/usr,}/lib -type l -name "*.so*" | while read link; do
yes | cp --force --no-dereference --preserve=links "$link" "$DEBLOC_LD" &> /dev/null
done &> /dev/null
}
# Fix absolute symbolic links
function _debloc-fixRootSymlinks {
find $DEBLOC_ROOT -type l | while read src
do
dst="$(readlink "$src")"
if echo "$dst" | grep '^/' | grep -q -v "^$DEBLOC_ROOT"
then
newDst="$DEBLOC_ROOT$dst"
if [ -f "$newDst" ]
then
echo "$src → $newDst"
rm "$src"
ln -s "$newDst" "$src"
else
echo "Ignoring $src pointing to $dst"
fi
fi
done
}
function _debloc-fixPkgconfPrefix {
sed "s|^prefix=/usr$|prefix=$DEBLOC_ROOT/usr|" $(find $DEBLOC_ROOT -type f -name "*.pc") -i
}
function debloc_fix {
echo "Fixing absolute symbolic links..."
_debloc-fixRootSymlinks
echo "Linking libraries in /ld"
_debloc-ldconfig
echo "Fixing prefix in pkg-config files"
_debloc-fixPkgconfPrefix
}
# Install debian archive
@ -180,7 +212,7 @@ function _debloc-install { # package
DEB_FILE=$(mktemp) &> /dev/null
path=$(_debloc-packagePath $pkg)
echo -e "${DEBIAN_MIRROR}" | while read mirror; do
if [ -z $mirror ]; then
if [ -z "$mirror" ]; then
continue
fi
url=${mirror}/${path}
@ -258,8 +290,9 @@ function debloc_env {
echo "export C_INCLUDE_PATH=\"$DEBLOC_ROOT/usr/include:\$C_INCLUDE_PATH\""
echo "export CPLUS_INCLUDE_PATH=\"$DEBLOC_ROOT/usr/include:$DEBLOC_ROOT/usr/include/python2.7/:$DEBLOC_ROOT/usr/include/x86_64-linux-gnu/python2.7/:\$CPLUS_INCLUDE_PATH\""
echo "export LD_LIBRARY_PATH=\"$DEBLOC_LD:\$LD_LIBRARY_PATH\""
echo "export PYTHONPATH=\"$DEBLOC_ROOT/usr/lib/python3/dist-packages:\$PYTHONPATH\""
echo "export PYTHONPATH=\"$DEBLOC_ROOT/usr/lib/python2/dist-packages:$DEBLOC_ROOT/usr/lib/python3/dist-packages:$DEBLOC_ROOT/usr/lib/python2.7/dist-packages:$DEBLOC_ROOT/usr/lib/python3.5/dist-packages:\$PYTHONPATH\""
echo "export QT_QPA_PLATFORM_PLUGIN_PATH=\"$DEBLOC_ROOT/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms\""
echo "export PKG_CONFIG_PATH=\"$DEBLOC_ROOT/usr/share/pkgconfig/:$DEBLOC_ROOT/usr/lib/x86_64-linux-gnu/pkgconfig/:$DEBLOC_ROOT/usr/lib/pkgconfig/:\$PKG_CONFIG_PATH\""
}
function debloc_info {
@ -283,13 +316,23 @@ function debloc_install { # package
if [ -z $1 ]; then
debloc_deb_help
fi
for pkg in $*
do
if [ $pkg == '--force' ] || [ $pkg == '-f' ]; then
force=0
fi
done
for pkg in $*; do
if [ $pkg == '--force' ] || [ $pkg == '-f' ]; then
continue
fi
pkg=$(_debloc-filterVirtual $pkg)
_debloc-exists $pkg
if [ $? == 0 ]; then
echo "Unknown package $pkg"
continue
fi
if [ ! -v force ]; then
_debloc-locallyInstalled $pkg
if [ $? == 1 ]; then
echo "Package $pkg is already installed with Debloc"
@ -300,6 +343,7 @@ function debloc_install { # package
echo "Package $pkg is already installed on the system"
continue
fi
fi
_debloc-installDeps $pkg
done
return 0
@ -385,6 +429,7 @@ function debloc_help {
echo " install Install a debian package in the fake filesystem"
echo " deb Install from a .deb file in the fake filesystem"
echo " altern Update alternative"
echo " fix Apply some fixes in the fake filesystem"
echo " flush Remove every package installed from the fake filesystem"
echo " help Get help with commands"
echo

70
scripts/gitghost Executable file
View file

@ -0,0 +1,70 @@
#!/usr/bin/bash
# Replace git folders with a placeholder containing the remote and the commit
function prompt { # text
while true; do
read -p "$1 [yn] " yn
case $yn in
[Yy]* ) return 1;;
[Nn]* ) return 0;;
* ) echo "Please answer yes or no.";;
esac
done
}
if [[ "$#" == 0 || "$#" > 2 ]]
then
echo "Usage: $0 gitfolder [-y]"
exit 1
fi
folder="$(echo "$1" | sed 's/\/*$//')"
if [ "$2" == "-y" ]
then
donotask=true
fi
if [ ! -d "$folder/.git" ]
then
echo "$folder is not a git repository"
exit 1
fi
if [ -n "$(git -C "$folder" diff)" ]
then
echo "WARNING: There are unstaged change. Those will be discarded if you continue."
fi
echo "Be sure that every commit in the repository is backed up somewhere else, since those will be discarded."
TMPFILE=$(mktemp)
(echo "[gitplaceholder]"
echo "lastcommit=$(git log --format="%H" -n 1)"
echo
echo "[remote]"
git -C "$folder" remote -v
echo
echo "[branch]"
git -C "$folder" branch -v
echo
echo "[diff]"
git -C "$folder" diff -v) > $TMPFILE 2> /dev/null
if [ ! $donotask ]
then
less $TMPFILE
echo
echo "This will be written in place of $folder."
prompt "Do you want to continue ?"
if [ "$?" == 0 ]
then
echo "Canceled"
rm $TMPFILE
exit 0
fi
fi
echo "Dummying..."
rm -rf "$folder"
mv $TMPFILE $folder

10
scripts/heavyPackages Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Return a list of packages sorted by size
(echo PACKAGE SIZE; \
for A in /var/lib/pacman/local/*/desc; do
(sed -n 2p $A; (grep '^%SIZE%$' $A -A1 | tail -1)) | tr '\n' ' '; echo
done \
| sort -nrk2) \
| column -t

View file

@ -3,9 +3,9 @@
# Setups an Arch Linux system the way I like it
# (requires sudo)
if which pacman &> /dev/null; then
if ! which pacman &> /dev/null; then
echo "This is not an Arch Linux system (or pacman isn't installed)"
return 1
exit 1
fi
# Configuration
@ -21,21 +21,21 @@ function prompt { # text
}
# Don't ask for things that are already there
if which yaourt &> /dev/null; then
local YAOURT=1
if which pacaur &> /dev/null; then
PACAUR=1
fi
if which bauerbill &> /dev/null; then
local BAUERBILL=1
BAUERBILL=1
fi
if [ -z $YAOURT ]; then
prompt "Do you want yaourt on this machine?"
local YAOURT=$?
if [ -z $PACAUR ]; then
prompt "Do you want pacaur on this machine?"
PACAUR=$?
fi
if [ $YAOURT == 1 ]; then
if [ $PACAUR == 1 ]; then
if [ -z $BAUERBILL ]; then
prompt "Do you want bauerbill on this machine?"
local BAUERBILL=$?
BAUERBILL=$?
fi
else
BAUERBILL=0
@ -55,10 +55,11 @@ function inst {
# Install package from PKGBUILD file
function installPKGBUILD { # url
# TODO Download snapshots
TMP_DIR="$(mktemp -d /tmp/pkgbuild.XXXXXXXXXX)"
cd "$TMP_DIR"
wget "$1" -O PKGBUILD
makepkg -si
makepkg -si --noconfirm
cd -
rm -rf "$TMP_DIR"
}
@ -66,41 +67,62 @@ function installPKGBUILD { # url
# SYSTEM
inst wget
pacman -Q yaourt &> /dev/null
if [[ $YAOURT == 1 && $? == 1 ]]; then
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=package-query"
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=yaourt"
# Aur
pacman -Q pacaur &> /dev/null
if [[ $PACAUR == 1 && $? == 1 ]]; then
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower"
installPKGBUILD "https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur"
fi
if pacman -Q pamac ; then
sudo pacman -Rsc pamac
# Git for /etc
sudo pacman -S etckeeper --noconfirm --needed
sudo etckeeper init
sudo etckeeper commit "~/.dotfiles/scripts/install-arch commit"
# Uninstall Manjaro's pamac
if pacman -Q pamac &> /dev/null ; then
sudo pacman -Rsc pamac --noconfirm
fi
# Ccache
sudo pacman -S ccache --noconfirm --needed
sudo sed 's|BUILDENV=\(.\+\)!ccache\(.\+\)|BUILDENV=\1ccache\2|' /etc/makepkg.conf -i
# Bauerbill
pacman -Q bauerbill &> /dev/null
if [[ $BAUERBILL == 1 && $? == 1 ]]; then
sudo pacman -Sy manjaro-{hotfixes,keyring,release,system} --noconfirm
sudo pacman -Sy
gpg --recv-keys 1D1F0DC78F173680
installPKGBUILD http://xyne.archlinux.ca/projects/reflector/pkgbuild/PKGBUILD
yaourt -S bauerbill --noconfirm
pacaur -S bauerbill --noconfirm --noedit
bb-wrapper -Su
# TODO Prompt if all went well, if not restart
bauerbill -Su --noconfirm
else
sudo pacman -Syu
fi
# Disable predictable network names
sudo ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
# TLP
# sudo pacman -S tlp
# sudo systemctl enable tlp.service tlp-sleep.service
# sudo systemctl disable systemd-rfkill
sudo pacman -S tlp --noconfirm --needed
sudo sed 's|SATA_LINKPWR_ON_BAT=min_power|SATA_LINKPWR_ON_BAT=max_performance|' /etc/default/tlp -i
sudo systemctl enable tlp.service tlp-sleep.service
sudo systemctl disable systemd-rfkill.service systemd-rfkill.socket
sudo tlp start
# TODO
# make -j8 in MAKEPKG
# time
# nfs
# hibernate
# Numlock on boot
echo -e "[Service]\nExecStartPre=/bin/sh -c 'setleds +num < /dev/%I'" | sudo systemctl edit getty\@.service
# Makeflags
sudo sed "s|#MAKEFLAGS=\"-j2\"|MAKEFLAGS=\"-j$(nproc)\"|" /etc/makepkg.conf -i
# Time synchronisation
sudo pacman -S ntp --noconfirm --needed
sudo systemctl start ntpd
sudo systemctl enable ntpd
# MANUAL
# Hibernation
# Add resume=UUID=<UUID-of-swap-partition> to GRUB_CMDLINE_LINUX_DEFAULT and run `sudo grub-mkconfig -o /boot/grub/grub.cfg`

View file

@ -54,7 +54,14 @@ if which pacman &> /dev/null; then
function installFileOne { # file
sudo pacman -U "$1"
}
if which yaourt &> /dev/null; then
if which pacaur &> /dev/null; then
function altInstallOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
pacaur -S "$1" --noconfirm --noedit
fi
}
elif which yaourt &> /dev/null; then
function altInstallOne { # package
pacman -Q $1 &> /dev/null
if [ $? == 1 ]; then
@ -107,7 +114,6 @@ elif which dpkg &> /dev/null; then
fi
rm -f $STATUS > /dev/null
echo 101 $1 $installed
# Installing if it's not installed
if [ $installed == 0 ]; then
# TODO noconfirm
@ -174,10 +180,10 @@ if [ $TERMUX == 1 ]; then
inst tsu
fi
fi
inst moreutils screen ncdu lsof htop proxytunnel pv curl wget sshfs netcat mosh bash-completion rsync
inst moreutils screen ncdu lsof htop proxytunnel pv curl wget sshfs netcat mosh bash-completion rsync pwgen
if [ $ARCH == 1 ]; then
inst gopass
altInst tldr-bash-git
inst bash-completion
altInst gopass
else
inst pass
wget -qO ~/.bin/ https://raw.githubusercontent.com/pepa65/tldr-bash-client/master/tldr
@ -228,12 +234,13 @@ if [ $ARCH == 1 ] && [ $ADMIN == 1 ]; then
fi
else
if [ $DEBIAN == 1 || $TERMUX == 1 ]; then
inst python-dev python3-dev
inst python-dev python3-dev cmake
fi
YCM_ARGS=""
if [ $TERMUX != 1 ]; then
YCM_ARGS="$YCM_ARGS --clang-completer --tern-completer"
fi
python $HOME/.vim/bundle/YouCompleteMe/install.py $YCM_ARGS
fi
@ -242,10 +249,26 @@ fi
if [ $GUI == 1 ]; then
# Desktop manager
inst i3 i3lock dunst unclutter xautolock feh numlockx scrot xterm xclip
curl "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/a8386aae19e200ddb0f6845b5feeee5eb7013687/fonts/fontawesome-webfont.ttf" > ~/.local/share/fonts/fontawesome-webfont.ttf
if [ $ARCH == 1 ]; then
altInst polybar-git ttf-font-awesome autorandr-git keynav-enhanced
inst xorg-xinit
altInst polybar-git autorandr-git keynav-enhanced pacmixer
else
echo "TODO compile polybar-git autorandr-git"
# Compiling polybar
if ! which polybar > /dev/null; then
inst debhelper cmake libxcb-icccm4-dev libxcb-image0-dev libxcb-randr0-dev libx11-dev libxcb1-dev libxcb-util-dev libx11-xcb-dev linux-libc-dev libboost-dev x11proto-core-dev libxcb-ewmh-dev libxft-dev libasound2-dev libiw-dev libmpdclient-dev xcb-proto python-xcbgen libxcb-xkb-dev i3-wm libcairo2-dev libxcb-xrm-dev
# TODO Figure which one are really needed
#inst libasound2 libc6 libgcc1 libiw30 libmpdclient2 libstdc++6 libx11-6 libx11-xcb1 libxcb-ewmh2 libxcb-icccm4 libxcb-randr0 libxcb-xkb1 libxcb1 libxft2
TMP=$(mktemp -d)
git clone --branch 3.0.5 --recursive https://github.com/jaagr/polybar $TMP
mkdir $TMP/build
cd $TMP/build
cmake ..
make -j`nproc`
strip bin/polybar
mv bin/polybar ~/.bin/
rm -rf $TMP
fi
fi
if [ $DEBIAN == 1 ]; then
inst suckless-tools keynav
@ -261,10 +284,10 @@ if [ $GUI == 1 ]; then
# qutebrowser
if [ $DEBIAN == 1 ]; then
inst python3-lxml python-tox python3-pyqt5 python3-pyqt5.qtwebkit python3-pyqt5.qtquick python3-sip python3-jinja2 python3-pygments python3-yaml
inst python3-lxml python-tox python3-pyqt5 python3-pyqt5.qtwebkit python3-pyqt5.qtquick python3-sip python3-jinja2 python3-pygments python3-yaml python3-pyqt5.qtsql libqt5sql5-sqlite python3-pyqt5.qtwebengine python3-pyqt5.qtopengl python3-opengl
TMP_DIR=$(mktemp -d)
$(cd $TMP_DIR; wget https://qutebrowser.org/python3-pypeg2_2.15.2-1_all.deb)
$(cd $TMP_DIR; wget https://github.com/qutebrowser/qutebrowser/releases/download/v0.9.1/qutebrowser_0.9.1-2_all.deb)
$(cd $TMP_DIR; wget https://github.com/qutebrowser/qutebrowser/releases/download/v0.11.0/qutebrowser_0.11.0-1_all.deb)
instFile $TMP_DIR/*.deb
rm -rf $TMP_DIR
@ -277,9 +300,9 @@ if [ $GUI == 1 ]; then
altInst sct
elif [ $TERMUX != 1 ]; then
if [ ! -f $HOME/.bin/sct ]; then
TMP=$(mktemp)
wget http://www.tedunangst.com/flak/files/sct.c -O $TMP
cc -std=c99 -O2 -I /usr/X11R6/include -o $HOME/.bin/sct $TMP -L /usr/X11R6/lib -lm -lX11 -lXrandr
TMP=$(mktemp /tmp/XXXXXXXXXX.c)
wget https://gist.githubusercontent.com/ajnirp/208c03d3aa7f02c743d2/raw/55bf3eed25739173d8be57b5179ed5542cf40ed6/sct.c -O $TMP
cc $TMP --std=c99 -lX11 -lXrandr -o $HOME/.bin/sct
rm $TMP
fi
fi
@ -297,20 +320,24 @@ if [ $EXTRA == 1 ]; then
inst cmake clang llvm npm
# Extra CLI
inst sl ffmpeg youtube-dl optipng syncthing
inst ffmpeg youtube-dl optipng syncthing ccache
if [ $ARCH == 1 ]; then
inst jq
altInst pdftk translate-shell git-lfs js-beautify insect visidata-git
else
# translate-shell
curl -L git.io/trans > ~/.bin/trans
chmod +x ~/.bin/trans
fi
# Extra GUI
if [ $GUI == 1 ]; then
inst vlc gimp mpd vimpc
inst vlc gimp mpd thunar noto-fonts-emoji musescore
if [ $ARCH == 1 ]; then
inst simplescreenrecorder
altInst pacmixer
altInst pacmixer xcursor-menda-git menda-themes-git menda-maia-icon-theme vimpc-git mpc
fi
fi

View file

@ -67,9 +67,6 @@ function _machines-apiSigned {
_machines-api "$@" --certificate=$MACHINES_CONFIG/machines.crt --private-key=$MACHINES_CONFIG/machines.key
}
function _machines-getQR {
_machines-apiSigned totp | qrencode -o - | feh -
}
# APPLICATION KEYS & CERTIFICATE
@ -142,16 +139,16 @@ function _machines-getAkey { # network
}
function _machines-updateAkey {
KEY_FILE=$(mktemp)
MYKEY_FILE=$(mktemp)
network=$(cat $MACHINES_CONFIG/this | grep '^network=' | cut -d '=' -f 2)
_machines-getAkey $network > $KEY_FILE
_machines-getAkey $network > "$MYKEY_FILE"
if [ $? == 0 ]; then
yes | mv $KEY_FILE $MACHINES_HOME/.ssh/authorized_keys &> /dev/null
yes | mv $MYKEY_FILE $MACHINES_HOME/.ssh/authorized_keys &> /dev/null
return 0
else
cat $KEY_FILE
cat $MYKEY_FILE
echo "[ERROR] Authorized keys are not properly signed"
rm $KEY_FILE
rm $MYKEY_FILE
exit 1
fi
}
@ -171,12 +168,12 @@ function _machines-addElement { # element elementType default
$EDITOR $FILE
data=$(_machines-postFile $FILE)
rm $FILE &> /dev/null
machines-apiSigned $2 --post-data "name=$1$data"
_machines-apiSigned $2 --post-data "name=$1$data"
}
function _machines-editElement { # element elementType
FILE=$(mktemp)
_machines-apiSigned $2/$1
_machines-apiSigned $2/$1 > $FILE
$EDITOR $FILE
data=$(_machines-postFile $FILE)
rm $FILE &> /dev/null
@ -238,7 +235,6 @@ function machines_machine_add { # machine
machines_machine_add_help
exit 1
fi
_machines-addElement $1 machine "allowed[]=\nsecure=false"
_machines-addElement $1 machine "host[]=\nnetwork=\nuserkey=\nhostkey=\nuser="
}
@ -435,6 +431,12 @@ function machines_update {
_machines-updateAkey
}
function machines_totp {
url=$(_machines-apiSigned totp)
echo "URL : $url"
echo "$url" | qrencode -o - | feh -
}
function machines_help {
command="$1"
@ -457,6 +459,8 @@ function machines_help {
echo " network|net|n Modify networks"
echo " update-all Update all machines available via SSH"
echo " regen-keys Regenerate system keys"
echo " sign Sign recent transactions for propagation"
echo " totp Get TOTP generating QR code / URL"
return 0
}

View file

@ -37,6 +37,8 @@ if (argv.t) {
template = fs.readFileSync(argv.t, "utf8");
}
var latex = true;
// TODO Arg
// Settings
@ -74,7 +76,9 @@ for (lang in extraLangages) {
var renderer = new marked.Renderer();
marked.setOptions({
highlight: function(code, lang) {
if (highlight.getLanguage(lang)) {
if (lang == 'raw') {
return code;
} else if (highlight.getLanguage(lang)) {
return highlight.highlight(lang, code).value;
} else {
// if (extraLangages[lang]) {
@ -93,17 +97,27 @@ marked.setOptions({
markdownString = fs.readFileSync(argv.i, "utf8");
// TeX
if (latex) {
markdownString = markdownString.replace(/\\\$/g, '&dollar;')
markdownString = markdownString.replace(/\$\$([\s\S]+)\$\$/gm, function(glob, formula) {
return katex.renderToString(formula, {displayMode: true});
return katex.renderToString(formula, {
displayMode: true
});
});
markdownString = markdownString.replace(/\$([^$]+)\$/g, function(glob, formula) {
return katex.renderToString(formula, {displayMode: false});
return katex.renderToString(formula, {
displayMode: false
});
});
}
// Conversion
htmlString = marked(markdownString, {renderer: renderer});
fullHtmlString = template.replace('%BODY%', htmlString);
htmlString = marked(markdownString, {
renderer: renderer
});
// fullHtmlString = htmlString;
fullHtmlString = template.replace('%BODY%', () => { return htmlString });
// Saving
if (argv.o == '/dev/stdout') {

2
scripts/newestFile Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
find -type f -printf '%T+ %p\n' | sort | tail "$@"

2
scripts/oldestFile Executable file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
find -type f -printf '%T+ %p\n' | sort | head "$@"

View file

@ -7,6 +7,7 @@
# (executable)
# TODO Run in parallel
# TODO Lots of dupplicated code there
dir=${1:-$PWD}
total=$(mktemp)
@ -20,7 +21,53 @@ function showtotal {
trap showtotal SIGTERM SIGINT SIGFPE
function doReplace { # candidate original
mv "$c" "$o"
saved=$(($os - $cs))
perc=$((100 * $saved / $os))
echo "→ $os ⇒ $cs (saved $saved bytes, or ${perc}%)"
newtotal=$(($(cat $total) + $saved))
echo -n $newtotal > $total
}
function replace { # candidate original
c="$1"
o="$2"
# File verifications
if [ ! -f "$o" ]; then
echo "→ Original is inexistant, skipping!"
return
fi
if [ ! -f "$c" ]; then
echo "→ Candidate is inexistant, skipping!"
return
fi
# Size verifications
cs=$(wc -c "$c" | cut -d' ' -f1)
os=$(wc -c "$o" | cut -d' ' -f1)
if [ $cs -le 0 ]; then
echo "→ Candidate is empty, skipping!"
rm "$c"
return
fi
if [ $cs -eq $os ]; then
echo "→ Candidate weight the same, skipping."
rm "$c"
return
fi
if [ $cs -gt $os ]; then
echo "→ Candidate is larger, skipping."
rm "$c"
return
fi
doReplace "$c" "$o"
}
function replaceImg { # candidate original
# With bitmap verification
c="$1"
o="$2"
@ -61,11 +108,7 @@ function replaceImg { # candidate original
convert "$o" "$ppmo"
if cmp --silent "$ppmo" "$ppmc"; then
mv "$c" "$o"
saved=$(($os - $cs))
echo "→ $os ⇒ $cs (saved $saved bytes)"
newtotal=$(($(cat $total) + $saved))
echo -n $newtotal > $total
doReplace "$c" "$o"
else
echo "→ Candidate don't have the same bit map as original, skipping!"
fi
@ -82,22 +125,9 @@ do
prog=$(mktemp --suffix .jpg)
jpegtran -copy all -progressive "$image" > "$prog"
echo "→ Progressive done"
optz=$(mktemp --suffix .jpg)
jpegtran -copy all -optimize "$image" > "$optz"
echo "→ Optimize done"
progs=$(wc -c "$prog" | cut -d' ' -f1)
optzs=$(wc -c "$optz" | cut -d' ' -f1)
if [[ $progs -le $optzs ]]; then
echo "→ Using progressive"
replaceImg "$prog" "$image"
rm "$optz"
else
echo "→ Using optimized"
replaceImg "$optz" "$image"
rm "$prog"
fi
replace "$prog" "$image"
done <<< "$(find "$dir" -type f -iregex ".+.jpe?g$")"
@ -109,10 +139,10 @@ do
temp=$(mktemp --suffix .png)
cp "$image" "$temp"
optipng -o7 -quiet "$temp"
optipng -quiet "$temp"
echo "→ Optimize done"
replaceImg "$temp" "$image"
replace "$temp" "$image"
done <<< "$(find "$dir" -type f -iname "*.png")"

1043
scripts/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -38,7 +38,7 @@ do
if [[ $dry == 0 ]]; then
echo "$src" → "$dst"
else
mv "$src" "$dst"
mv -- "$src" "$dst"
fi
done

View file

@ -1,2 +1,4 @@
#!/data/data/com.termux/files/usr/bin/bash
echo "/system/bin/mount -o remount,rw /" | tsu
echo "ln -s /data/data/com.termux/files/usr /usr" | tsu
echo "/system/bin/mount -o remount,ro /" | tsu

7
vimpcrc Normal file
View file

@ -0,0 +1,7 @@
map FF :browse<C-M>gg/
map à :set add next<C-M>a:set add end<C-M>
map @ :set add next<C-M>a:set add end<C-M>:next<C-M>
map ° D:browse<C-M>A:shuffle<C-M>:play<C-M>:playlist<C-M>
set songformat {%a - %b: %t}|{%f}$E$R $H[$H%l$H]$H
set libraryformat %n \| {%t}|{%f}$E$R $H[$H%l$H]$H
set ignorecase

View file