Browse Source

Initial checkin

master
John Looney 4 years ago
commit
2c0881d0fe
32 changed files with 7194 additions and 0 deletions
  1. +256
    -0
      bash/.bash/opsworks.sh
  2. +500
    -0
      bash/.bash_history
  3. +133
    -0
      bash/.bash_profile
  4. +1
    -0
      bash/.bashrc
  5. +1
    -0
      vim/.backups/.gitignore
  6. +0
    -0
      vim/.vim/.VimballRecord
  7. +4
    -0
      vim/.vim/.netrwhist
  8. +353
    -0
      vim/.vim/autoload/pathogen.vim
  9. +1
    -0
      vim/.vim/bundle/AnsiEsc/.VimballRecord
  10. +2257
    -0
      vim/.vim/bundle/AnsiEsc/autoload/AnsiEsc.vim
  11. +177
    -0
      vim/.vim/bundle/AnsiEsc/doc/AnsiEsc.txt
  12. +7
    -0
      vim/.vim/bundle/AnsiEsc/doc/tags
  13. +32
    -0
      vim/.vim/bundle/AnsiEsc/plugin/AnsiEscPlugin.vim
  14. +538
    -0
      vim/.vim/bundle/AnsiEsc/plugin/cecutil.vim
  15. +127
    -0
      vim/.vim/bundle/AnsiEsc/t/01_files.t
  16. +558
    -0
      vim/.vim/bundle/AnsiEsc/t/bin/colordiff
  17. +418
    -0
      vim/.vim/bundle/AnsiEsc/t/bin/vimcat
  18. +5
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/README
  19. +212
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/bull11.ans
  20. +104
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/bull12.ans
  21. +20
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/bull1_old.ans
  22. +23
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/bull2.ans
  23. +16
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/bull7.ans
  24. +12
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/bull8.ans
  25. +25
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/paws_js_pg1_w_extra_markup.ansi
  26. +6
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/simple.ansi
  27. +46
    -0
      vim/.vim/bundle/AnsiEsc/t/data/files/vimcat_doc.ansi
  28. +1261
    -0
      vim/.vim/bundle/AnsiEsc/t/lib/File/Slurp.pm
  29. +1
    -0
      vim/.vim/bundle/vim-bracketed-paste
  30. +1
    -0
      vim/.vim/bundle/vim-colors-solarized
  31. +6
    -0
      vim/.vim/doc/tags
  32. +93
    -0
      vim/.vimrc

+ 256
- 0
bash/.bash/opsworks.sh View File

@@ -0,0 +1,256 @@
#!/bin/bash

STACKS_CACHE=/tmp/stacks.$UID.cache
LAYERS_CACHE=/tmp/layers.$UID.cache
INSTANCE_CACHE=/tmp/instances.$UID.cache
CACHE_AGE=60

# Returns 1 if cache is too old
cache_age_too_old () {
cache_filename="$1"
cache_seconds="$2"
if [ -f "${cache_filename}" ] ; then
if [ $(stat -f %m "${cache_filename}") -lt $(($(date +%s) - ${cache_seconds} )) ] ; then
return 1
fi
fi
return 0
}

stacks () {
local cache_age=$CACHE_AGE
local list_full=0 list_ids=0
local opt OPTIND OPTARG

while getopts "hrlc:" opt; do
case "$opt" in
h)
echo "Usage:
$FUNCNAME -h : get help
$FUNCNAME [name] : print opsworks stackid's name (in plaintext)
$FUNCNAME -i : list all stacks by id
$FUNCNAME -l : list opsworks stacks with stack IDs
$FUNCNAME -c age : max cache age in mins (default ${CACHE_AGE})
"
return
;;
r) list_ids=1
;;
l) list_full=1
;;
c) cache_age="${OPTARG}"
;;
esac
shift $((OPTIND-1))
done

if cache_age_too_old "$STACKS_CACHE" $cache_age ; then
aws opsworks describe-stacks --output json > "$STACKS_CACHE"
fi

if [ "$1" == "" ] ; then
if [ ${list_full} -eq 1 ] ; then
jq '[.Stacks | .[] | { name:.Name, stackid:.StackId } ]' < "${STACKS_CACHE}"
elif [ ${list_ids} -eq 1 ] ; then
jq -r '.Stacks | .[] | .StackId ' < "${STACKS_CACHE}"
else
jq '[.Stacks | .[] | .Name]' < "${STACKS_CACHE}"
fi
else
jq -r '.Stacks | .[] | if .Name == "'"${1}"'" then .StackId else empty end' < "${STACKS_CACHE}"
fi

}

layers_help () {
echo "Usage:
${FUNCNAME[1]} -h : get help
${FUNCNAME[1]} -c [age : max cache age in mins (default ${CACHE_AGE})
${FUNCNAME[1]} -s [stackid] : list opsworks layers in a given stack id
${FUNCNAME[1]} -S [stackname] : list opsworks layers in a given stack name
${FUNCNAME[1]} -i [layerid] : list opsworks layer detail for a given layerid
${FUNCNAME[1]} -n [layername] : search for opsworks layer with a name (needs stack)
${FUNCNAME[1]} -D : list dnsnames of instances attached to a layer
${FUNCNAME[1]} -I : list instances attached to a layer
${FUNCNAME[1]} -L ; list detail for opsworks layer"
}

layers () {
local cache_age=$CACHE_AGE layers_cache=""
local list_full=0 stack_name="" stack_id="" layer_id="" list_machines=0 dns_name="" list_layerid=0
local opt OPTIND OPTARG

while getopts "hc:s:S:n:i:IDL" opt; do
case "$opt" in
h)
layers_help
return
;;
c) cache_age="${OPTARG}"
;;
S) stack_name="${OPTARG}"
;;
s) stack_id="${OPTARG}"
;;
i) layer_id="${OPTARG}"
;;
n) layer_name="${OPTARG}"
;;
I) list_instances=1
;;
D) dns_name=1
;;
L) list_full=1
;;
esac
done

if [ -z "$stack_name" ] && [ -z "$stack_id" ] && [ -z "$layer_id" ] ; then
echo "You must set a layer id (-i), stack name (-S) or a stack id (-s)"
layers_help
return
fi

if [ -n "$stack_name" ] ; then
stack_id=$(stacks "$stack_name")
fi

if [ -n "$stack_id" ] ; then
layers_cache="$LAYERS_CACHE.${stack_id}"
if cache_age_too_old "$layers_cache" $cache_age ; then
aws opsworks describe-layers --output json --stack-id $stack_id > "$layers_cache"
fi
else
layers_cache="$LAYERS_CACHE.${layer_id}"
if cache_age_too_old "$layers_cache" $cache_age ; then
aws opsworks describe-layers --output json --layer-id $layer_id > "$layers_cache"
fi
fi

if [ -n "$stack_id" ] ; then
jq -r '.Layers | .[] | if .StackId == "'"${stack_id}"'" then .LayerId else empty end ' < "${layers_cache}"
return
fi

if [ -n "$layer_name" ] ; then
jq -r '.Layers | .[] | if .Name == "'"${layer_name}"'" then .LayerId else empty end ' < "${layers_cache}"
return
fi

if [ -n "$layer_id" ] ; then
jq -r '.Layers | .[] | if .LayerId == "'"${layer_id}"'" then .Name else empty end' < "${layers_cache}"
return
fi

if [ "$list_full" -eq 0 ] && [ $list_instances -eq 0 ] && [ $dns_name -eq 0 ] ; then
jq '[.Layers | .[] | .Name ]' < "${layers_cache}"
return
fi
if [ $list_instances -eq 1 ] ; then
jq '[.Layers | .[] | { name:.Name, layerid:.LayerId } ]' < "${layers_cache}"
fi

}

instances_help () {
echo "Usage:
${FUNCNAME[1]} -h : get help
${FUNCNAME[1]} -c [age : max cache age in mins (default ${CACHE_AGE})
${FUNCNAME[1]} -s [stackid] : list opsworks instances in a given stack id
${FUNCNAME[1]} -S [stackname] : list opsworks instances in a given stack name
${FUNCNAME[1]} -l [layerid] : list opsworks instances detail for a given layerid
${FUNCNAME[1]} -L [layername] ; list opsworks instances detail with a layer name (needs stack)
${FUNCNAME[1]} -i [instanceid] : list opsworks instance detail for a given id (needs stack or layer)
${FUNCNAME[1]} -I [instancename] ; list opsworks instance detail for a given name (needs stack or layer)
${FUNCNAME[1]} -D : list dnsnames of instances
${FUNCNAME[1]} -V : list full detail of instances
To list instances, you must provide a layer ID, or stack name/id.
"
}

instances () {
local cache_age=$CACHE_AGE instances_cache=""
local layer_id="" stack_id="" stack_name="" layer_name="" instance_id="" instance_name="" dns_name=0 list_full=0
local opt OPTIND OPTARG instance_match="" select="" print=""
while getopts "hc:s:S:L:l:i:I:DV" opt; do
case "$opt" in
h)
instances_help
return
;;
c) cache_age="${OPTARG}"
;;
S) stack_name="${OPTARG}"
;;
s) stack_id="${OPTARG}"
;;
l) layer_id="${OPTARG}"
;;
L) layer_name="${OPTARG}"
;;
i) instance_id="${OPTARG}"
;;
I) instance_name="${OPTARG}"
;;
D) dns_name=1
;;
V) list_full=1
;;
esac
done

