Skip to content

Instantly share code, notes, and snippets.

@sourcevault
Created October 14, 2021 10:02
Show Gist options
  • Save sourcevault/275c40ac230fdbb9b340367232bbf8ff to your computer and use it in GitHub Desktop.
Save sourcevault/275c40ac230fdbb9b340367232bbf8ff to your computer and use it in GitHub Desktop.
custom.zsh-theme
global:
port: 45
path: ""
username: pi
ssh: -tt -o LogLevel=QUIET -p {{global.port}}
remotehost: [email protected]
remotefold: ~/router
rsync: false
watch: false
verbose: 1
add-ssh:
local:
- ssh-copy-id {{remotehost}}
remote:
- chmod go-w /home/{{global.username}}
ssh45:
local:
- scp sshd_config {{remotehost}}:/tmp/sshd_config
remote:
- sudo mv /tmp/sshd_config /etc/ssh/sshd_config
- sudo systemctl restart ssh.service
install.zsh:
local:
- scp -P {{global.port}} install_oh_my_zsh.sh {{remotehost}}:/tmp
remote:
- sudo apt-get install zsh curl git -y
- sudo apt-get -y --fix-missing update && sudo apt-get -y --fix-missing
upgrade
- yes | sudo apt install runit-systemd
- yes | sudo apt-get install iptables-persistent
- rm -rf /home/pi/.oh-my-zsh
- sh /tmp/install_oh_my_zsh.sh --unattended
- sudo git clone https://github.com/zsh-users/zsh-autosuggestions
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
- sudo touch ~/.hushlogin
- chsh -s $(which zsh)
- sudo apt-get install hostapd -y
- sudo apt-get install dnsmasq -y
- sudo apt-get install lshw -y
- yes | sudo apt install samba -y
final:
- scp -P {{global.port}} .zshrc {{remotehost}}:~/.zshrc
- scp -P {{global.port}} custom.zsh-theme
{{remotehost}}:~/.oh-my-zsh/themes/custom.zsh-theme
install.wifi:
remote:
- sudo wget http://downloads.fars-robotics.net/wifi-drivers/install-wifi -O
/usr/bin/install-wifi
- sudo chmod +x /usr/bin/install-wifi
- sudo install-wifi -u 8188eu
- sudo install-wifi -u 8192eu
iptable.init:
description: copy iptable setting
local:
- scp -P {{global.port}} iptables.sh
{{remotehost}}:{{remotefold}}/iptables.sh
remote:
- sudo {{remotefold}}/iptables.sh
- sudo netfilter-persistent save
copy-dhcp-dns:
local:
- scp -P {{global.port}} dnsmasq.conf {{remotehost}}:/tmp/dnsmasq.conf
- scp -P {{global.port}} sysctl.conf {{remotehost}}:/tmp/sysctl.conf
- scp -P {{global.port}} dhcpcd.conf {{remotehost}}:/etc/dhcpcd.conf
remote:
- sudo mv /tmp/dnsmasq.conf /etc/dnsmasq.conf
- sudo mv /tmp/sysctl.conf /etc/sysctl.conf
- sudo systemctl daemon-reload
- sudo service dhcpcd restart
- sudo systemctl restart dnsmasq
hostapd.cp:
description:
- create a symbolic link to runit directory from workind directory.
- copy our hostapd setting to remote machine, and then create a log
directory for svlog.
rsync:
- src: hostapd
- des: "{{remotefold}}"
- archive
- recursive
- rsh: ssh -p {{global.port}}
remote:
- sudo ln -sf {{remotefold}}/hostapd /etc/service/hostapd
- sudo mkdir -p /var/log/hostapd
reboot:
remote:
- sudo reboot
shutdown:
remote:
- shutdown -h now
scp.send:
description: remote_file_name local_file_name
local:
- scp -P {{global.port}} {{1}} {{remotehost}}:/tmp/
remote:
- sudo mv /tmp/{{1}} {{0}}
scp.get:
description: remote_file_name local_file_name
local:
- scp -P {{global.port}} {{remotehost}}:{{0}} {{1}}
catr:
defarg: 1
remote:
- cat {{remotefold}}/{{0}}
cat:
defarg: 1
remote:
- sudo cat {{0}}
dnsmasq.status:
description: "check status of dnsmasq server, should be Active: active (running)."
remote:
- sudo systemctl status dnsmasq
dnsmasq.restart:
description: restart dnsmasq server.
remote:
- sudo systemctl restart dnsmasq
hostapd.start:
remote:
- sudo sv start hostapd
hostapd.stop:
remote:
- sudo sv stop hostapd
hostapd.log:
description: show hostapd logs.
remote:
- sudo tail -f /var/log/hostapd/current
hostapd.status:
description: show hostapd status.
remote:
- sudo sv status hostapd
wireless.list:
description: show wireless network interfaces.
remote:
- sudo iwconfig
usb-net-list:
description: show network hardware information.
remote:
- sudo lshw -c net
wireless.reset:
description: reset wireless interface.
defarg:
- wlan1
remote:
- sudo ifconfig {{0}} down
- sudo iwconfig
- sudo ifconfig {{0}} up
- sudo iwconfig
wireless.optchannel:
remote:
- sudo iwlist wlan0 scan | grep Frequency | sort | uniq -c | sort -n
udev.int:
local:
- remotemon -s scp.send /etc/udev/rules.d/99-local.rules 99-local.rules
remote:
- sudo udevadm control --reload-rules
- sudo systemctl daemon-reload
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/pi/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="custom"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git zsh-autosuggestions)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
PROMPT=' %{$fg_bold[white]%}%M %(!.%{$fg[red]%}.%{$fg[green]%})%~%{$fg_bold[blue]%}$(git_prompt_info)%{$reset_color%} '
ZSH_THEME_GIT_PROMPT_PREFIX="("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_DIRTY=" ✗"
ZSH_THEME_GIT_PROMPT_CLEAN=" ✔"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment