Too many things
This commit is contained in:
parent
a1ab569bfb
commit
b8ead05322
2
bashrc
2
bashrc
|
@ -111,8 +111,8 @@ alias fuck='eval $(thefuck $(fc -ln -1))'
|
||||||
alias FUCK='fuck'
|
alias FUCK='fuck'
|
||||||
|
|
||||||
# Command not found
|
# Command not found
|
||||||
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
|
|
||||||
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash
|
[ -r /usr/share/doc/pkgfile/command-not-found.bash ] && . /usr/share/doc/pkgfile/command-not-found.bash
|
||||||
|
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
function clean {
|
function clean {
|
||||||
|
|
4
config/ycm_extra_conf.py
Normal file
4
config/ycm_extra_conf.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
def FlagsForFile(filename, **kwargs):
|
||||||
|
return {
|
||||||
|
'flags': ['-Wall', '-Wextra', '-lm'],
|
||||||
|
}
|
|
@ -79,13 +79,20 @@ function _machines-regenKey {
|
||||||
openssl genrsa -out $MACHINES_CONFIG/machines.key 4096
|
openssl genrsa -out $MACHINES_CONFIG/machines.key 4096
|
||||||
chmod 600 $MACHINES_CONFIG/machines.key
|
chmod 600 $MACHINES_CONFIG/machines.key
|
||||||
openssl req -key $MACHINES_CONFIG/machines.key -new -out $MACHINES_CONFIG/machines.csr
|
openssl req -key $MACHINES_CONFIG/machines.key -new -out $MACHINES_CONFIG/machines.csr
|
||||||
openssl x509 -req -in $MACHINES_CONFIG/machines.csr -signkey $MACHINES_CONFIG/machines.key -out $MACHINES_CONFIG/machines.crt
|
openssl x509 -req -days 1826 -in $MACHINES_CONFIG/machines.csr -signkey $MACHINES_CONFIG/machines.key -out $MACHINES_CONFIG/machines.crt
|
||||||
_machines-pubFromCrt
|
_machines-pubFromCrt
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _machines-verifyCertificate {
|
||||||
|
if openssl verify $MACHINES_CONFIG/machines.crt | grep -v 'error18' | grep 'error' --quiet; then
|
||||||
|
echo "Invalid certificate"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function _machines-ensurePub {
|
function _machines-ensurePub {
|
||||||
if [ ! -f $MACHINES_CONFIG/machines.pub ]; then
|
if [ ! -f $MACHINES_CONFIG/machines.crt ]; then
|
||||||
CERT_FILE=$(mktemp)
|
CERT_FILE=$(mktemp)
|
||||||
echo "[INFO] Downloading certificate..."
|
echo "[INFO] Downloading certificate..."
|
||||||
_machines-api cert > $CERT_FILE
|
_machines-api cert > $CERT_FILE
|
||||||
|
@ -93,14 +100,15 @@ function _machines-ensurePub {
|
||||||
prompt "Is this correct ?"
|
prompt "Is this correct ?"
|
||||||
if [ $? == 1 ]; then
|
if [ $? == 1 ]; then
|
||||||
mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null
|
mv $CERT_FILE $MACHINES_CONFIG/machines.crt &> /dev/null
|
||||||
_machines-pubFromCrt
|
|
||||||
return 0
|
|
||||||
else
|
else
|
||||||
echo "Certificate rejected."
|
echo "Certificate rejected."
|
||||||
return 1
|
exit 1
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
_machines-verifyCertificate
|
||||||
|
if [ ! -f $MACHINES_CONFIG/machines.pub ]; then
|
||||||
|
_machines-pubFromCrt
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# SSH ACCESS KEYS
|
# SSH ACCESS KEYS
|
||||||
|
@ -115,6 +123,7 @@ function _machines-signAkey { # network
|
||||||
}
|
}
|
||||||
|
|
||||||
function _machines-getAkey { # network
|
function _machines-getAkey { # network
|
||||||
|
_machines-ensurePub
|
||||||
KEY_FILE=$(mktemp)
|
KEY_FILE=$(mktemp)
|
||||||
SIGN_FILE=$(mktemp)
|
SIGN_FILE=$(mktemp)
|
||||||
_machines-api akey/$1 > $KEY_FILE
|
_machines-api akey/$1 > $KEY_FILE
|
||||||
|
@ -275,9 +284,6 @@ function machines-setup {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
_machines-ensurePub
|
_machines-ensurePub
|
||||||
if [ $? != 0 ]; then
|
|
||||||
return 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
read -p 'Machine name? ' name
|
read -p 'Machine name? ' name
|
||||||
|
|
|
@ -69,7 +69,7 @@ function replaceImg { # candidate original
|
||||||
else
|
else
|
||||||
echo "→ Candidate don't have the same bit map as original, skipping!"
|
echo "→ Candidate don't have the same bit map as original, skipping!"
|
||||||
fi
|
fi
|
||||||
rm "$ppmc" "$ppmo"
|
rm "$ppmc" "$ppmo" "$c"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ do
|
||||||
rm "$prog"
|
rm "$prog"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done <<< "$(find $dir -type f -iregex ".+.jpe?g$")"
|
done <<< "$(find "$dir" -type f -iregex ".+.jpe?g$")"
|
||||||
|
|
||||||
# PNG (requires optipng)
|
# PNG (requires optipng)
|
||||||
while read image
|
while read image
|
||||||
|
@ -112,7 +112,7 @@ do
|
||||||
|
|
||||||
replaceImg "$temp" "$image"
|
replaceImg "$temp" "$image"
|
||||||
|
|
||||||
done <<< "$(find $dir -type f -iname "*.png")"
|
done <<< "$(find "$dir" -type f -iname "*.png")"
|
||||||
|
|
||||||
# SVG (requires svgo)
|
# SVG (requires svgo)
|
||||||
while read image
|
while read image
|
||||||
|
@ -121,15 +121,15 @@ do
|
||||||
|
|
||||||
temp=$(mktemp --suffix .svg)
|
temp=$(mktemp --suffix .svg)
|
||||||
cp "$image" "$temp"
|
cp "$image" "$temp"
|
||||||
svgo --quiet "$temp"
|
svgo --quiet --config $HOME/.scripts/svgo.yml "$temp"
|
||||||
echo "→ Optimize done"
|
echo "→ Optimize done"
|
||||||
|
|
||||||
replaceImg "$temp" "$image"
|
replaceImg "$temp" "$image"
|
||||||
|
|
||||||
done <<< "$(find $dir -type f -iname "*.svg")"
|
done <<< "$(find "$dir" -type f -iname "*.svg")"
|
||||||
|
|
||||||
# GIT (requires git)
|
# GIT (requires git)
|
||||||
find $dir -type d -name .git -print0 | while IFS= read -r -d '' dir; do
|
find "$dir" -type d -name .git -print0 | while IFS= read -r -d '' dir; do
|
||||||
(cd "$dir"; git gc)
|
(cd "$dir"; git gc)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
5
scripts/svgo.yml
Normal file
5
scripts/svgo.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
plugins:
|
||||||
|
- mergePaths : false
|
||||||
|
- convertTransform : false
|
||||||
|
- cleanupNumericValues : false
|
||||||
|
|
Loading…
Reference in a new issue