Delete unused files
This commit is contained in:
parent
08774bd180
commit
76547a5a20
@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
|
|
||||||
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>PATH</key>
|
|
||||||
<integer></integer>
|
|
||||||
<key></key>
|
|
||||||
<array/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
@ -1,80 +0,0 @@
|
|||||||
# Regular Colors
|
|
||||||
Black='\e[0;30m' # Black
|
|
||||||
Red='\e[0;31m' # Red
|
|
||||||
Green='\e[0;32m' # Green
|
|
||||||
Yellow='\e[0;33m' # Yellow
|
|
||||||
Blue='\e[0;34m' # Blue
|
|
||||||
Purple='\e[0;35m' # Purple
|
|
||||||
Cyan='\e[0;36m' # Cyan
|
|
||||||
White='\e[0;37m' # White
|
|
||||||
BoldYellow='\e[1;33m' # Yellow
|
|
||||||
Gray="\[\033[1;30m\]"
|
|
||||||
|
|
||||||
|
|
||||||
function current_directory() {
|
|
||||||
pwd | sed "s:$HOME:~:"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function git_prompt_info() {
|
|
||||||
if test -z $(git branch-or-sha);
|
|
||||||
then
|
|
||||||
echo ""
|
|
||||||
else
|
|
||||||
echo " $(separator "on") $(git branch-or-sha)$(git_status_character)"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function git_status_character() {
|
|
||||||
if git dirty;
|
|
||||||
then
|
|
||||||
print_with_color "✘" "$Red"
|
|
||||||
else
|
|
||||||
print_with_color "✔" "$Green"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function command_line_character() {
|
|
||||||
if ! test -z $(git branch-or-sha);
|
|
||||||
then
|
|
||||||
echo "±"
|
|
||||||
else
|
|
||||||
echo "○"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function prompt_basic_colors() {
|
|
||||||
export USERNAME_COLOR="$Green"
|
|
||||||
export SEPARATOR_COLOR="$Black"
|
|
||||||
export HOSTNAME_COLOR="$Blue"
|
|
||||||
export CURRENT_DIRECTORY_COLOR="$BoldYellow"
|
|
||||||
export SEPARATOR_COLOR="$Gray"
|
|
||||||
}
|
|
||||||
|
|
||||||
function print_with_color() {
|
|
||||||
echo "$2$1\e[0m"
|
|
||||||
}
|
|
||||||
|
|
||||||
function separator() {
|
|
||||||
print_with_color "$1" "$SEPARATOR_COLOR"
|
|
||||||
}
|
|
||||||
|
|
||||||
prompt_basic_colors
|
|
||||||
function set_bash_prompt() {
|
|
||||||
PS1="╭─$(print_with_color "$(whoami)" "$USERNAME_COLOR") $(separator "at") $(print_with_color "`hostname -s`" "$HOSTNAME_COLOR") $(separator "in") $(print_with_color "`current_directory`" "$CURRENT_DIRECTORY_COLOR")$(git_prompt_info)
|
|
||||||
╰─$(command_line_character) "
|
|
||||||
}
|
|
||||||
|
|
||||||
# export PROMPT_COMMAND=set_bash_prompt
|
|
||||||
|
|
||||||
PS2='(%_) '
|
|
||||||
|
|
||||||
case "$TERM" in
|
|
||||||
dumb)
|
|
||||||
export PS1='> '
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
function set_powerline_prompt {
|
|
||||||
source "$(python_module_path powerline)/bindings/bash/powerline.sh"
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/perl
|
|
||||||
# Quickly set ForceFullCompositionPipeline with nvidia-settings for all currently connected screens, useful for gamers seeing screen tear issues
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
# Grab xrandr output for parsing
|
|
||||||
my $xrandrOutput = `xrandr`;
|
|
||||||
|
|
||||||
# Filter all currently selected modes
|
|
||||||
my @modes = $xrandrOutput =~ /.*\sconnected.*/g;
|
|
||||||
die "Output didn't match expected format\n" if ( scalar @modes lt 1 );
|
|
||||||
my @newModes = ();
|
|
||||||
foreach my $mode ( @modes )
|
|
||||||
{
|
|
||||||
# Filter the current modes and add to list in right format
|
|
||||||
my @details = $mode =~ /(.*)\sconnected.*?(\d[^\s]+).*/g;
|
|
||||||
die "Output didn't match expected format\n" if ( scalar @details lt 2 );
|
|
||||||
push( @newModes, join( ":", @details ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
# Construct the new mode command
|
|
||||||
my $newModeCommand = "nvidia-settings --assign CurrentMetaMode='";
|
|
||||||
$newModeCommand .= "$_ { ForceFullCompositionPipeline = On }, " foreach ( @newModes );
|
|
||||||
$newModeCommand .= "'";
|
|
||||||
|
|
||||||
# Print and set our new mode
|
|
||||||
print "running \"$newModeCommand\"\n";
|
|
||||||
system( $newModeCommand );
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env sh
|
|
||||||
pkill "$1"
|
|
||||||
nohup "$@" >"/tmp/$1.out" 2>"/tmp/$1.error" &
|
|
@ -1,12 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
var lgtv = require("lgtv2")({
|
|
||||||
url: 'ws://10.0.0.136:3000'
|
|
||||||
});
|
|
||||||
|
|
||||||
lgtv.on('connect', function () {
|
|
||||||
console.log('connected');
|
|
||||||
lgtv.request('ssap://system/turnOff', function (err, res) {
|
|
||||||
lgtv.disconnect();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,57 +0,0 @@
|
|||||||
alias xup="xrdb ~/.Xresources"
|
|
||||||
alias tmux="tmux -2"
|
|
||||||
alias reload_tmux_conf="tmux source-file ~/.tmux.conf"
|
|
||||||
alias tmux_cb_to_remote_cb='tmux saveb - | linux_nc_paste_to_remote_clipboard'
|
|
||||||
alias fn='find . -name '
|
|
||||||
alias prj='cd ~/Projects'
|
|
||||||
alias t27='tox -e py27 -- '
|
|
||||||
alias tvenv='tox -e venv -- '
|
|
||||||
alias reload_tmux='tmux source-file ~/.tmux.conf'
|
|
||||||
alias ssh='ssh -A '
|
|
||||||
alias dusage='du -ch -d 0'
|
|
||||||
alias subl='reattach-to-user-namespace subl'
|
|
||||||
alias stack-profile='stack --work-dir .stack-work-profile --profile'
|
|
||||||
|
|
||||||
# enables the sudoing of aliases.
|
|
||||||
alias sudo='sudo '
|
|
||||||
|
|
||||||
# Detect which `ls` flavor is in use
|
|
||||||
if ls --color > /dev/null 2>&1; then # GNU `ls`
|
|
||||||
colorflag="--color"
|
|
||||||
else # OS X `ls`
|
|
||||||
colorflag="-G"
|
|
||||||
fi
|
|
||||||
alias ls="command ls ${colorflag}"
|
|
||||||
|
|
||||||
# IP addresses
|
|
||||||
alias externalip="dig +short myip.opendns.com @resolver1.opendns.com"
|
|
||||||
|
|
||||||
alias whois="whois -h whois-servers.net"
|
|
||||||
|
|
||||||
# View HTTP traffic
|
|
||||||
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
|
|
||||||
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
|
|
||||||
# The alias below is no longer needed when gnu readlink is on path as readlink
|
|
||||||
# command -v greadlink > /dev/null && alias readlink="greadlink"
|
|
||||||
|
|
||||||
# Merge PDF files
|
|
||||||
# Usage: `mergepdf -o output.pdf input{1,2,3}.pdf`
|
|
||||||
alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py'
|
|
||||||
|
|
||||||
# Disable Spotlight
|
|
||||||
alias spotoff="sudo mdutil -a -i off"
|
|
||||||
# Enable Spotlight
|
|
||||||
alias spoton="sudo mdutil -a -i on"
|
|
||||||
|
|
||||||
# One of @janmoesen’s ProTip™s
|
|
||||||
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
|
|
||||||
alias "$method"="lwp-request -m '$method'"
|
|
||||||
done
|
|
||||||
|
|
||||||
alias stfu="osascript -e 'set volume output muted true'"
|
|
||||||
alias pumpitup="osascript -e 'set volume 7'"
|
|
||||||
alias pip-upgrade="pip freeze --local | get_cols -F "=" 1 | xargs -n1 sudo pip install -U"
|
|
||||||
|
|
||||||
[[ -e /usr/local/Cellar/macvim ]] && alias vim="$(find /usr/local/Cellar/macvim -depth 1 | grep "[0-9]$")/MacVim.app/Contents/MacOS/Vim"
|
|
||||||
|
|
||||||
alias only_json='grep -E "^{\"" | jq .'
|
|
@ -1,207 +0,0 @@
|
|||||||
is_osx || return
|
|
||||||
|
|
||||||
function set_global_osx_ssh_port {
|
|
||||||
set_osx_ssh_port $1 /System/Library/LaunchDaemons/ssh.plist
|
|
||||||
}
|
|
||||||
|
|
||||||
function set_osx_ssh_port {
|
|
||||||
sudo sed -i -n "/SockServiceName/{p;n;s/>.*</>$1</;};p" $2; echo "SSH Port $1. Restart service for changes to take effect."
|
|
||||||
}
|
|
||||||
|
|
||||||
function enable_access_for_assistive_devices {
|
|
||||||
local bundle_identifier=$(/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' "$1/Contents/Info.plist")
|
|
||||||
local where_clause="where service='kTCCServiceAccessibility' and client='$bundle_identifier'"
|
|
||||||
local search_string="SELECT * from access ${where_clause};"
|
|
||||||
local values_string="VALUES('kTCCServiceAccessibility','$bundle_identifier',0,1,1,NULL)"
|
|
||||||
if test -z $(sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' "$search_string");
|
|
||||||
then
|
|
||||||
local sql_string="INSERT INTO access $values_string;"
|
|
||||||
else
|
|
||||||
local sql_string="UPDATE access set allowed = 1 ${where_clause};"
|
|
||||||
fi
|
|
||||||
echo "$sql_string"
|
|
||||||
sudo sqlite3 '/Library/Application Support/com.apple.TCC/TCC.db' "$sql_string"
|
|
||||||
}
|
|
||||||
|
|
||||||
function as_user {
|
|
||||||
local user="$1"
|
|
||||||
local user_pid=$(ps -axj | awk "/^$user / {print \$2;exit}")
|
|
||||||
local command="sudo /bin/launchctl bsexec $user_pid sudo -u '$user' $2"
|
|
||||||
echo "$command"
|
|
||||||
eval $command
|
|
||||||
}
|
|
||||||
|
|
||||||
function as_current_user {
|
|
||||||
as_user "$(whoami)" "$*"
|
|
||||||
}
|
|
||||||
|
|
||||||
function reload_user_agent {
|
|
||||||
as_current_user /bin/launchctl unload "$1"
|
|
||||||
as_current_user /bin/launchctl load "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
function reload_all_user_agents {
|
|
||||||
sudo -v
|
|
||||||
for agent in $(find -f ~/Library/LaunchAgents); do
|
|
||||||
reload_user_agent $agent
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function reload_root_agent {
|
|
||||||
as_user 'root' "/bin/launchctl unload '$1'"
|
|
||||||
as_user 'root' "/bin/launchctl load '$1'"
|
|
||||||
}
|
|
||||||
|
|
||||||
function brew_for_multiple_users() {
|
|
||||||
sudo chgrp -R admin /usr/local
|
|
||||||
sudo chmod -R g+w /usr/local
|
|
||||||
sudo chgrp -R admin /Library/Caches/Homebrew
|
|
||||||
sudo chmod -R g+w /Library/Caches/Homebrew
|
|
||||||
}
|
|
||||||
|
|
||||||
function swap_audio() {
|
|
||||||
test -z $(SwitchAudioSource -c | grep HDMI) && SwitchAudioSource -s HDMI || SwitchAudioSource -s "Built-in Output"
|
|
||||||
}
|
|
||||||
|
|
||||||
function ss() {
|
|
||||||
osascript -e "tell application \"/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app\" to activate"
|
|
||||||
}
|
|
||||||
|
|
||||||
function set_modifier_keys_for_vendor_product_id() {
|
|
||||||
local mapping="<dict><key>HIDKeyboardModifierMappingSrc</key><integer>$2</integer><key>HIDKeyboardModifierMappingDst</key><integer>$3</integer></dict>"
|
|
||||||
echo $mapping
|
|
||||||
defaults -currentHost write -g com.apple.keyboard.modifiermapping.$1-0 -array-add "$mapping"
|
|
||||||
}
|
|
||||||
|
|
||||||
function set_modifier_keys_on_all_keyboards() {
|
|
||||||
for vendor_product_id in $(get_keyboard_vendor_id_product_id_pairs | tr " " "-"); do
|
|
||||||
set_modifier_keys_for_vendor_product_id $vendor_product_id 0 2; echo $vendor_product_id;
|
|
||||||
done;
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_keyboard_vendor_id_product_id_pairs() {
|
|
||||||
ioreg -n IOHIDKeyboard -r | grep -e 'class IOHIDKeyboard' -e VendorID\" -e Product | gawk 'BEGIN { RS = "class IOHIDKeyboard" } match($0, /VendorID. = ([0-9]*)/, arr) { printf arr[1]} match($0, /ProductID. = ([0-9]*)/, arr) { printf " %s\n", arr[1]} '
|
|
||||||
}
|
|
||||||
|
|
||||||
function set_osx_hostname() {
|
|
||||||
local new_hostname="${1-imalison}"
|
|
||||||
sudo scutil --set ComputerName $new_hostname
|
|
||||||
sudo scutil --set HostName $new_hostname
|
|
||||||
sudo scutil --set LocalHostName $new_hostname
|
|
||||||
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $new_hostname
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_bundle_identifier() {
|
|
||||||
defaults read "$1/Contents/Info" CFBundleIdentifier
|
|
||||||
}
|
|
||||||
|
|
||||||
_BUDDY="/usr/libexec/PlistBuddy"
|
|
||||||
_PLIST="$HOME/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist"
|
|
||||||
|
|
||||||
function create_filename_rule {
|
|
||||||
$_BUDDY -c "Add LSHandlers:0 dict" $_PLIST
|
|
||||||
$_BUDDY -c "Add LSHandlers:0:LSHandlerRoleAll string $1" $_PLIST
|
|
||||||
$_BUDDY -c "Add LSHandlers:0:LSHandlerContentTag string $2" $_PLIST
|
|
||||||
$_BUDDY -c "Add LSHandlers:0:LSHandlerContentTagClass string public.filename-extension" $_PLIST
|
|
||||||
$_BUDDY -c "Add LSHandlers:0:LSHandlerPreferredVersions dict" $_PLIST
|
|
||||||
$_BUDDY -c "Add LSHandlers:0:LSHandlerPreferredVersions:LSHandlerRoleAll string -" $_PLIST
|
|
||||||
}
|
|
||||||
|
|
||||||
function set_application_for_file_extension() {
|
|
||||||
local PLIST="$HOME/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist"
|
|
||||||
|
|
||||||
# the key to match with the desired value
|
|
||||||
KEY="LSHandlerContentType"
|
|
||||||
|
|
||||||
# the value for which we'll replace the handler
|
|
||||||
VALUE="${1-public.plain-text}"
|
|
||||||
|
|
||||||
# the new handler for all roles
|
|
||||||
HANDLER="${2}"
|
|
||||||
|
|
||||||
$_BUDDY -c 'Print "LSHandlers"' $_PLIST >/dev/null 2>&1
|
|
||||||
if [[ $? -ne 0 ]] ; then
|
|
||||||
echo "There is no LSHandlers entry in $_PLIST" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
declare -i I=0
|
|
||||||
while [ true ] ; do
|
|
||||||
$_BUDDY -c "Print LSHandlers:$I" $_PLIST >/dev/null 2>&1
|
|
||||||
[[ $? -eq 0 ]] || { echo "Finished, no $VALUE found, setting it to $HANDLER" ; create_entry ; exit ; }
|
|
||||||
|
|
||||||
OUT="$( $_BUDDY -c "Print 'LSHandlers:$I:$KEY'" $_PLIST 2>/dev/null )"
|
|
||||||
if [[ $? -ne 0 ]] ; then
|
|
||||||
I=$I+1
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
CONTENT=$( echo "$OUT" )
|
|
||||||
if [[ $CONTENT = $VALUE ]] ; then
|
|
||||||
echo "Replacing $CONTENT handler with $HANDLER"
|
|
||||||
$_BUDDY -c "Delete 'LSHandlers:$I'" $_PLIST
|
|
||||||
create_entry
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
I=$I+1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function reload_preferences {
|
|
||||||
killall -u $(whoami) cfprefsd
|
|
||||||
}
|
|
||||||
|
|
||||||
function disable_proxy(){
|
|
||||||
sudo networksetup -setsocksfirewallproxystate Wi-Fi off
|
|
||||||
sudo networksetup -setsocksfirewallproxystate Ethernet off
|
|
||||||
echo "SOCKS proxy disabled."
|
|
||||||
}
|
|
||||||
|
|
||||||
function socks_proxy {
|
|
||||||
trap disable_proxy EXIT
|
|
||||||
sudo networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 9999
|
|
||||||
sudo networksetup -setsocksfirewallproxy Ethernet 127.0.0.1 9999
|
|
||||||
sudo networksetup -setsocksfirewallproxystate Wi-Fi on
|
|
||||||
sudo networksetup -setsocksfirewallproxystate Ethernet on
|
|
||||||
echo "SOCKS proxy enabled."
|
|
||||||
echo "Tunneling..."
|
|
||||||
echo "$@"
|
|
||||||
ssh -CND 9999 "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
function clear_dock {
|
|
||||||
defaults write com.apple.dock persistent-apps -array
|
|
||||||
}
|
|
||||||
|
|
||||||
function resistance_game_start {
|
|
||||||
say "everyone close their eyes."
|
|
||||||
sleep 4
|
|
||||||
say "spies open their eyes"
|
|
||||||
sleep 4
|
|
||||||
say "spies close their eyes"
|
|
||||||
sleep 4
|
|
||||||
say "everyone open their eyes"
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_screen_by_index {
|
|
||||||
cscreen | head -n -1 | tail -n +2 | filter_by_column_value 2 "$1" | get_cols 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_main_screen {
|
|
||||||
cscreen -i "$(get_screen_by_index "$1")" -p
|
|
||||||
}
|
|
||||||
|
|
||||||
function swap_main_screen {
|
|
||||||
make_main_screen 2
|
|
||||||
}
|
|
||||||
|
|
||||||
function swap_mirror_swap {
|
|
||||||
mirror -off && swap_main_screen && mirror -on
|
|
||||||
}
|
|
||||||
|
|
||||||
function brew_relink {
|
|
||||||
brew unlink "$1" && brew link "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:
|
|
@ -1,41 +0,0 @@
|
|||||||
REMOTE_CLIPBOARD_PORT='1234'
|
|
||||||
|
|
||||||
alias rc_ssh="ssh -R 1234:localhost:1234 "
|
|
||||||
|
|
||||||
function remote_clipboard_server() {
|
|
||||||
while [ 1 ]
|
|
||||||
do
|
|
||||||
ncat -l -p ${1-$REMOTE_CLIPBOARD_PORT} -e "pbcopy"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function remote_clipboard_server_daemon() {
|
|
||||||
daemonize `which reattach-to-user-namespace` -l $SHELL -c "source ~/.zshrc; remote_clipboard_server"
|
|
||||||
}
|
|
||||||
|
|
||||||
function _linux_nc_paste_to_remote_clipboard() {
|
|
||||||
nc localhost ${1-$REMOTE_CLIPBOARD_PORT} -q 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function _osx_nc_paste_to_remote_clipboard() {
|
|
||||||
nc localhost ${1-$REMOTE_CLIPBOARD_PORT}
|
|
||||||
}
|
|
||||||
|
|
||||||
function remote_os_copy() {
|
|
||||||
if is_osx;
|
|
||||||
then
|
|
||||||
_osx_nc_paste_to_remote_clipboard
|
|
||||||
|
|
||||||
else
|
|
||||||
_linux_nc_write_remote_clipboard
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function smart_copy() {
|
|
||||||
if is_ssh;
|
|
||||||
then
|
|
||||||
remote_os_copy
|
|
||||||
else
|
|
||||||
oscopy
|
|
||||||
fi
|
|
||||||
}
|
|
@ -1,83 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# acquired courtesy of
|
|
||||||
# http://superuser.com/questions/141044/sharing-the-same-ssh-agent-among-multiple-login-sessions#answer-141241
|
|
||||||
|
|
||||||
function sshag_findsockets {
|
|
||||||
find /tmp -uid $(id -u) -type s -name agent.\* 2>/dev/null
|
|
||||||
}
|
|
||||||
|
|
||||||
function sshag_testsocket {
|
|
||||||
if [ ! -x "$(which ssh-add)" ] ; then
|
|
||||||
echo "ssh-add is not available; agent testing aborted" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ X"$1" != X ] ; then
|
|
||||||
export SSH_AUTH_SOCK=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ X"$SSH_AUTH_SOCK" = X ] ; then
|
|
||||||
return 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -S $SSH_AUTH_SOCK ] ; then
|
|
||||||
ssh-add -l > /dev/null
|
|
||||||
if [ $? = 2 ] ; then
|
|
||||||
echo "Socket $SSH_AUTH_SOCK is dead! Deleting!" >&2
|
|
||||||
rm -f $SSH_AUTH_SOCK
|
|
||||||
return 4
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$SSH_AUTH_SOCK is not a socket!" >&2
|
|
||||||
return 3
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
function sshag_init {
|
|
||||||
# ssh agent sockets can be attached to a ssh daemon process or an
|
|
||||||
# ssh-agent process.
|
|
||||||
|
|
||||||
AGENTFOUND=0
|
|
||||||
|
|
||||||
# Attempt to find and use the ssh-agent in the current environment
|
|
||||||
if sshag_testsocket ; then AGENTFOUND=1 ; fi
|
|
||||||
|
|
||||||
# If there is no agent in the environment, search /tmp for
|
|
||||||
# possible agents to reuse before starting a fresh ssh-agent
|
|
||||||
# process.
|
|
||||||
if [ $AGENTFOUND = 0 ] ; then
|
|
||||||
for agentsocket in $(sshag_findsockets) ; do
|
|
||||||
if [ $AGENTFOUND != 0 ] ; then break ; fi
|
|
||||||
if sshag_testsocket $agentsocket ; then AGENTFOUND=1 ; fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If at this point we still haven't located an agent, it's time to
|
|
||||||
# start a new one
|
|
||||||
if [ $AGENTFOUND = 0 ] ; then
|
|
||||||
eval `ssh-agent`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
unset AGENTFOUND
|
|
||||||
unset agentsocket
|
|
||||||
|
|
||||||
{ echo "Keys:"; ssh-add -l | sed 's/^/ /'; } >&2
|
|
||||||
|
|
||||||
# Display the found socket
|
|
||||||
echo $SSH_AUTH_SOCK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# If we are not being sourced, but rather running as a subshell,
|
|
||||||
# let people know how to use the output.
|
|
||||||
if [[ $0 =~ sshag ]]; then
|
|
||||||
echo 'Output should be assigned to the environment variable $SSH_AUTH_SOCK.' >&2
|
|
||||||
sshag_init
|
|
||||||
# Otherwise, make it convenient to invoke the search.
|
|
||||||
# When the alias is invoked, it will modify the shell environment.
|
|
||||||
else
|
|
||||||
alias sshag="sshag_init"
|
|
||||||
fi
|
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"libs": [
|
|
||||||
"browser",
|
|
||||||
"jquery"
|
|
||||||
],
|
|
||||||
"plugins": {
|
|
||||||
"nodejs": {},
|
|
||||||
"requirejs": {
|
|
||||||
"baseURL": "./",
|
|
||||||
"paths": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
cache: false
|
|
||||||
aliases:
|
|
||||||
lr: Living room lights
|
|
@ -1,106 +0,0 @@
|
|||||||
Config {
|
|
||||||
|
|
||||||
-- appearance
|
|
||||||
font = "xft:Bitstream Vera Sans Mono:size=9:bold:antialias=true"
|
|
||||||
, bgColor = "black"
|
|
||||||
, fgColor = "#646464"
|
|
||||||
, position = Top
|
|
||||||
, border = BottomB
|
|
||||||
, borderColor = "#646464"
|
|
||||||
|
|
||||||
-- layout
|
|
||||||
, sepChar = "%" -- delineator between plugin names and straight text
|
|
||||||
, alignSep = "}{" -- separator between left-right alignment
|
|
||||||
, template = "%multicpu% | %coretemp% | %memory% | %dynnetwork% }{ %RJTT% | %date% || %kbd% "
|
|
||||||
|
|
||||||
-- general behavior
|
|
||||||
, lowerOnStart = True -- send to bottom of window stack on start
|
|
||||||
, hideOnStart = False -- start with window unmapped (hidden)
|
|
||||||
, allDesktops = True -- show on all desktops
|
|
||||||
, overrideRedirect = True -- set the Override Redirect flag (Xlib)
|
|
||||||
, pickBroadest = False -- choose widest display (multi-monitor)
|
|
||||||
, persistent = True -- enable/disable hiding (True = disabled)
|
|
||||||
|
|
||||||
-- plugins
|
|
||||||
-- Numbers can be automatically colored according to their value. xmobar
|
|
||||||
-- decides color based on a three-tier/two-cutoff system, controlled by
|
|
||||||
-- command options:
|
|
||||||
-- --Low sets the low cutoff
|
|
||||||
-- --High sets the high cutoff
|
|
||||||
--
|
|
||||||
-- --low sets the color below --Low cutoff
|
|
||||||
-- --normal sets the color between --Low and --High cutoffs
|
|
||||||
-- --High sets the color above --High cutoff
|
|
||||||
--
|
|
||||||
-- The --template option controls how the plugin is displayed. Text
|
|
||||||
-- color can be set by enclosing in <fc></fc> tags. For more details
|
|
||||||
-- see http://projects.haskell.org/xmobar/#system-monitor-plugins.
|
|
||||||
, commands =
|
|
||||||
|
|
||||||
-- weather monitor
|
|
||||||
[ Run Weather "RJTT" [ "--template", "<skyCondition> | <fc=#4682B4><tempC></fc>°C | <fc=#4682B4><rh></fc>% | <fc=#4682B4><pressure></fc>hPa"
|
|
||||||
] 36000
|
|
||||||
|
|
||||||
-- network activity monitor (dynamic interface resolution)
|
|
||||||
, Run DynNetwork [ "--template" , "<dev>: <tx>kB/s|<rx>kB/s"
|
|
||||||
, "--Low" , "1000" -- units: B/s
|
|
||||||
, "--High" , "5000" -- units: B/s
|
|
||||||
, "--low" , "darkgreen"
|
|
||||||
, "--normal" , "darkorange"
|
|
||||||
, "--high" , "darkred"
|
|
||||||
] 10
|
|
||||||
|
|
||||||
-- cpu activity monitor
|
|
||||||
, Run MultiCpu [ "--template" , "Cpu: <total0>%|<total1>%"
|
|
||||||
, "--Low" , "50" -- units: %
|
|
||||||
, "--High" , "85" -- units: %
|
|
||||||
, "--low" , "darkgreen"
|
|
||||||
, "--normal" , "darkorange"
|
|
||||||
, "--high" , "darkred"
|
|
||||||
] 10
|
|
||||||
|
|
||||||
-- cpu core temperature monitor
|
|
||||||
, Run CoreTemp [ "--template" , "Temp: <core0>°C|<core1>°C"
|
|
||||||
, "--Low" , "70" -- units: °C
|
|
||||||
, "--High" , "80" -- units: °C
|
|
||||||
, "--low" , "darkgreen"
|
|
||||||
, "--normal" , "darkorange"
|
|
||||||
, "--high" , "darkred"
|
|
||||||
] 50
|
|
||||||
|
|
||||||
-- memory usage monitor
|
|
||||||
, Run Memory [ "--template" ,"Mem: <usedratio>%"
|
|
||||||
, "--Low" , "20" -- units: %
|
|
||||||
, "--High" , "90" -- units: %
|
|
||||||
, "--low" , "darkgreen"
|
|
||||||
, "--normal" , "darkorange"
|
|
||||||
, "--high" , "darkred"
|
|
||||||
] 10
|
|
||||||
|
|
||||||
-- battery monitor
|
|
||||||
, Run Battery [ "--template" , "Batt: <acstatus>"
|
|
||||||
, "--Low" , "10" -- units: %
|
|
||||||
, "--High" , "80" -- units: %
|
|
||||||
, "--low" , "darkred"
|
|
||||||
, "--normal" , "darkorange"
|
|
||||||
, "--high" , "darkgreen"
|
|
||||||
|
|
||||||
, "--" -- battery specific options
|
|
||||||
-- discharging status
|
|
||||||
, "-o" , "<left>% (<timeleft>)"
|
|
||||||
-- AC "on" status
|
|
||||||
, "-O" , "<fc=#dAA520>Charging</fc>"
|
|
||||||
-- charged status
|
|
||||||
, "-i" , "<fc=#006000>Charged</fc>"
|
|
||||||
] 50
|
|
||||||
|
|
||||||
-- time and date indicator
|
|
||||||
-- (%F = y-m-d date, %a = day of week, %T = h:m:s time)
|
|
||||||
, Run Date "<fc=#ABABAB>%F (%a) %r</fc>" "date" 10
|
|
||||||
|
|
||||||
-- keyboard layout indicator
|
|
||||||
, Run Kbd [ ("us(dvorak)" , "<fc=#00008B>DV</fc>")
|
|
||||||
, ("us" , "<fc=#8B0000>US</fc>")
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user