if [ -n "$stack_name" ] ; then
stack_id=$(stacks $stack_name)
fi

if [ -z "$layer_id" ] && [ -z "$stack_id" ] ; then
instances_help
fi

if [ -n "$layer_name" ] ; then
if [ -z "$stack_id" ] && [ -z [ "$stack_name"] ; then
echo "To search on layer name you must provide a stack id or stack name"
return 1
fi
layer_id=$(layers $layer_name -s $stackid)
fi

if [ -n "$instance_name" ] ; then
if [ -z "$layer_id" ] && [ -z "$stack_id" ] ; then
echo "To search for an instance name or instance id, you must provide a layer or stack"
return 1
fi
instance_match="and (.Hostname == \"${instance_name}\")"
fi
if [ -n "$instance_id" ] ; then
instance_match="and (.InstanceId == \"${instance_id}\")"
fi
if [ -n "$layer_id" ] ; then
instance_cache=${INSTANCE_CACHE}.${layer_id}
if cache_age_too_old "$instance_cache" $cache_age ; then
aws opsworks describe-instances --layer-id ${layer_id} --output json > "$instance_cache"
fi
select="(select(.LayerIds[] | contains(\"${layer_id}\")))"
elif [ -n "$stack_id" ] ; then
instance_cache=${INSTANCE_CACHE}.${stack_id}
if cache_age_too_old "$instance_cache" $cache_age ; then
aws opsworks describe-instances --stack-id ${stack_id} --output json > "$instance_cache"
fi
select="(.StackId == \"$stack_id\")"
fi

if [ "$list_full" -eq 1 ] ; then
print="{ name: .Hostname, az: .AvailabilityZone, ip: .PublicIp, status: .Status, dns: .PublicDns, type:
.InstanceType, created: .CreatedAt, instanceid: .InstanceId, stackid: .StackId, layerids: .LayerIds }"
elif [ "$dns_name" -eq 1 ] ; then
print=".PublicDns"
else
print=".InstanceId"
fi
jq -r ".Instances | .[] | if ($select $instance_match) then $print else empty end" < "${instance_cache}"

}



+ 500
- 0
bash/.bash_history View File

