diff --git a/010_generate-ssh.sh b/010_generate-ssh.sh index 7e734aa..11a70e2 100755 --- a/010_generate-ssh.sh +++ b/010_generate-ssh.sh @@ -3,42 +3,42 @@ # FIXME: Rather just creating these files in tmp move the actions into the loop blow. LOCAL_USER_EMAIL=cyteen@ring-zero.co.uk cat > /tmp/generate-ssh-key.sh << EOF -ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/id_rsa -ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/github_rsa -ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/devuan_rsa -ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/debian_rsa -ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ~/.ssh/gitlab_rsa +ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ${HOME}/.ssh/id_rsa +ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ${HOME}/.ssh/github_rsa +ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ${HOME}/.ssh/devuan_rsa +ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ${HOME}/.ssh/debian_rsa +ssh-keygen -t rsa -b 4096 -N '' -C "${LOCAL_USER_EMAIL}" -f ${HOME}/.ssh/gitlab_rsa EOF cat > /tmp/ssh-key-add.sh << EOF eval "$(ssh-agent -s)" -ssh-add ~/.ssh/id_rsa -ssh-add ~/.ssh/github_rsa -ssh-add ~/.ssh/devuan_rsa -ssh-add ~/.ssh/debian_rsa -ssh-add ~/.ssh/gitlab_rsa +ssh-add ${HOME}/.ssh/id_rsa +ssh-add ${HOME}/.ssh/github_rsa +ssh-add ${HOME}/.ssh/devuan_rsa +ssh-add ${HOME}/.ssh/debian_rsa +ssh-add ${HOME}/.ssh/gitlab_rsa EOF cat > /tmp/ssh-key-permissions.sh << EOF -chmod 700 ~/.ssh -chmod 644 ~/.ssh/authorized_keys -chmod 644 ~/.ssh/known_hosts -chmod 644 ~/.ssh/config -chmod 600 ~/.ssh/id_rsa -chmod 644 ~/.ssh/id_rsa.pub -chmod 600 ~/.ssh/gitlab_rsa -chmod 644 ~/.ssh/gitlab_rsa.pub -chmod 600 ~/.ssh/github_rsa -chmod 644 ~/.ssh/github_rsa.pub -chmod 600 ~/.ssh/devuan_rsa -chmod 644 ~/.ssh/devuan_rsa.pub -chmod 600 ~/.ssh/debian_rsa -chmod 644 ~/.ssh/debian_rsa.pub +chmod 700 ${HOME}/.ssh +chmod 644 ${HOME}/.ssh/authorized_keys +chmod 644 ${HOME}/.ssh/known_hosts +chmod 644 ${HOME}/.ssh/config +chmod 600 ${HOME}/.ssh/id_rsa +chmod 644 ${HOME}/.ssh/id_rsa.pub +chmod 600 ${HOME}/.ssh/gitlab_rsa +chmod 644 ${HOME}/.ssh/gitlab_rsa.pub +chmod 600 ${HOME}/.ssh/github_rsa +chmod 644 ${HOME}/.ssh/github_rsa.pub +chmod 600 ${HOME}/.ssh/devuan_rsa +chmod 644 ${HOME}/.ssh/devuan_rsa.pub +chmod 600 ${HOME}/.ssh/debian_rsa +chmod 644 ${HOME}/.ssh/debian_rsa.pub EOF ## Set preferred key for each # local gitlab -cat </dev/null +cat </dev/null Host git.ring-zero.co.uk User git @@ -47,7 +47,7 @@ Host git.ring-zero.co.uk EOF # gitlab -cat </dev/null +cat </dev/null Host gitlab.com User git @@ -56,7 +56,7 @@ Host gitlab.com EOF # github -cat </dev/null +cat </dev/null Host github.com User git @@ -65,7 +65,7 @@ Host github.com EOF # github -cat </dev/null +cat </dev/null Host git.devuan.org User git @@ -74,7 +74,7 @@ Host git.devuan.org EOF # debian -cat </dev/null +cat </dev/null Host salsa.debian.org User git @@ -103,5 +103,5 @@ ssh-keygen -A ssh-keygen -q -t rsa -N '' -f ${HOME}/.ssh/id_rsa 2>/dev/null <<< y >/dev/null # Do this for any server you want to connect to without interaction. -# ssh-keyscan git.ring-zero.co.uk >> ~/.ssh/known_hosts +# ssh-keyscan git.ring-zero.co.uk >> ${HOME}/.ssh/known_hosts diff --git a/020_tmux.sh b/020_tmux.sh index c5a2ab1..69f16e5 100755 --- a/020_tmux.sh +++ b/020_tmux.sh @@ -13,6 +13,30 @@ sudo apt install -y tmuxp # uses python rather than ruby used by tmuxinator. DEST=${1:-/etc/skel} # http://github.com/Netherdrake/Dotfiles/tree/master/config/tmux # wget -c --directory-prefix ~/.config/tmux/ https://raw.githubusercontent.com/Netherdrake/Dotfiles/master/config/tmux/default.sh + + +# Set tmux as the default login shell, reattach to existing sessions or start a new session with tmuxp if a yaml file is available or tmux if not. + +# First option: The only restriction placed on the login shell is that the command name must be listed in /etc/shells +#chsh ${USER} -s /usr/bin/tmux +##set-option -g default-shell "/usr/bin/zsh" # set below + +# Second option: a little more flexibility. +cat </dev/null; then + if [[ -z "$TMUX" ]]; then + if tmux has-session 2>/dev/null; then + exec tmux attach + elif [[ -f ${PWD}/.tmuxp.yml ]] && [[ command -v tmuxp>/dev/null ]];then + exec tmuxp load . + else + exec tmux + fi + fi +fi +EOF + mkdir -p "${DEST}"/.config/tmux cat > "${DEST}"/.config/tmux/default.sh <<'EOF' # Default Theme diff --git a/build_deb_from_dsc.sh b/build_deb_from_dsc.sh index c84dbe6..8e80df7 100755 --- a/build_deb_from_dsc.sh +++ b/build_deb_from_dsc.sh @@ -6,7 +6,7 @@ DSC_FILE=$2 apt install -y git-buildpackage equivs if [ "$1" == "-h" ]; then - echo "Usage: `basename $0` Takes a dsc url and builds and installs the result." + echo "Usage: `basename $0` Takes a builddir and a dsc url and builds and installs the result." exit 0 fi diff --git a/cpuscaling-ignore_ppc.sh b/cpuscaling-ignore_ppc.sh index 6fbb999..df801ce 100644 --- a/cpuscaling-ignore_ppc.sh +++ b/cpuscaling-ignore_ppc.sh @@ -1,4 +1,7 @@ #!/usr/bin/env zsh + +sudo apt-get install -y cpufrequtils + # Set ignore bios throttling on the kernel commandline #sed -i "s|^GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)\"|GRUB_CMDLINE_LINUX_DEFAULT=\"\1 processor.ignore_ppc=1\"|" /etc/default/grub @@ -23,3 +26,43 @@ done # set bios ignore for running kernel echo 1 > /sys/module/processor/parameters/ignore_ppc +## cpufreq commands +cpufreq-info --freq # 606464 +cpufreq-info --hwfreq +cpufreq-info --hwlimits # 800000 2401000 +cpufreq-info --driver # acpi-cpufreq +cpufreq-info --policy # 800000 800000 userspace +cpufreq-info --governors # conservative userspace powersave ondemand performance schedutil +cpufreq-info --related-cpus # 0 +cpufreq-info --affected-cpus # 0 +cpufreq-info --stats # 2401000:0, 2400000:0, 2000000:0, 1600000:0, 1200000:0, 800000:18825306% + +cpufreq-info --latency # 10000 +# cpufreq-info --proc +# minimum CPU frequency - maximum CPU frequency - governor +# CPU 0 800000 kHz ( 33 %) - 800000 kHz ( 33 %) - userspace +# CPU 1 800000 kHz ( 33 %) - 800000 kHz ( 33 %) - userspace + +cpufreq-info --cpu 1 +# cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009 +# Report errors and bugs to cpufreq@vger.kernel.org, please. +# analyzing CPU 1: +# driver: acpi-cpufreq +# CPUs which run at the same hardware frequency: 1 +# CPUs which need to have their frequency coordinated by software: 1 +# maximum transition latency: 10.0 us. +# hardware limits: 800 MHz - 2.40 GHz +# available frequency steps: 2.40 GHz, 2.40 GHz, 2.00 GHz, 1.60 GHz, 1.20 GHz, 800 MHz +# available cpufreq governors: conservative, userspace, powersave, ondemand, performance, schedutil +# current policy: frequency should be within 800 MHz and 800 MHz. +# The governor "userspace" may decide which speed to use +# within this range. +# current CPU frequency is 606 MHz. +# cpufreq stats: 2.40 GHz:0.00%, 2.40 GHz:0.00%, 2.00 GHz:0.00%, 1.60 GHz:0.00%, 1.20 GHz:0.00%, 800 MHz:100.00% (1) + +cpufreq-set \ + --cpu 2 \ + --min 800 \ + --max 1600 \ + --governor userspace \ +# --freq 1600