Skip to content

Commit

Permalink
merge conf
Browse files Browse the repository at this point in the history
  • Loading branch information
antipasta committed May 12, 2020
2 parents b9d6217 + 962af16 commit 4c9e260
Show file tree
Hide file tree
Showing 13 changed files with 204 additions and 41 deletions.
64 changes: 51 additions & 13 deletions bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export HISTSIZE=30000
export HISTTIMEFORMAT='%F %T '

PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
#export TERM=xterm-256color
export TERM=screen-256color
export TERM=xterm-256color


## for when ssh agent gets screwy
Expand All @@ -25,14 +24,23 @@ if [[ -n $TMUX ]]; then
fi
}

function vpndocker() {
if [[ `stat -c '%a' /dev/net/tun` == '660' ]]; then
docker "$@"
else
echo 'lxc config device add penguin tun unix-char path=/dev/net/tun' | xclip -selection c
echo 'no access to /dev/net/tun'
fi
}

ec2-info() {
IP=169.254.169.254
ssh $1 "curl -q http://$IP/latest/meta-data/$2" 2>/dev/null
echo -ne "\n"
}
export EDITOR=vim
export GOPATH=$HOME/code/go
export PATH=$HOME/bin:$HOME/bin/fzf/bin/:$HOME/gobin/go/bin/:/usr/local/go/bin:$HOME/perl5/bin:/usr/sbin/:$GOPATH/bin:$HOME/Library/Python/2.7/bin:$HOME/bin/vim/vim-8.0.1481/bin/bin/:$PATH
export PATH=$HOME/bin:$HOME/bin/fzf/bin/:$HOME/gobin/go/bin/:/usr/local/go/bin:$HOME/perl5/bin:/usr/sbin/:$GOPATH/bin:$HOME/Library/Python/2.7/bin:$HOME/bin/vim/vim-8.0.1481/bin/bin/:/usr/local/MacGPG2/bin/:/usr/local/bin/::$HOME/dotfiles/bin/:$PATH
[ -f $HOME/perl5/lib/perl5/Devel/Local.pm ] && source `which devel-local.sh`
function github() {
git clone [email protected]:SocialFlowDev/$1.git
Expand Down Expand Up @@ -73,7 +81,7 @@ elif command -v ack-grep >/dev/null 2>&1; then
fi
[ -f /home/joe/dotfiles/additional_options ] && . /home/joe/dotfiles/additional_options
export GOPATH=$HOME/code/go
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOPATH/bin:$HOME/.local/bin
export PERLBREW_ROOT=$HOME/perlbrew
function refresh_gpga() {
if [ -f "${HOME}/.gpg-agent-info" ]; then
Expand All @@ -99,15 +107,15 @@ fd() {
cd "$dir"
}

if [ -x "$(command -v gpg-agent)" ]; then
if pgrep -x "gpg-agent" > /dev/null
then
export SSH_AUTH_SOCK=${HOME}/.gnupg/S.gpg-agent.ssh
else
eval $(gpg-agent --daemon --enable-ssh-support --sh)
fi
fi

#if [ -x "$(command -v gpg-agent)" ]; then
# if pgrep -x "gpg-agent" > /dev/null
# then
# export SSH_AUTH_SOCK=${HOME}/.gnupg/S.gpg-agent.ssh
# else
# eval $(gpg-agent --daemon --enable-ssh-support --sh)
# fi
#fi
#


function toggle-agent {
Expand All @@ -121,3 +129,33 @@ function toggle-agent {

}
export GO111MODULE=auto

qq() {
clear

logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi

if [[ ! -f "$logpath" ]]; then
echo 'Q LOG' > "$logpath"
fi

tail -100f -- "$logpath"
}

rmqq() {
logpath="$TMPDIR/q"
if [[ -z "$TMPDIR" ]]; then
logpath="/tmp/q"
fi
if [[ -f "$logpath" ]]; then
rm "$logpath"
fi
qq
}
function vpnotp() {
echo -n 'Enter keepass pw: ';
~/tmp/squashfs-root/usr/bin/keepassxc-cli show ~/dropbox/keepass/keepass2.kdbx $1 -q -t -a Password | tr -d '\n' | xclip -selection c
}
9 changes: 9 additions & 0 deletions bin/pcat.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env perl
use strict;
use warnings;

my $a = $ARGV[0];
my ($host,$port) = split(/:/,$a);
warn $host;
my $vpn = ($host =~ /mars.sfsrv.net/) ? 'marsvpn' : 'saturnvpn';
`socat TCP-LISTEN:$port,reuseaddr,fork 'EXEC:docker exec -i $vpn "nc $host $port"'`;
53 changes: 53 additions & 0 deletions bin/rclone.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env perl
use IPC::System::Simple qw(system systemx capture capturex);
use JSON::XS;
use DateTime::Format::ISO8601;
use File::Path qw(make_path);
my $json = JSON::XS->new;
my @remotes = qw/remote gdrive/;

sub get_modified {
my $file = shift;
my $output = capture( "rclone", "lsjson", $file );
my $decoded = $json->decode($output);
my $modified = $decoded->[0]->{ModTime};
my $dt = DateTime::Format::ISO8601->parse_datetime($modified);
return $dt;
}

sub copy_file {
my ( $src, $dest ) = @_;
return capturex( "rclone", "-v", "copy", $src, $dest );
}

my $local_dir = $ENV{HOME} . "/dropbox/keepass";
my $backup_dir = "$local_dir/bak";
my $local_path = "$local_dir/keepass2.kdbx";
my $local_mod = get_modified($local_path);

for my $remote (@remotes) {
my $remote_dir = sprintf( "%s:keepass", $remote );
my $remote_path = sprintf( "%s/keepass2.kdbx", $remote_dir );
my $remote_mod = get_modified($remote_path);
my $diff = $remote_mod->epoch - $local_mod->epoch;

next unless (abs($diff) > 5);
if ( $diff >= 0 ) {
my $datestamp = capturex( "date", "+%F-%H%M%S" );
chomp($datestamp);
my $conflict_path =
$backup_dir . "/" . join( '-', $remote, $datestamp );
make_path($conflict_path);
warn
"[$remote] WARNING: Remote file is newer than local file by $diff seconds, copying from remote to $conflict_path";
warn "See if there were any local modifications after $remote_mod";
my $out = copy_file( $remote_dir, $conflict_path );
print $out . "\n";
next;
}
warn sprintf( "[$remote] Local file is newer by %d seconds", abs($diff) );
my $out = copy_file( $local_path, $remote_dir );
print $out . "\n";
}

exit 0;
2 changes: 1 addition & 1 deletion etc/gpg-agent.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enable-ssh-support
pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac
pinentry-program /usr/bin/pinentry-qt
default-cache-ttl 86400
max-cache-ttl 86400
6 changes: 3 additions & 3 deletions gitconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[user]
email = [email protected]
name = Joe Papperello
email = [email protected]
[color]
diff = auto
ui = true
Expand All @@ -9,9 +9,9 @@
taghistory = log --tags --simplify-by-decoration --pretty=format:'%ai %d %an'
uncommit = reset --soft HEAD^
onstage = diff --staged
url =! bash -c 'git config --get remote.origin.url | sed -E "s/.+:\\(.+\\)\\.git$/https:\\\\/\\\\/github\\\\.com\\\\/\\\\1/g"'
currentbranch = rev-parse --abbrev-ref HEAD
tagrelease = !git tag -a v$(date -u +%y.%m.%d.%H%M%S) -m 'release tag'
[rerere]
enabled = true
[url "[email protected]:"]
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
4 changes: 4 additions & 0 deletions gpg-agent.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
enable-ssh-support
pinentry-program /usr/local/MacGPG2/libexec/pinentry-mac.app/Contents/MacOS/pinentry-mac
default-cache-ttl 86400
max-cache-ttl 86400
2 changes: 2 additions & 0 deletions inputrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"\e\e[D": backward-word
"\e\e[C": forward-word
1 change: 1 addition & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ DIR="$(pwd)"
ln -sf "$DIR/vim-colors/molokaimod.vim" "$HOME/.vim/colors/molokaimod.vim"
ln -sf "$DIR/vim-autoload" "$HOME/.vim/autoload"
ln -sf "$DIR/etc/gpg-agent.conf" "$HOME/.gnupg/gpg-agent.conf"
ln -sf "$DIR/inputrc" "$HOME/.inputrc"
1 change: 1 addition & 0 deletions setup_bashrc.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
DIR="$(pwd)"
echo "[ -f $DIR/bashrc ] && . $DIR/bashrc" >> ~/.bashrc
echo "[ -f $DIR/bashrc ] && . $DIR/bashrc" >> ~/.bash_profile
31 changes: 28 additions & 3 deletions ssh-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Host *.priv.sf
User appuser
ConnectTimeout 30
#ProxyCommand ssh -p2222 -o VisualHostKey=no root@localhost nc -q0 %h %p 2>/dev/null
ProxyCommand docker exec -i prodvpn nc -q0 %h %p 2>/dev/null
#ProxyCommand docker exec -i prodvpn nc -q0 %h %p 2>/dev/null
StrictHostKeyChecking false
KbdInteractiveAuthentication false

Expand All @@ -14,6 +14,22 @@ Host *.mars.sfsrv.net
StrictHostKeyChecking false
KbdInteractiveAuthentication false

Host 20.0.*.*
User appuser
ConnectTimeout 30
ProxyCommand ~/dotfiles/script/vpnnc.sh marsvpn %h %p
StrictHostKeyChecking false
KbdInteractiveAuthentication false

Host 10.125.*.*
User appuser
ConnectTimeout 30
ProxyCommand ~/dotfiles/script/vpnnc.sh saturnvpn %h %p
StrictHostKeyChecking false
KbdInteractiveAuthentication false



Host *.saturn.sfsrv.net
User appuser
ConnectTimeout 30
Expand All @@ -22,6 +38,15 @@ Host *.saturn.sfsrv.net
StrictHostKeyChecking false
KbdInteractiveAuthentication false

Host 54.164.21.74
User appuser
ConnectTimeout 30
#ProxyCommand docker exec -i saturnvpn nc -q0 %h %p 2>/dev/null
ProxyCommand ~/dotfiles/script/vpnnc.sh saturnvpn %h %p
StrictHostKeyChecking false
KbdInteractiveAuthentication false




Host *.sflow.us
Expand All @@ -45,8 +70,8 @@ Host joe2.home.saturn.sfsrv.net
ConnectTimeout 30
StrictHostKeyChecking false
KbdInteractiveAuthentication false
LocalForward *:5432 pg-site.dev.saturn.sfsrv.net:5432
LocalForward *:7006 redis-2.dev.saturn.sfsrv.net:7006
#LocalForward *:5432 pg-site.dev.saturn.sfsrv.net:5432
#LocalForward *:7006 redis-2.dev.saturn.sfsrv.net:7006


#Host *.saturn.sflow.us
Expand Down
17 changes: 8 additions & 9 deletions tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ set -g status-right '#[fg=colour245] %R %d %b #[fg=colour235,bg=colour252,bold]

set -g default-terminal "screen-256color"
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
#bind-key -t vi-copy 'v' begin-selection
#bind-key -t vi-copy 'y' copy-selection
setw -g monitor-activity on

## Mouse stuff
Expand All @@ -37,7 +37,7 @@ setw -g monitor-activity on


# Decrease the timeout when moving between windows using arrow keys
set-option repeat-time 100
#set-option repeat-time 100


# force a reload of the config file
Expand All @@ -58,11 +58,10 @@ bind - split-window -v
bind h split-window -h
bind v split-window -v
unbind C-p
unbind C-P
bind C-p run " tmux show-buffer | nopaste --private"
bind N run " tmux show-buffer | nopaste --private"
#bind C-P run " tmux show-buffer | ssh -p 12344 [email protected] 'pbcopy' "
bind P run " tmux show-buffer | ssh -p 12344 [email protected] 'pbcopy' "
bind C-p run " tmux show-buffer | xclip -selection clipboard -i >/dev/null"
#bind-key -t vi-copy y copy-pipe 'xclip -selection clipboard >/dev/null'



### Trying maximize functionality..
unbind +
Expand All @@ -89,7 +88,7 @@ bind k next-window

unbind @
bind @ command-prompt -p "join pane to:" "join-pane -t '%%'"
if-shell "uname | grep -q Darwin" "set-option -g default-command \"reattach-to-user-namespace -l bash\""
#if-shell "uname | grep -q Darwin" "set-option -g default-command \"reattach-to-user-namespace -l bash\""


## Nested tmux
Expand Down
Loading

0 comments on commit 4c9e260

Please sign in to comment.