@@ -0,0 +1,500 @@
fanout-batch-workers-1
fanout-batch-workers-p5
fingerprintworkers-vpc
fullcontactworkers
growthworkers
hostmigrationworkers
identity-bulkingestionworkers
identity-consistencyworkers
identity-ingestidentity-ingestidentity-ingestidentityersidentity-ingestidentirtersidentity-ingestidentity-d-identity-ingestidound-ses-email-workers
ingeingeingeingeingeingeingeinggestingeingeingeingeingeingeing-inbox-worker
insights-workers
intercom-mail
intercom-web-mail
interconv-buinterconv-buinternnininterconv-buinterconv-buinternninifirstresponsetimeworker
message-data-export-aggregation
message-data-export-batch
message-data-export-fanout
messagegoalsworkers
messagestatsworkers
messagethread-backfill-workers
messenger-js-redirect
metrics-recorder-worker
msgfanoutworkers-vpc
msgworkers-api
msgworkers-p1
msgworkers-p2
msgworkers-p3
msgworkers-p4
msgworkers-p5
nginxqueuetest
oce-retry-workers
opentrackingworkers-vpc
overflow-vpc
perappworkers
perdocumentwperdocumentwperdocumentwperdocumen-workers
post-process-comment-workers
precanned_auto_message_creation
precanned_campaign_creation
pricingmodelworkers
prodsystems-workers
push-notification-workers
pusherworkers
pusherworkers-inbox
refreshtaskworkers-vpc
reporting-backfill-workers
reportingenrichmentworkers
respondworkers
salesforce-update-lead-fanout-worker
searchupdatesworkers
segmentrefresh-pool-1
segmentrefreshqueuerworkers
smart-sending-workers
sms-notification-workers
sparkpost-event-workers
spearfish-load-testing
spearfish-workers
stripesync-vpc
teamplatform-workers
testclusteringestionworkers
unsnoozemessagethreadsworker
uploadscdn-proxy
user-bounces-and-complaints-backfill-workers
user-data-type-caster
user-devicetoken-reset-worker
user-email-open-click-backfill-workers
user-email-open-click-update-workers
user-identity-backfill-blank-role
user-identity-fix-uniqueness-constraint
user-identity-import-enqueuer
user-merge-workers
useranalyticsworkers
userconsistencycheckfanoutworkers
userconuserconuserconuserconuserconuserconuserconuserconusker
userconuserconuserconusercok-userconuserconuserconusercok-uvpc"
for stage in $app_stages; do hammer p-ssh $stage 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 5) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
echo $app_stages
for stage in $app_stages; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 5) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
fmt -1 | sort
app_stages=$(fmt -1 | sort|grep shunned |cut -f2 -d: | cut -f1 -d.|fmt -1 |sort|uniq)
echo $app_stages
hammer p-ssh intercom-production-console 'mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed 's/"$//') -P 6032 -u admin -e "select * from stats_mysql_connection_pool"'
hammer p-ssh intercom-production-console 'mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed \'s/"$//\') -P 6032 -u admin -e "select * from stats_mysql_connection_pool"'
hammer ssh intercom-production-console
hammer p-ssh intercom-production-console 'mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed "s/\\"$//") -P 6032 -u admin -e "select * from stats_mysql_connection_pool"'
hammer p-ssh intercom-production-console 'mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed "s/\"$//") -P 6032 -u admin -e "select * from stats_mysql_connection_pool"'
hammer p-ssh intercom-production-console 'mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed \'s/"$//\') -P 6032 -u admin -e "select * from stats_mysql_connection_pool"'
hammer p-ssh intercom-production-console 'mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e "select * from stats_mysql_connection_pool"'
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e "select * from stats_mysql_connection_pool"'
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e "select \* from stats_mysql_connection_pool"'
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e \"select * from stats_mysql_connection_pool\"'
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e \"select \* from stats_mysql_connection_pool\"'
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e \\"select * from stats_mysql_connection_pool\\"'
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e \'select * from stats_mysql_connection_pool\''
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e \'select * from stats_mysql_connection_pool\' '
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e "select * from stats_mysql_connection_pool" '
hammer p-ssh intercom-production-console 'set -x ; mysql -h 127.0.0.1 -p$(grep "admin:" /etc/proxysql.cnf | cut -f2 -d: | sed s/\"\$//) -P 6032 -u admin -e "select\ * from stats_mysql_connection_pool" '
ls -l
vim dump_shunned.sh
aws s3 cp dump_shunned.sh s3://muster-vendor/
hammer p-ssh intercom-production-console 'aws s3 cp s3://muster-vendor/dump-shunned.sh . ; sh dump-shunned.sh'
hammer p-ssh intercom-production-console 'aws s3 cp s3://muster-vendor/dump_shunned.sh . ; sh dump-shunned.sh'
hammer p-ssh intercom-production-console 'aws s3 cp s3://muster-vendor/dump_shunned.sh . && sh dump-shunned.sh'
hammer p-ssh intercom-production-console 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh . && sh dump-shunned.sh'
hammer p-ssh intercom-production-console 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh'
for app in $app_stages ; hammer p-ssh $app_stages 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh'
for app in $app_stages ; hammer p-ssh $app 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh' ; done
for app in $app_stages ; do hammer p-ssh $app 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh' ; done
for app in $app_stages ; do hammer p-ssh $app 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh' ; done|grep SHUNN
ls -l
vim dump_shunned.sh
aws s3 cp dump_shunned.sh s3://muster-vendor/c
fg
vim dump_shunned.sh
app_stages="activityworker-vpc
adminnotificationworkers
alexandria-api
algoliaupdatesworkers
analyticsuseringestionworkers
api-bulkprocessworkers-p1
api-bulkprocessworkers-p2
api-bulkprocessworkers-p3
api-bulkprocessworkers-p4
api-bulkprocessworkers-p5
api-integrations-vpc
api-load-testing
api-oreo
api-oreo-spotify
api-oreo-v2
api-ping-vpc
api-vpc
appdeliverabilityrating-workers
articlestatsworkers
billingworkers
bulkingestionworkers
bulkjobcheckworkers
bulkuseractions-vpc
bulkworkers-vpc
cacheinvalidationworkers
campaigncheckpointsresetworkers
campaignfanoutworkers
campaigngoalsworkers
campaignmembershipsworkers
campaignmessagepreviewworkers
campaignpreprocessworkers
campaignprocessworkers
campaignprocessworkers-deliverywindow-p5
campaignprocessworkers-p3
campaignprocessworkers-p5
campaignspingworkers
commentworkers
console
conversation-benchmark-workers
conversationratingrequestworker
conversations-benchmark-experiment
cron-vpc
dailysummarysenderworkers
datascramblerworkers
deliverypipelinemonitorcleanupworker
deliveryworkers
deployment-test
devplatform-workers
dynamodualwriteworkers
educate-intersearch-article-deleter-worker
educate-intersearch-article-updater-worker
educate-malicious-content-detection-worker
educate-smart-suggestions-workers
educate-stats-worker
educateimportworkers
elasticstreamworkers-vpc
emailnotificationworkers
enduseringestionworkers
esconsistencyworkers-vpc
esdeepconsistencyworkers
external-unsubscribe
facebook-poll-conversations-workers
facebooksync-vpc
fanout-batch-workers
fanout-batch-workers-1
fanout-batch-workers-p5
fingerprintworkers-vpc
fullcontactworkers
growthworkers
hostmigrationworkers
identity-bulkingestionworkers
identity-consistencyworkers
identity-ingestidentity-ingestidentity-ingestidentity-rsidentity-ingestidentityersidentity-ingestidentitynd-identity-ingestidenndidentity-ingorkers
ingestionsnapshotworkers-vpc
ingestingestingestingestingestingestboingestingestingestingestingestinom-mail
inteinteinteinteinteinteint-buinteinteinteinteintininteinteinteinteinteinteint-buintnfirstresponsetimeworker
message-data-export-aggregation
message-data-export-batch
message-data-export-fanout
messagegoalsworkers
messagestatsworkers
messagethread-backfill-workers
messenger-js-redirect
metrics-recorder-worker
msgfanoutworkers-vpc
msgworkers-api
msgworkers-p1
msgworkers-p2
msgworkers-p3
msgworkers-p4
msgworkers-p5
nginxqueuetest
oce-retry-workers
opentrackingworkers-vpc
overflow-vpc
perappworkers
perdocumentworkers
periodicworkers
ping-domain-workers
post-process-comment-workers
precanned_auto_message_creation
precanned_campaign_creation
pricingmodelworkers
prodsystems-workers
push-notification-workers
pusherworkers
pusherworkers-inbox
refreshtaskworkers-vpc
reporting-backfill-workers
reportingenrichmentworkers
respondworkers
salesforce-update-lead-fanout-worker
searchupdatesworkers
segmentrefresh-pool-1
segmentrefreshqueuerworkers
smart-sending-workers
sms-notification-workers
sparkpost-event-workers
spearfish-load-testing
spearfish-workers
stripesync-vpc
teamplatform-workers
testclusteringestionworkers
unsnoozemessagethreadsworker
uploadscdn-proxy
user-bounces-and-complaints-backfill-workers
user-data-type-caster
user-devicetoken-reset-worker
user-email-open-click-backfill-workers
user-email-open-click-update-workers
user-identity-backfill-blank-role
user-identity-fix-uniqueness-constraint
user-identity-import-enqueuer
user-merge-workers
useranalyticsworkers
userconsistencycheckfanoutwuserconsistconuserconsistencychshuserconsisuserdeuserconsistencycker
userconsistencycheckfanoutok-userconsistencycheckfanoutors-vpc"
for app in $app_stages ; do hammer p-ssh $app 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh' ; done
for app in $app_stages ; do hammer p-ssh intercom-production-$app 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh' ; done
for app in $app_stages ; do hammer p-ssh intercom-production-$app 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh' & done
hammer p-ssh intercom-production-web-vpc 'aws s3 cp s3://muster-vendor/dump_shunned.sh dump-shunned.sh && sh dump-shunned.sh'
cd src/terraform-
cd src/terraform-alarms/
git status
git diff
git co master
git commit -a
git push
git co master
git pull
git co -
git rebase master
git diff HEAD
git diff origin/master
git diff origin/master
git commit -a
git rebase -i HEAD~4
git push -f
git pull-request
vim tests/datadog_test.py
cd ../intercom
cd lib/tasks
ls *period*
cd ../../
find .|grep periodic
less ./config/sidekiq-periodicworkers.yml
git pull
git status
git co johnlooney/stupid-typo
git co -b johnlooney/stupid-typo
git commit -a
git diff HEAD
git diff origin/master
git pull
git rebase master
git push
git pull-request
hammer ssh proxysql-fleet-production-maindb
git status
rm ken muster/profiles/f
rmdir bin/tmp/
rm -rf bin/tmp
git status
hammer ssh intercom-production-console
hammer ssh intercom-production-console
ssh midir
ssh midir
ssh nas
bc
ascii
cd lib/tasks
grep -i query|grep -i killer .
grep -ri query . |grep -i killer
hammer ssh query-killer
hammer ssh production-query-killer
hammer ssh query-killer-production-maindb
git co -b johnlooney/stupid-typo [A;10A
hammer ssh query-killer-production-maindb
cd
cd src/muster-deployer/
git pull
got co -
git co -
git stash
git co master
git pull
cd ../intercom/
cd muster/
ls
cd profiles/
ls -l
cd production-web-vpc
ls
ls -l
cat nginx.json
git pull
git co master
git pull
cat nginx.json
ls -l
vim
cd
vim mapping1
vimdiff mapping1
vimdiff mapping1 mapping2
diff -u mapping1 mapping2
vim mapping1
cd
cd src/intercom/services
cd src/intercom/app/services/reporting_service/
grep -r mapping .
cd
ls -l
vim mapping1
ps axuww|grep ssh
hammer ssh query-killer-production-maindb
uss 00~ec2-52-44-163-51.compute-1.amazonaws.com01~
ussh ec2-52-44-163-51.compute-1.amazonaws.com
cd src/intercom/lib/tasks
grep -r archive_org_chart .
vim cron.rake
grep send_stalled_tasks_to_pager_duty *
grep -r send_stalled_tasks_to_pager_duty .
hammer ssh proxysql-fleet-staging-maindb
hammer ssh proxysql-fleet-production-maindb
ssh midir
hammer ssh proxysql-fleet-production-maindb
cd /etc/
hammer ssh proxysql-fleet-production-db
hammer ssh proxysql-fleet-production-db
cd
cd src/proxysql-fleet/
ls -l
cd ../proxysql-deployer/
ls -l
vim Gemfile
vim proxysql-deployer.gemspec
less Rakefile
rake release
bundle install
rake release
rake --tasks
rake gem:release_minor
cd ../proxysql-fleet/
ls -l
grep 2.3 *
vim Gemfile
vim Gemfile.lock
git co master
git pull
git co -b
git co -
git rebase master
vim Gemfile.lock
git commit -a
git push
git pull-request
cd ../proxysql-del
cd ../proxysql-deployer/
git status
cd -
cd
gem install proxysql-deployer
cd src/proxysql-deployer/
git co master
git co master
git pull
rake gem:release_patch
rake gem:release_minor
rake gem:release_patch
vim Rakefile
cd ../
cd proxysql-fleet/
vim Gemfile.lock
git commit -a
git push
bc
hammer p-ssh proxysql-fleet-production-db uptime
cd ../carrow/lib/
grep proxysql_db_status *(
grep proxysql_db_status *
grep -r proxysql_db_status .
cal
hammer ssh intercom-production-activityworkers-vpc
hammer ssh intercom-production-console
ssh ec2-174-129-145-61.compute-1.amazonaws.com
cd ../../terraform-alarms/
git status
git diff
git diff
cd ../carrow/
git diff
git commit -a
git diff
cd lib
grep app-stage *
git diff
cd ..
rspec spec
git commit -a
git push
git pull-request
git co master
git pull
git co -
git rebase master
git diff
git rebase --continue
git add
git add -a
git status
git add -A
git rebase --continue
git diff
git push
git push -f
git status
git diff
git co -
git branch -D johnlooney/fix-carrow-success
git diff
git co -b johnlooney/fix-staging-typo
git commit -a
git push
git pull-request
rspec spec/
for stage in intercom-production-web-vpc ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 5) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
for stage in web-vpc ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 5) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
for stage in web-vpc ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 5) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
for stage in web-vpc ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 5) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
for stage in educateimportworkers web-vpc ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 25) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
aws rds
aws rds modify-db-instance
aws rds modify-db-instance help
ssh ec2-54-236-44-141.compute-1.amazonaws.com
aws ec2 terminate-instances i-037efc2c4c8987dea i-0cf81b61bb6f3dc0d
ssh ec2-54-172-104-45.compute-1.amazonaws.com
aws ec2 terminate-instances --instance-ids i-037efc2c4c8987dea i-0cf81b61bb6f3dc0d i-0195f1e54c52f6270
cd ../proxysql
ls -l
grep -r shunned_ .
cd lib
grep -r shunned_ .
vim ./MySQL_HostGroups_Manager.cpp
grep shun_on_failures *
grep shun_on_failures *
grep -r shun_on_failures ..
bc
for stage in educateimportworkers ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 25) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
for stage in web-internal ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 25) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
for stage in post-process-comment-workers ; do hammer p-ssh "intercom-production-${stage}" 'pass=$(jq -r .production_mysql_password < /apps/intercom/current/configuration_variables.json) ; for i in $(seq 1 25) ; do echo show tables | mysql -h 127.0.0.1 -p$pass -u intercom-rw-0125 |wc & done'; done
function ssh { /usr/bin/ssh $* || if [ "$?" -eq "255" ] ; then line=$(ssh $* 2>&1 |grep Offending|cut -f2 -d:); sed -i -e "${line}d" ~/.ssh/known_hosts; echo "Host key changed. Wiping from ~/.ssh/known_hosts." >&2; ssh $*; fi; }
ssh nas
ping nas
ping nas
cat ~/.ssh/id_rsa.pub
ping nas
ssh nas
ssh nas
set ssh
type ssh
vim /Users/johnlooney/.bash_profile
function ssh { /usr/bin/ssh $* || if [ "$?" -eq "255" ] ; then line=$(ssh $* 2>&1 |grep Offending|cut -f2 -d:); sed -i -e "${line}d" ~/.ssh/known_hosts; echo "Host key changed. Wiping from ~/.ssh/known_hosts." >&2; /usr/bin/ssh $*; fi; }
ssh nas
ssh nas
ssh midir
ssh has

+ 133
- 0
bash/.bash_profile View File

@@ -0,0 +1,133 @@
echo bash_profile
#SSH_ENV="$HOME/.ssh/environment"

function ssh {
/usr/bin/ssh $* || if [ "$?" -eq "255" ] ; then
line=$(/usr/bin/ssh $* 2>&1 |grep Offending|cut -f2 -d:)
sed -i -e "${line}d" ~/.ssh/known_hosts
echo "Host key changed. Wiping from ~/.ssh/known_hosts." >&2
/usr/bin/ssh $*
fi
}

function start_agent {
echo -n "Initialising new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add; /usr/bin/ssh-add ~/.ssh/id_github_rsa
}

# Source SSH settings, if applicable
#if [ -f "${SSH_ENV}" ]; then
# . "${SSH_ENV}" > /dev/null
# ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
# start_agent;
# }
#else
# start_agent;
#fi
export PATH=$HOME/.pilot/shims:$HOME/.pilot/bin:$PATH:/usr/local/bin:~/Library/Python/2.7/bin
eval $(export PATH=$PATH:/usr/local/bin pilot env)
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export NVM_DIR="$HOME/.nvm" ; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
export INTERCOM_USER=john.looney
#export GOPATH=/Users/johnlooney/src/mongodb/mongo-tools/vendor:/Users/johnlooney/go


export PATH=$HOME/.pilot/shims:$HOME/.pilot/bin:$PATH:$HOME/bin/
eval $(pilot env)

export NVM_DIR="/Users/johnlooney/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

alias ussh='ssh -l $USER'
alias ber='docker exec -it pilot_intercom bundle exec rspec'

# . /usr/local/opt/chruby/share/chruby/chruby.sh
# chruby 2.3.3

echo PATH=$PATH;

[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion


# Set config variables first
GIT_PROMPT_ONLY_IN_REPO=1

GIT_PROMPT_FETCH_REMOTE_STATUS=1 # uncomment to avoid fetching remote status

# GIT_PROMPT_SHOW_UPSTREAM=1 # uncomment to show upstream tracking branch
# GIT_PROMPT_SHOW_UNTRACKED_FILES=all # can be no, normal or all; determines counting of untracked files

# GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0 # uncomment to avoid printing the number of changed files

# GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10

# GIT_PROMPT_START=... # uncomment for custom prompt start sequence
# GIT_PROMPT_END=... # uncomment for custom prompt end sequence

# as last entry source the gitprompt script
# GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh)
# GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh
GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme
if [ -f /usr/local/share/gitprompt.sh ]; then
. /usr/local/share/gitprompt.sh
fi

source ~/src/scripts/bashrc/opsworks.sh
export ATLAS_TOKEN=Q77xtYnJ4QqSFw.atlasv1.Xprdavl660mySqqKWxXhmaMrYBXESfg4nNNlydH8FHrgQLrC6b44TC83QZykyQcXZkg

alias gr='git co master ; git pull ; git co - ; git rebase master'

export NVM_DIR="/Users/johnlooney/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

alias pilot_reload='launchctl unload ~/Library/LaunchAgents/com.github.intercom.pilot.daemon.plist ; launchctl load ~/Library/LaunchAgents/com.github.intercom.pilot.daemon.plist'

export DATADOG_APP_KEY=2099956f2d2323d0b0669889134e79f8af926b96 DATADOG_API_KEY=aabf7912a1202c018dd14555706d2155 AWS_DEFAULT_REGION=us-east-1
export PYTHONSTARTUP=~/.pythonrc

eval "$(rbenv init -)"

function circle () {
curl -s -u $(cat ~/.circle_auth): 'https://circleci.com/api/v1.1/'$*
}

function hostname_from_instance() {
echo $(aws ec2 describe-instances --instance-ids=$1 --query='Reservations[0].Instances[0].PublicDnsName' | tr -d '"')
}

function ip_from_instance() {
echo $(aws ec2 describe-instances --instance-ids=$1 --query='Reservations[0].Instances[0].PublicIpAddress' | tr -d '"')
}

function assh() {
ssh ec2-user@$(hostname_from_instance "$1")
}

function sdb() {
case $(uname -s) in
Darwin) timestamp=$(date -uj -f %s $(($(date +%s) - (5 * 60))) +"%FT%TZ" | sed s/:/%3A/g);;
Linux) timestamp=$(date -u +"%FT%TZ" --date='5 min ago' | sed s/:/%3A/g);;
esac
params="AWSAccessKeyId=$ACCOUNT_KEY"
params="$params&Action=$1"
[ -z "$2" ] || params="$params&DomainName=$2"
params="$params&SignatureMethod=HmacSHA256"
params="$params&SignatureVersion=2"
params="$params&Timestamp=$timestamp"
params="$params&Version=2009-04-15"
payload="GET\nsdb.amazonaws.com\n/\n$params"
hash=$(echo -ne $payload | openssl dgst -sha256 -hmac "$SECRET_KEY" -binary | base64)
curl -H application/x-www-form-urlencoded "https://sdb.amazonaws.com/?$params&Signature=$hash"
}

function git() {
if [ "$1" = "commit" ] ; then
ls *.tf > /dev/null 2>&1 && terraform fmt
fi
hub $*
}

+ 1
- 0
bash/.bashrc View File

@@ -0,0 +1 @@
echo bashrc

+ 1
- 0
vim/.backups/.gitignore View File

@@ -0,0 +1 @@
*~

+ 0
- 0
vim/.vim/.VimballRecord View File


+ 4
- 0
vim/.vim/.netrwhist View File

@@ -0,0 +1,4 @@
let g:netrw_dirhistmax =10
let g:netrw_dirhist_cnt =2
let g:netrw_dirhist_1='/Users/johnlooney/src/terraform-alarms/team-engage'
let g:netrw_dirhist_2='/Users/johnlooney/src/proxysql-deployer/lib/proxysql'

+ 353
- 0
vim/.vim/autoload/pathogen.vim View File

@@ -0,0 +1,353 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.4

" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
" .vimrc is the only other setup necessary.
"
" The API is documented inline below.

if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1

" Point of entry for basic default usage. Give a relative path to invoke
" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
" pathogen#surround(). Curly braces are expanded with pathogen#expand():
" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
" in the runtime path.
function! pathogen#infect(...) abort
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
call pathogen#surround(path)
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#surround(path . '/{}')
elseif path =~# '[{}*]'
call pathogen#interpose(path)
else
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#interpose(path . '/{}')
endif
endfor
call pathogen#cycle_filetype()
if pathogen#is_disabled($MYVIMRC)
return 'finish'
endif
return ''
endfunction

" Split a path into a list.
function! pathogen#split(path) abort
if type(a:path) == type([]) | return a:path | endif
if empty(a:path) | return [] | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction

" Convert a list to a path.
function! pathogen#join(...) abort
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction

" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort
return call('pathogen#join',[1] + a:000)
endfunction

" Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() abort
if exists('g:did_load_filetypes')
filetype off
filetype on
endif
endfunction

" Check if a bundle is disabled. A bundle is considered disabled if its
" basename or full name is included in the list g:pathogen_blacklist or the
" comma delimited environment variable $VIMBLACKLIST.
function! pathogen#is_disabled(path) abort
if a:path =~# '\~$'
return 1
endif
let sep = pathogen#slash()
let blacklist =
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
\ pathogen#split($VIMBLACKLIST)
if !empty(blacklist)
call map(blacklist, 'substitute(v:val, "[\\/]$", "", "")')
endif
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
endfunction

" Prepend the given directory to the runtime path and append its corresponding
" after directory. Curly braces are expanded with pathogen#expand().
function! pathogen#surround(path) abort
let sep = pathogen#slash()
let rtp = pathogen#split(&rtp)
let path = fnamemodify(a:path, ':s?[\\/]\=$??')
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
let after = filter(reverse(pathogen#expand(path, sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
call filter(rtp, 'index(before + after, v:val) == -1')
let &rtp = pathogen#join(before, rtp, after)
return &rtp
endfunction

" For each directory in the runtime path, add a second entry with the given
" argument appended. Curly braces are expanded with pathogen#expand().
function! pathogen#interpose(name) abort
let sep = pathogen#slash()
let name = a:name
if has_key(s:done_bundles, name)
return ""
endif
let s:done_bundles[name] = 1
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += reverse(filter(pathogen#expand(dir[0:-6].name, sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
else
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction

let s:done_bundles = {}

" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() abort
let sep = pathogen#slash()
for glob in pathogen#split(&rtp)
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
silent! execute 'helptags' pathogen#fnameescape(dir)
endif
endfor
endfor
endfunction

command! -bar Helptags :call pathogen#helptags()

" Execute the given command. This is basically a backdoor for --remote-expr.
function! pathogen#execute(...) abort
for command in a:000
execute command
endfor
return ''
endfunction

" Section: Unofficial

function! pathogen#is_absolute(path) abort
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
endfunction

" Given a string, returns all possible permutations of comma delimited braced
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
" and globbed. Actual globs are preserved.
function! pathogen#expand(pattern, ...) abort
let after = a:0 ? a:1 : ''
if a:pattern =~# '{[^{}]\+}'
let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
let found = map(split(pat, ',', 1), 'pre.v:val.post')
let results = []
for pattern in found
call extend(results, pathogen#expand(pattern))
endfor
elseif a:pattern =~# '{}'
let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
let post = a:pattern[strlen(pat) : -1]
let results = map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
else
let results = [a:pattern]
endif
let vf = pathogen#slash() . 'vimfiles'
call map(results, 'v:val =~# "\\*" ? v:val.after : isdirectory(v:val.vf.after) ? v:val.vf.after : isdirectory(v:val.after) ? v:val.after : ""')
return filter(results, '!empty(v:val)')
endfunction

" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#slash() abort
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction

function! pathogen#separator() abort
return pathogen#slash()
endfunction

" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
endfunction

" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction

" Remove duplicates from a list.
function! pathogen#uniq(list) abort
let i = 0
let seen = {}
while i < len(a:list)
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
call remove(a:list,i)
elseif a:list[i] ==# ''
let i += 1
let empty = 1
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction

" Backport of fnameescape().
function! pathogen#fnameescape(string) abort
if exists('*fnameescape')
return fnameescape(a:string)
elseif a:string ==# '-'
return '\-'
else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif
endfunction

" Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) abort
let rtp = pathogen#join(1,pathogen#split(&rtp))
let file = findfile(a:file,rtp,a:count)
if file ==# ''
return ''
else
return fnamemodify(file,':p')
endif
endfunction

" Section: Deprecated

function! s:warn(msg) abort
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction

" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories. Deprecated.
function! pathogen#runtime_prepend_subdirectories(path) abort
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
return pathogen#surround(a:path . pathogen#slash() . '{}')
endfunction

function! pathogen#incubate(...) abort
let name = a:0 ? a:1 : 'bundle/{}'
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
return pathogen#interpose(name)
endfunction

" Deprecated alias for pathogen#interpose().
function! pathogen#runtime_append_all_bundles(...) abort
if a:0
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
else
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
endif
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
endfunction

if exists(':Vedit')
finish
endif

let s:vopen_warning = 0

function! s:find(count,cmd,file,lcd)
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
let file = pathogen#runtime_findfile(a:file,a:count)
if file ==# ''
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
endif
if !s:vopen_warning
let s:vopen_warning = 1
let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
else
let warning = ''
endif
if a:lcd
let path = file[0:-strlen(a:file)-2]
execute 'lcd `=path`'
return a:cmd.' '.pathogen#fnameescape(a:file) . warning
else
return a:cmd.' '.pathogen#fnameescape(file) . warning
endif
endfunction

function! s:Findcomplete(A,L,P)
let sep = pathogen#slash()
let cheats = {
\'a': 'autoload',
\'d': 'doc',
\'f': 'ftplugin',
\'i': 'indent',
\'p': 'plugin',
\'s': 'syntax'}
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
let request = cheats[a:A[0]].a:A[1:-1]
else
let request = a:A
endif
let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
let found = {}
for path in pathogen#split(&runtimepath)
let path = expand(path, ':p')
let matches = split(glob(path.sep.pattern),"\n")
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
for match in matches
let found[match] = 1
endfor
endfor
return sort(keys(found))
endfunction

command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)

" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':

+ 1
- 0
vim/.vim/bundle/AnsiEsc/.VimballRecord View File

@@ -0,0 +1 @@
AnsiEsc.vmb: call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/autoload/AnsiEsc.vim')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/doc/AnsiEsc.txt')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/plugin/AnsiEscPlugin.vim')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/plugin/cecutil.vim')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/lib/File/Slurp.pm')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/bin/colordiff')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/bin/vimcat')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/01_files.t')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/bull1_old.ans')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/simple.ansi')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/bull12.ans')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/vimcat_doc.ansi')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/README')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/bull11.ans')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/bull2.ans')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/bull7.ans')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/bull8.ans')|call delete('/Users/johnlooney/.vim/bundle/AnsiEsc/t/data/files/paws_js_pg1_w_extra_markup.ansi')

+ 2257
- 0
vim/.vim/bundle/AnsiEsc/autoload/AnsiEsc.vim
File diff suppressed because it is too large
View File


+ 177
- 0
vim/.vim/bundle/AnsiEsc/doc/AnsiEsc.txt View File

@@ -0,0 +1,177 @@
*AnsiEsc.txt* Ansi Escape Sequence Visualization Jan 10, 2015

Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
(remove NOSPAM from Campbell's email first)
Copyright: (c) 2004-2014 by Charles E. Campbell *AnsiEsc-copyright*
The VIM LICENSE applies to AnsiEsc.vim and AnsiEsc.txt
(see |copyright|) except use "AnsiEsc" instead of "Vim".
No warranty, express or implied. Use At-Your-Own-Risk.

==============================================================================
1. Contents *AnsiEsc* *AnsiEsc-contents*
1. Contents ...................................|AnsiEsc-contents|
2. AnsiEsc Manual ...................................|AnsiEsc|
3. AnsiEsc History ...................................|AnsiEsc-history|

==============================================================================
2. Manual *AnsiEsc-manual*


CONCEAL~
The best option: for this, your vim must have +conceal. Try either >
:version
:echo has("conceal")
< if you have vim v7.3. Your vim needs to have been compiled
for "big" or "huge" and to support syntax highlighting.

Vim: (v7.2 or earlier) -- ansi escape sequences themselves are Ignore'd~
Ansi escape sequences have the expected effect on subsequent
text, but the ansi escape sequences themselves still take up
screen columns. The sequences are displayed using "Ignore"
highlighting; depending on your colorscheme, this should either
make the sequences blend into your background or be visually
suppressed. If the sequences aren't suppressed, you need to
improve your colorscheme!

*:AnsiEsc*
USAGE~
:AnsiEsc -- toggles Ansi escape sequence highlighting
:AnsiEsc! -- rebuilds highlighting for new/removed three
or more element Ansi escape sequences.

RESULT~
Ansi escape sequences become concealed or ignored (depending
on whether your vim supports Negri's conceal mode), and their
effect on subsequent text is emulated with Vim's syntax
highlighting.

Syntax highlighting for one and two element codes are
hard-coded into AnsiEsc.vim. There are too many possibilities
for three or more element codes; these are supported by
examining the file for such sequences and only building syntax
highlighting rules for such sequences as are actually present
in the document.

EXAMPLE~

You'll want to use :AnsiEsc to see the following properly!

Color Escape Sequences
 -   1   2   3   4   5   7 
black black black black black black black
red red red red red red red
green green green green green green green
yellow yellow yellow yellow yellow yellow yellow
blue blue blue blue blue blue blue
magenta magenta magenta magenta magenta magenta magenta
cyan cyan cyan cyan cyan cyan cyan
white white white white white white white

Black B B B B B B B B
Red R R R R R R R R
Green G G G G G G G G
Yellow Y Y Y Y Y Y Y Y
Blue B B B B B B B B
Magenta M M M M M M M M
Cyan C C C C C C C C
White W W W W W W W W

Here's the vim logo:

/ \
/ \
/ \
/ \
+----+ +----+ \
++ ++ +- | \
/| | / / \
X | | / /O \
\| | / /+-+ +-\//-+
| |/ / | | | v |
| / / | | | + +|
| / | |/| |\/||
+----\ +-+ +-+ ++
\ /
\ /

PROBLEM WITH EMBEDDING:

AnsiEsc plugin highlighting cannot be embedded in another
syntax language.

AnsiEsc uses the syntax highlighting engine, so it is
effectively another syntax highlighting language. But,
there are major differences:

* It supports being turned on and off

* AnsiEsc is not a syntax highlighting file, it
is a plugin

* AnsiEsc dynamically determines some syntax
highlighting by analyzing what's needed in the
current file.

To do a syntax highlighting file would involve an inordinate
quantity of permutations, resulting in a file that would take
much time to load (about a half hour with only a partially
complete set of permutations on my system).

Normally to embed a syntax highlighting language in another
would involve a pair of syntax highlighting commands such as:

syn include @AnsiEsc
syn region ... defines the region where AnsiEsc
\ highlighting is to occur ... contains=@AnsiEsc

placed in the other syntax file's definitions. That won't
work with AnsiEc because, again, AnsiEsc is not a syntax
highlighting file.


==============================================================================
3. AnsiEsc History *AnsiEsc-history* {{{1
v13 Apr 12, 2012 * (Peter Brant) a "conceal" was left on a syntax
definition in a no-conceal-support if block.
Fixed.
Apr 17, 2012 * (Ingo Karkat) support for the "reverse" attribute
May 13, 2014 * (Jason Schmidt) reported that <esc>[39m didn't work.
This means revert to default foreground. Similarly,
<esc>[49m didn't work (which means revert to default
background).
Dec 11, 2014 * Implemented implicit foreground/background
Jan 10, 2015 * (Evgeny Lukianchikov) provided XUbuntu support for
no-ansi-sequence (AnsiNone)
v12 Jul 23, 2010 * changed conc to |'cole'| to correspond to vim 7.3's
change
* for menus, &go =~# used to insure correct case
Aug 10, 2010 * (Rainer M Schmid) changed conceallevel setting to
depend on whether the version is before vim 7.3;
for 7.3, also sets concealcursor
* Restores conc/cole/cocu settings when AnsiEsc is
toggled off.
Dec 13, 2010 * Included some additional sequences involving 0
Feb 22, 2011 * for menus, &go =~# used to insure correct case
v11 Apr 20, 2010 * AnsiEsc now supports enabling/disabling via a menu
* <esc>[K and <esc>[00m now supported (as
grep --color=always issues them)
v10 May 06, 2009 * Three or more codes in an ANSI escape sequence are
supported by building custom syntax and highlighting
commands.
May 20, 2009 * cecutil bugfix
v9 May 12, 2008 * Now in plugin + autoload format. Provides :AnsiEsc
command to toggle Ansi-escape sequence processing.
Jan 01, 2009 * Applies Ignore highlighting to extended Ansi escape
sequences support 256-colors.
Mar 18, 2009 * Includes "rapid blink" ansi escape sequences. Vim
doesn't have a blinking attribute, so such text uses
"standout" for vim and "undercurl" for gvim.
v8 Aug 16, 2006 * Uses undercurl, and so is only available for vim 7.0
v7 Dec 14, 2004 * Works better with vim2ansi output and Vince Negri's
conceal patch for vim 6.x.
v2 Nov 24, 2004 * This version didn't use Vince Negri's conceal patch
(used Ignore highlighting)

==============================================================================
Modelines: {{{1
vim:tw=78:ts=8:ft=help:fdm=marker:

+ 7
- 0
vim/.vim/bundle/AnsiEsc/doc/tags View File

@@ -0,0 +1,7 @@
:AnsiEsc AnsiEsc.txt /*:AnsiEsc*
AnsiEsc AnsiEsc.txt /*AnsiEsc*
AnsiEsc-contents AnsiEsc.txt /*AnsiEsc-contents*
AnsiEsc-copyright AnsiEsc.txt /*AnsiEsc-copyright*
AnsiEsc-history AnsiEsc.txt /*AnsiEsc-history*
AnsiEsc-manual AnsiEsc.txt /*AnsiEsc-manual*
AnsiEsc.txt AnsiEsc.txt /*AnsiEsc.txt*

+ 32
- 0
vim/.vim/bundle/AnsiEsc/plugin/AnsiEscPlugin.vim View File

@@ -0,0 +1,32 @@
" AnsiEscPlugin.vim
" Author: Charles E. Campbell
" Date: Apr 07, 2010
" Version: 13i
" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("g:loaded_AnsiEscPlugin")
finish
endif
let g:loaded_AnsiEscPlugin = "v13i"
let s:keepcpo = &cpo
set cpo&vim

" ---------------------------------------------------------------------
" Public Interface: {{{1
com! -bang -nargs=0 AnsiEsc :call AnsiEsc#AnsiEsc(<bang>0)

" DrChip Menu Support: {{{2
if !exists('g:no_drchip_menu') && !exists('g:no_ansiesc_menu')
if has("gui_running") && has("menu") && &go =~ 'm'
if !exists("g:DrChipTopLvlMenu")
let g:DrChipTopLvlMenu= "DrChip."
endif
exe 'menu '.g:DrChipTopLvlMenu.'AnsiEsc.Start<tab>:AnsiEsc :AnsiEsc<cr>'
endif
endif

" ---------------------------------------------------------------------
" Restore: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
" vim: ts=4 fdm=marker

+ 538
- 0
vim/.vim/bundle/AnsiEsc/plugin/cecutil.vim View File

@@ -0,0 +1,538 @@
" cecutil.vim : save/restore window position
" save/restore mark position
" save/restore selected user maps
" Author: Charles E. Campbell
" Version: 18i ASTRO-ONLY
" Date: Oct 21, 2013
"
" Saving Restoring Destroying Marks: {{{1
" call SaveMark(markname) let savemark= SaveMark(markname)
" call RestoreMark(markname) call RestoreMark(savemark)
" call DestroyMark(markname)
" commands: SM RM DM
"
" Saving Restoring Destroying Window Position: {{{1
" call SaveWinPosn() let winposn= SaveWinPosn()
" call RestoreWinPosn() call RestoreWinPosn(winposn)
" \swp : save current window/buffer's position
" \rwp : restore current window/buffer's previous position
" commands: SWP RWP
"
" Saving And Restoring User Maps: {{{1
" call SaveUserMaps(mapmode,maplead,mapchx,suffix)
" call RestoreUserMaps(suffix)
"
" GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim
"
" You believe that God is one. You do well. The demons also {{{1
" believe, and shudder. But do you want to know, vain man, that
" faith apart from works is dead? (James 2:19,20 WEB)
"redraw!|call inputsave()|call input("Press <cr> to continue")|call inputrestore()

" ---------------------------------------------------------------------
" Load Once: {{{1
if &cp || exists("g:loaded_cecutil")
finish
endif
let g:loaded_cecutil = "v18i"
let s:keepcpo = &cpo
set cpo&vim
"DechoRemOn

" =======================
" Public Interface: {{{1
" =======================

" ---------------------------------------------------------------------
" Map Interface: {{{2
if !exists('g:no_plugin_maps') && !exists('g:no_cecutil_maps')
if !hasmapto('<Plug>SaveWinPosn')
map <unique> <Leader>swp <Plug>SaveWinPosn
endif
if !hasmapto('<Plug>RestoreWinPosn')
map <unique> <Leader>rwp <Plug>RestoreWinPosn
endif
endif
nmap <silent> <Plug>SaveWinPosn :call SaveWinPosn()<CR>
nmap <silent> <Plug>RestoreWinPosn :call RestoreWinPosn()<CR>

" ---------------------------------------------------------------------
" Command Interface: {{{2
com! -bar -nargs=0 SWP call SaveWinPosn()
com! -bar -nargs=? RWP call RestoreWinPosn(<args>)
com! -bar -nargs=1 SM call SaveMark(<q-args>)
com! -bar -nargs=1 RM call RestoreMark(<q-args>)
com! -bar -nargs=1 DM call DestroyMark(<q-args>)

com! -bar -nargs=1 WLR call s:WinLineRestore(<q-args>)

if v:version < 630
let s:modifier= "sil! "
else
let s:modifier= "sil! keepj "
endif

" ===============
" Functions: {{{1
" ===============

" ---------------------------------------------------------------------
" SaveWinPosn: {{{2
" let winposn= SaveWinPosn() will save window position in winposn variable
" call SaveWinPosn() will save window position in b:cecutil_winposn{b:cecutil_iwinposn}
" let winposn= SaveWinPosn(0) will *only* save window position in winposn variable (no stacking done)
fun! SaveWinPosn(...)
" echomsg "Decho: SaveWinPosn() a:0=".a:0
if line("$") == 1 && getline(1) == ""
" echomsg "Decho: SaveWinPosn : empty buffer"
return ""
endif
let so_keep = &l:so
let siso_keep = &siso
let ss_keep = &l:ss
setlocal so=0 siso=0 ss=0

let swline = line(".") " save-window line in file
let swcol = col(".") " save-window column in file
if swcol >= col("$")
let swcol= swcol + virtcol(".") - virtcol("$") " adjust for virtual edit (cursor past end-of-line)
endif
let swwline = winline() - 1 " save-window window line
let swwcol = virtcol(".") - wincol() " save-window window column
let savedposn = ""
" echomsg "Decho: sw[".swline.",".swcol."] sww[".swwline.",".swwcol."]"
let savedposn = "call GoWinbufnr(".winbufnr(0).")"
let savedposn = savedposn."|".s:modifier.swline
let savedposn = savedposn."|".s:modifier."norm! 0z\<cr>"
if swwline > 0
let savedposn= savedposn.":".s:modifier."call s:WinLineRestore(".(swwline+1).")\<cr>"
endif
if swwcol > 0
let savedposn= savedposn.":".s:modifier."norm! 0".swwcol."zl\<cr>"
endif
let savedposn = savedposn.":".s:modifier."call cursor(".swline.",".swcol.")\<cr>"

" save window position in
" b:cecutil_winposn_{iwinposn} (stack)
" only when SaveWinPosn() is used
if a:0 == 0
if !exists("b:cecutil_iwinposn")
let b:cecutil_iwinposn= 1
else
let b:cecutil_iwinposn= b:cecutil_iwinposn + 1
endif
" echomsg "Decho: saving posn to SWP stack"
let b:cecutil_winposn{b:cecutil_iwinposn}= savedposn
endif

let &l:so = so_keep
let &siso = siso_keep
let &l:ss = ss_keep

" if exists("b:cecutil_iwinposn") " Decho
" echomsg "Decho: b:cecutil_winpos{".b:cecutil_iwinposn."}[".b:cecutil_winposn{b:cecutil_iwinposn}."]"
" else " Decho
" echomsg "Decho: b:cecutil_iwinposn doesn't exist"
" endif " Decho
" echomsg "Decho: SaveWinPosn [".savedposn."]"
return savedposn
endfun

" ---------------------------------------------------------------------
" RestoreWinPosn: {{{2
" call RestoreWinPosn()
" call RestoreWinPosn(winposn)
fun! RestoreWinPosn(...)
" echomsg "Decho: RestoreWinPosn() a:0=".a:0
" echomsg "Decho: getline(1)<".getline(1).">"
" echomsg "Decho: line(.)=".line(".")
if line("$") == 1 && getline(1) == ""
" echomsg "Decho: RestoreWinPosn : empty buffer"
return ""
endif
let so_keep = &l:so
let siso_keep = &l:siso
let ss_keep = &l:ss
setlocal so=0 siso=0 ss=0

if a:0 == 0 || a:1 == ""
" use saved window position in b:cecutil_winposn{b:cecutil_iwinposn} if it exists
if exists("b:cecutil_iwinposn") && exists("b:cecutil_winposn{b:cecutil_iwinposn}")
" echomsg "Decho: using stack b:cecutil_winposn{".b:cecutil_iwinposn."}<".b:cecutil_winposn{b:cecutil_iwinposn}.">"
try
exe s:modifier.b:cecutil_winposn{b:cecutil_iwinposn}
catch /^Vim\%((\a\+)\)\=:E749/
" ignore empty buffer error messages
endtry
" normally drop top-of-stack by one
" but while new top-of-stack doesn't exist
" drop top-of-stack index by one again
if b:cecutil_iwinposn >= 1
unlet b:cecutil_winposn{b:cecutil_iwinposn}
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
while b:cecutil_iwinposn >= 1 && !exists("b:cecutil_winposn{b:cecutil_iwinposn}")
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1
endwhile
if b:cecutil_iwinposn < 1
unlet b:cecutil_iwinposn
endif
endif
else
echohl WarningMsg
echomsg "***warning*** need to SaveWinPosn first!"
echohl None
endif

else " handle input argument
" echomsg "Decho: using input a:1<".a:1.">"
" use window position passed to this function
exe a:1
" remove a:1 pattern from b:cecutil_winposn{b:cecutil_iwinposn} stack
if exists("b:cecutil_iwinposn")
let jwinposn= b:cecutil_iwinposn
while jwinposn >= 1 " search for a:1 in iwinposn..1
if exists("b:cecutil_winposn{jwinposn}") " if it exists
if a:1 == b:cecutil_winposn{jwinposn} " and the pattern matches
unlet b:cecutil_winposn{jwinposn} " unlet it
if jwinposn == b:cecutil_iwinposn " if at top-of-stack
let b:cecutil_iwinposn= b:cecutil_iwinposn - 1 " drop stacktop by one
endif
endif
endif
let jwinposn= jwinposn - 1
endwhile
endif
endif

" Seems to be something odd: vertical motions after RWP
" cause jump to first column. The following fixes that.
" Note: was using wincol()>1, but with signs, a cursor
" at column 1 yields wincol()==3. Beeping ensued.
let vekeep= &ve
set ve=all
if virtcol('.') > 1
exe s:modifier."norm! hl"
elseif virtcol(".") < virtcol("$")
exe s:modifier."norm! lh"
endif
let &ve= vekeep

let &l:so = so_keep
let &l:siso = siso_keep
let &l:ss = ss_keep

" echomsg "Decho: RestoreWinPosn"
endfun

" ---------------------------------------------------------------------
" s:WinLineRestore: {{{2
fun! s:WinLineRestore(swwline)
" echomsg "Decho: s:WinLineRestore(swwline=".a:swwline.")"
while winline() < a:swwline
let curwinline= winline()
exe s:modifier."norm! \<c-y>"
if curwinline == winline()
break
endif
endwhile
" echomsg "Decho: s:WinLineRestore"
endfun

" ---------------------------------------------------------------------
" GoWinbufnr: go to window holding given buffer (by number) {{{2
" Prefers current window; if its buffer number doesn't match,
" then will try from topleft to bottom right
fun! GoWinbufnr(bufnum)
" call Dfunc("GoWinbufnr(".a:bufnum.")")
if winbufnr(0) == a:bufnum
" call Dret("GoWinbufnr : winbufnr(0)==a:bufnum")
return
endif
winc t
let first=1
while winbufnr(0) != a:bufnum && (first || winnr() != 1)
winc w
let first= 0
endwhile
" call Dret("GoWinbufnr")
endfun

" ---------------------------------------------------------------------
" SaveMark: sets up a string saving a mark position. {{{2
" For example, SaveMark("a")
" Also sets up a global variable, g:savemark_{markname}
fun! SaveMark(markname)
" call Dfunc("SaveMark(markname<".a:markname.">)")
let markname= a:markname
if strpart(markname,0,1) !~ '\a'
let markname= strpart(markname,1,1)
endif
" call Decho("markname=".markname)

let lzkeep = &lz
set lz

if 1 <= line("'".markname) && line("'".markname) <= line("$")
let winposn = SaveWinPosn(0)
exe s:modifier."norm! `".markname
let savemark = SaveWinPosn(0)
let g:savemark_{markname} = savemark
let savemark = markname.savemark
call RestoreWinPosn(winposn)
else
let g:savemark_{markname} = ""
let savemark = ""
endif

let &lz= lzkeep

" call Dret("SaveMark : savemark<".savemark.">")
return savemark
endfun

" ---------------------------------------------------------------------
" RestoreMark: {{{2
" call RestoreMark("a") -or- call RestoreMark(savemark)
fun! RestoreMark(markname)
" call Dfunc("RestoreMark(markname<".a:markname.">)")

if strlen(a:markname) <= 0
" call Dret("RestoreMark : no such mark")
return
endif
let markname= strpart(a:markname,0,1)
if markname !~ '\a'
" handles 'a -> a styles
let markname= strpart(a:markname,1,1)
endif
" call Decho("markname=".markname." strlen(a:markname)=".strlen(a:markname))

let lzkeep = &lz
set lz
let winposn = SaveWinPosn(0)

if strlen(a:markname) <= 2
if exists("g:savemark_{markname}") && strlen(g:savemark_{markname}) != 0
" use global variable g:savemark_{markname}
" call Decho("use savemark list")
call RestoreWinPosn(g:savemark_{markname})
exe "norm! m".markname
endif
else
" markname is a savemark command (string)
" call Decho("use savemark command")
let markcmd= strpart(a:markname,1)
call RestoreWinPosn(markcmd)
exe "norm! m".markname
endif

call RestoreWinPosn(winposn)
let &lz = lzkeep

" call Dret("RestoreMark")
endfun

" ---------------------------------------------------------------------
" DestroyMark: {{{2
" call DestroyMark("a") -- destroys mark
fun! DestroyMark(markname)
" call Dfunc("DestroyMark(markname<".a:markname.">)")

" save options and set to standard values
let reportkeep= &report
let lzkeep = &lz
set lz report=10000

let markname= strpart(a:markname,0,1)
if markname !~ '\a'
" handles 'a -> a styles
let markname= strpart(a:markname,1,1)
endif
" call Decho("markname=".markname)

let curmod = &mod
let winposn = SaveWinPosn(0)
1
let lineone = getline(".")
exe "k".markname
d
put! =lineone
let &mod = curmod
call RestoreWinPosn(winposn)

" restore options to user settings
let &report = reportkeep
let &lz = lzkeep

" call Dret("DestroyMark")
endfun

" ---------------------------------------------------------------------
" QArgSplitter: to avoid \ processing by <f-args>, <q-args> is needed. {{{2
" However, <q-args> doesn't split at all, so this one returns a list
" with splits at all whitespace (only!), plus a leading length-of-list.
" The resulting list: qarglist[0] corresponds to a:0
" qarglist[i] corresponds to a:{i}
fun! QArgSplitter(qarg)
" call Dfunc("QArgSplitter(qarg<".a:qarg.">)")
let qarglist = split(a:qarg)
let qarglistlen = len(qarglist)
let qarglist = insert(qarglist,qarglistlen)
" call Dret("QArgSplitter ".string(qarglist))
return qarglist
endfun

" ---------------------------------------------------------------------
" ListWinPosn: {{{2
"fun! ListWinPosn() " Decho
" if !exists("b:cecutil_iwinposn") || b:cecutil_iwinposn == 0 " Decho
" call Decho("nothing on SWP stack") " Decho
" else " Decho
" let jwinposn= b:cecutil_iwinposn " Decho
" while jwinposn >= 1 " Decho
" if exists("b:cecutil_winposn{jwinposn}") " Decho
" call Decho("winposn{".jwinposn."}<".b:cecutil_winposn{jwinposn}.">") " Decho
" else " Decho
" call Decho("winposn{".jwinposn."} -- doesn't exist") " Decho
" endif " Decho
" let jwinposn= jwinposn - 1 " Decho
" endwhile " Decho
" endif " Decho
"endfun " Decho
"com! -nargs=0 LWP call ListWinPosn() " Decho

" ---------------------------------------------------------------------
" SaveUserMaps: this function sets up a script-variable (s:restoremap) {{{2
" which can be used to restore user maps later with
" call RestoreUserMaps()
"
" mapmode - see :help maparg for details (n v o i c l "")
" ex. "n" = Normal
" The letters "b" and "u" are optional prefixes;
" The "u" means that the map will also be unmapped
" The "b" means that the map has a <buffer> qualifier
" ex. "un" = Normal + unmapping
" ex. "bn" = Normal + <buffer>
" ex. "bun" = Normal + <buffer> + unmapping
" ex. "ubn" = Normal + <buffer> + unmapping
" maplead - see mapchx
" mapchx - "<something>" handled as a single map item.
" ex. "<left>"
" - "string" a string of single letters which are actually
" multiple two-letter maps (using the maplead:
" maplead . each_character_in_string)
" ex. maplead="\" and mapchx="abc" saves user mappings for
" \a, \b, and \c
" Of course, if maplead is "", then for mapchx="abc",
" mappings for a, b, and c are saved.
" - :something handled as a single map item, w/o the ":"
" ex. mapchx= ":abc" will save a mapping for "abc"
" suffix - a string unique to your plugin
" ex. suffix= "DrawIt"
fun! SaveUserMaps(mapmode,maplead,mapchx,suffix)
" call Dfunc("SaveUserMaps(mapmode<".a:mapmode."> maplead<".a:maplead."> mapchx<".a:mapchx."> suffix<".a:suffix.">)")

if !exists("s:restoremap_{a:suffix}")
" initialize restoremap_suffix to null string
let s:restoremap_{a:suffix}= ""
endif

" set up dounmap: if 1, then save and unmap (a:mapmode leads with a "u")
" if 0, save only
let mapmode = a:mapmode
let dounmap = 0
let dobuffer = ""
while mapmode =~ '^[bu]'
if mapmode =~ '^u'
let dounmap = 1
let mapmode = strpart(a:mapmode,1)
elseif mapmode =~ '^b'
let dobuffer = "<buffer> "
let mapmode = strpart(a:mapmode,1)
endif
endwhile
" call Decho("dounmap=".dounmap." dobuffer<".dobuffer.">")
" save single map :...something...
if strpart(a:mapchx,0,1) == ':'
" call Decho("save single map :...something...")
let amap= strpart(a:mapchx,1)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let amap = a:maplead.amap
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:sil! ".mapmode."unmap ".dobuffer.amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|:".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
" save single map <something>
elseif strpart(a:mapchx,0,1) == '<'
" call Decho("save single map <something>")
let amap = a:mapchx
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
" call Decho("amap[[".amap."]]")
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
if maparg(a:mapchx,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
" save multiple maps
else
" call Decho("save multiple maps")
let i= 1
while i <= strlen(a:mapchx)
let amap= a:maplead.strpart(a:mapchx,i-1,1)
if amap == "|" || amap == "\<c-v>"
let amap= "\<c-v>".amap
endif
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|sil! ".mapmode."unmap ".dobuffer.amap
if maparg(amap,mapmode) != ""
let maprhs = substitute(maparg(amap,mapmode),'|','<bar>','ge')
let s:restoremap_{a:suffix} = s:restoremap_{a:suffix}."|".mapmode."map ".dobuffer.amap." ".maprhs
endif
if dounmap
exe "sil! ".mapmode."unmap ".dobuffer.amap
endif
let i= i + 1
endwhile
endif
" call Dret("SaveUserMaps : restoremap_".a:suffix.": ".s:restoremap_{a:suffix})
endfun

" ---------------------------------------------------------------------
" RestoreUserMaps: {{{2
" Used to restore user maps saved by SaveUserMaps()
fun! RestoreUserMaps(suffix)
" call Dfunc("RestoreUserMaps(suffix<".a:suffix.">)")
if exists("s:restoremap_{a:suffix}")
let s:restoremap_{a:suffix}= substitute(s:restoremap_{a:suffix},'|\s*$','','e')
if s:restoremap_{a:suffix} != ""
" call Decho("exe ".s:restoremap_{a:suffix})
exe "sil! ".s:restoremap_{a:suffix}
endif
unlet s:restoremap_{a:suffix}
endif
" call Dret("RestoreUserMaps")
endfun

" ==============
" Restore: {{{1
" ==============
let &cpo= s:keepcpo
unlet s:keepcpo

" ================
" Modelines: {{{1
" ================
" vim: ts=4 fdm=marker

+ 127
- 0
vim/.vim/bundle/AnsiEsc/t/01_files.t View File

@@ -0,0 +1,127 @@
#!/usr/bin/env perl

use strict;
use warnings;
use lib 't/lib';
use Test::More;
use File::Slurp qw/read_file write_file/;
use File::Temp 'tempfile';
use Data::Dumper;

my $ANSI_CODESET = qr/(?:\e\[;*\??(?:\d+(?:;\d+)*)?[A-Za-z])+/;
my $RESET_CODESET = qr/\e\[([;\e\[m]|22|24|25|27|28|39|49|0)+m/;

# Various ANSI reset codes
my %RESETS;
@RESETS{qw/22 24 25 27 28 39 49/} = ();

foreach my $file ($ENV{ANSI_FILES} ? (split ' ', $ENV{ANSI_FILES}||'') : (glob 't/data/files/*.ans*')) {
my $content = read_file $file;

my (undef, $tmp_file) = tempfile;

system qq{t/bin/vimcat -o "$tmp_file" -u NONE -c 'set t_Co=8 | so plugin/cecutil.vim | so autoload/AnsiEsc.vim | call AnsiEsc#AnsiEsc(0)' "$file" };

my $vimcat_out = read_file $tmp_file;

my ($content_pieces, $vimcat_pieces) = normalize($content, $vimcat_out);

if ($content eq $vimcat_out) {
pass($file);
}
else {
fail($file);

# dump a diff by pieces
my (undef, $content_tmp) = tempfile('content_XXXXX', TMPDIR => 1);
my (undef, $vimcat_tmp) = tempfile('vimcat_XXXXX', TMPDIR => 1);

local $Data::Dumper::Useqq = 1;
write_file $content_tmp, Dumper($content_pieces);
write_file $vimcat_tmp, Dumper($vimcat_pieces);

system "t/bin/colordiff -u $content_tmp $vimcat_tmp";
}
}

done_testing;

sub normalize {
my ($content, $vimcat_out) = (\$_[0], \$_[1]);

# strip trailing reset ansi codes (from line ends as well)
s/${RESET_CODESET}$//mg foreach $$content, $$vimcat_out;

# strip CRs
y/\r//d foreach $$content, $$vimcat_out;

if ((not exists $ENV{NORMALIZE_WHITESPACE}) || $ENV{NORMALIZE_WHITESPACE} != 0) {
$$_ =~ s/\s+/ /g, $$_ =~ s/\n//g for $content, $vimcat_out;
}

my @content_pieces = grep { $_ ne '' } split /($ANSI_CODESET)/, $$content;
my @vimcat_pieces = grep { $_ ne '' } split /($ANSI_CODESET)/, $$vimcat_out;

($$content, $$vimcat_out) = ('', '');

my (@content_pieces_normalized, @vimcat_pieces_normalized);

my ($i, $j) = (0, 0);

while ($i < @content_pieces) {
if (($content_pieces[$i]||'') =~ /^\e\[/ && ($vimcat_pieces[$j]||'') =~ /^\e\[/) {
my $content_piece = $content_pieces[$i];
my $vimcat_piece = $vimcat_pieces[$j];

my @content_codes = $content_piece =~ /\d+/g;
my @vimcat_codes = $vimcat_piece =~ /\d+/g;