Skip to content
Snippets Groups Projects
Commit fc03554e authored by nimrod's avatar nimrod
Browse files

Merge branch 'master' of cgit:/srv/git/rcfiles

parents 89cb1256 d4a65726
No related branches found
No related tags found
No related merge requests found
...@@ -73,6 +73,7 @@ alias apt-daily="sudo /bin/sh -c 'apt-get update && apt-get dist-upgrade --downl ...@@ -73,6 +73,7 @@ alias apt-daily="sudo /bin/sh -c 'apt-get update && apt-get dist-upgrade --downl
alias docker-build='docker build -t "$(basename $PWD)" ./' alias docker-build='docker build -t "$(basename $PWD)" ./'
alias cdtemp='cd $(mktemp -d)' alias cdtemp='cd $(mktemp -d)'
alias 0-day-cleanup='ssh xbmc "sudo -u debian-transmission find /srv/library/Comics -name *.part -path *0-Day\ Week\ of* -delete"' alias 0-day-cleanup='ssh xbmc "sudo -u debian-transmission find /srv/library/Comics -name *.part -path *0-Day\ Week\ of* -delete"'
alias httpbin='tox -c $HOME/.tox.ini.httpbin --'
deduce-aws-region () { deduce-aws-region () {
export AWS_DEFAULT_REGION="$(curl --silent \ export AWS_DEFAULT_REGION="$(curl --silent \
...@@ -105,4 +106,22 @@ docker-dev () { ...@@ -105,4 +106,22 @@ docker-dev () {
--workdir "$PWD" "$repo:dev" /bin/sh -l --workdir "$PWD" "$repo:dev" /bin/sh -l
} }
sync-comics () {
this_month="$( date '+xbmc:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*' )"
last_month="$( date --date '1 month ago' '+xbmc:/srv/library/Comics/0-Day\ Week\ of\ %Y.%m.*' )"
rsync --recursive --compress --progress --exclude "*.part" "$last_month" "$this_month" "$HOME/Downloads/Comics/"
}
update-requirements () {
cd $(git rev-parse --show-toplevel)
for file in $(git ls-files *requirements*.txt)
do
pur --requirement $file
git add $file
done
git commit -m"- Updated requirements."
git push
cd - > /dev/null
}
. $HOME/Documents/Shore/bundle_certs/bundle_certs . $HOME/Documents/Shore/bundle_certs/bundle_certs
...@@ -19,10 +19,11 @@ ...@@ -19,10 +19,11 @@
staash = stash --all staash = stash --all
stat = status --short --branch stat = status --short --branch
tag-version = !git tag -f "v$(cat VERSION)" tag-version = !git tag -f "v$(cat VERSION)"
trigger = !git commit --allow-empty --no-edit --amend && git push --force-with-lease
[color] [color]
grep = true grep = true
[core] [core]
excludesfile = /home/nimrod/.gitignore_global excludesfile = ~/.gitignore_global
[diff] [diff]
tool = meld tool = meld
[difftool] [difftool]
......
...@@ -3,5 +3,6 @@ ControlMaster auto ...@@ -3,5 +3,6 @@ ControlMaster auto
ControlPath ~/.ssh/%r@%h:%p.sock ControlPath ~/.ssh/%r@%h:%p.sock
ControlPersist 3m ControlPersist 3m
ServerAliveInterval 30 ServerAliveInterval 30
IdentitiesOnly yes
#StrictHostKeyChecking yes #StrictHostKeyChecking yes
#UserKnownHostsFile=/dev/null #UserKnownHostsFile=/dev/null
...@@ -15,22 +15,37 @@ HostName bitbucket.org ...@@ -15,22 +15,37 @@ HostName bitbucket.org
User git User git
IdentityFile ~/.ssh/fdna_rsa IdentityFile ~/.ssh/fdna_rsa
Host monster Host monster.fdna.local
HostName monster HostName 10.0.0.209
User nimrod User nimrod
IdentityFile ~/.ssh/fdna_rsa IdentityFile ~/.ssh/fdna_rsa
Host backup Host backup.fdna.local
HostName backup HostName 10.0.0.210
User nimrod User nimrod
IdentityFile ~/.ssh/fdna_rsa IdentityFile ~/.ssh/fdna_rsa
Host dl-fdna* Host xen01.fdna.local
HostName 10.0.0.110
User root
IdentityFile ~/.ssh/fdna_rsa
Host adm1.fdna.local
HostName 10.0.0.111
User nimrod
IdentityFile ~/.ssh/fdna_rsa
Host 10.0.0.20?
User nimrod User nimrod
IdentityFile ~/.ssh/fdna_rsa IdentityFile ~/.ssh/fdna_rsa
Host storage Host storage.fdna.local
HostName storage HostName 10.0.0.220
User nimrod
IdentityFile ~/.ssh/fdna_rsa
Host data-management.fdna.local
HostName 10.0.0.109
User nimrod User nimrod
IdentityFile ~/.ssh/fdna_rsa IdentityFile ~/.ssh/fdna_rsa
...@@ -63,7 +78,6 @@ Host nag01.fdna.com ...@@ -63,7 +78,6 @@ Host nag01.fdna.com
HostName nag01.cloudapp.net HostName nag01.cloudapp.net
User fdna_srv User fdna_srv
IdentityFile ~/.ssh/fdna_rsa IdentityFile ~/.ssh/fdna_rsa
ProxyCommand ssh ns1 nc %h %p
Host dev2_ops Host dev2_ops
HostName 52.213.235.92 HostName 52.213.235.92
...@@ -89,3 +103,20 @@ Host ci_ops ...@@ -89,3 +103,20 @@ Host ci_ops
HostName 52.208.181.7 HostName 52.208.181.7
User nimrod User nimrod
IdentityFile ~/.ssh/fdna_rsa IdentityFile ~/.ssh/fdna_rsa
Host *.dev-f2g.com
User nimrod
IdentityFile ~/.ssh/fdna_rsa
Host *.face2gene.com
User nimrod
IdentityFile ~/.ssh/fdna_rsa
Host *.fdna.com
User nimrod
IdentityFile ~/.ssh/fdna_rsa
Host gitolite_ops
HostName 52.211.215.151
User nimrod
IdentityFile ~/.ssh/fdna_rsa
# shore.co.il infrastructure # shore.co.il infrastructure
Host ns1 www.shore.co.il Host ns1.shore.co.il www.shore.co.il
HostName ns1.shore.co.il HostName ns1.shore.co.il
LocalForward 9091 xbmc.trusted:9091 LocalForward 9091 xbmc.shore.co.il:9091
DynamicForward 8080 DynamicForward 8080
User nimrod User nimrod
IdentityFile ~/.ssh/shore_ecdsa IdentityFile ~/.ssh/shore_ecdsa
IdentityFile ~/.ssh/shore_rsa IdentityFile ~/.ssh/shore_rsa
Host xbmc Host xbmc.shore.co.il
HostName xbmc.trusted HostName xbmc.shore.co.il
User nimrod User nimrod
ForwardX11 yes ForwardX11 yes
IdentityFile ~/.ssh/shore_ecdsa IdentityFile ~/.ssh/shore_ecdsa
IdentityFile ~/.ssh/shore_rsa IdentityFile ~/.ssh/shore_rsa
ProxyCommand ssh ns1 nc %h %p ProxyCommand ssh ns1.shore.co.il nc %h %p
Host ns2 Host ns2.shore.co.il
HostName ns2.shore.co.il HostName ns2.shore.co.il
User admin User admin
DynamicForward 9999 DynamicForward 9999
IdentityFile ~/.ssh/shore_ecdsa IdentityFile ~/.ssh/shore_ecdsa
IdentityFile ~/.ssh/shore_rsa IdentityFile ~/.ssh/shore_rsa
Host cgit Host cgit.shore.co.il
HostName cgit.trusted HostName cgit.shore.co.il
ProxyCommand ssh ns1 nc %h %p ProxyCommand ssh ns1.shore.co.il nc %h %p
User nimrod User nimrod
IdentityFile ~/.ssh/shore_ecdsa IdentityFile ~/.ssh/shore_ecdsa
IdentityFile ~/.ssh/shore_rsa IdentityFile ~/.ssh/shore_rsa
Host ns3 Host ns3.shore.co.il
HostName ns3.shore.co.il HostName ns3.shore.co.il
User root User root
IdentityFile ~/.ssh/shore_ecdsa IdentityFile ~/.ssh/shore_ecdsa
IdentityFile ~/.ssh/shore_rsa IdentityFile ~/.ssh/shore_rsa
DynamicForward 8081 DynamicForward 8081
Host host01 Host host01.shore.co.il
HostName host01.trusted HostName host01.shore.co.il
User nimrod User nimrod
ProxyCommand ssh ns1 nc %h %p ProxyCommand ssh ns1.shore.co.il nc %h %p
IdentityFile ~/.ssh/shore_ecdsa IdentityFile ~/.ssh/shore_ecdsa
IdentityFile ~/.ssh/shore_rsa IdentityFile ~/.ssh/shore_rsa
Host wdr4300 Host wdr4300.shore.co.il
HostName wdr4300.trusted HostName wdr4300.shore.co.il
User root User root
ProxyCommand ssh ns1 nc %h %p ProxyCommand ssh ns1.shore.co.il nc %h %p
IdentityFile ~/.ssh/shore_ecdsa IdentityFile ~/.ssh/shore_ecdsa
IdentityFile ~/.ssh/shore_rssa IdentityFile ~/.ssh/shore_rssa
LocalForward 8082 localhost:80 LocalForward 8082 localhost:80
[tox]
skipsdist = True
[testenv]
basepython = python3
deps =
httpbin
gunicorn
commands = gunicorn httpbin:app {posargs}
Subproject commit 8946b5f96a7ca6351aeeaf5ec85eb3759dd40b8f Subproject commit bac3cf280ad670a14d776faa4c45b33eb50de572
ssh-ca @ 62215b03
Subproject commit 8ac53385d080103b075c85a5979e0fbf2649056f Subproject commit 62215b03a40f325c75e2d9e7e71cf1ce46ac9c90
#!/bin/sh #!/bin/sh
set -eu
# The MIT License (MIT) # The MIT License (MIT)
# #
# Copyright (c) 2016 Adar Nimrod <nimrod@shore.co.il> # Copyright (c) 2017 Adar Nimrod <nimrod@shore.co.il>
# #
# Permission is hereby granted, free of charge, to any person obtaining a copy # Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal # of this software and associated documentation files (the "Software"), to deal
...@@ -23,17 +22,24 @@ set -eu ...@@ -23,17 +22,24 @@ set -eu
# SOFTWARE. # SOFTWARE.
# Logs in to the Israeli train's wifi. # Logs in to the Israeli train's wifi.
# Requires: cURL, sh, awk, logger. # Requires: cURL, sh, awk, logger, nmcli.
# To install run: # To install run:
# sudo cp --preserve=mode train-wifi.sh /etc/NetworkManager/dispatcher.d/90trainwifi # sudo cp --preserve=mode train-wifi.sh /etc/NetworkManager/dispatcher.d/90trainwifi
set -eu
die () { die () {
echo $@ | logger logger -p user.err $@
exit 1 exit 1
} }
debug () { iswifi () {
[ -n ${DEBUG:+x} ] && echo $@ | logger # TODO: Check if a network interface is passed.
[ "$(nmcli --terse --fields GENERAL.TYPE device show $1 | awk -F: '{print $2}')" = 'wifi' ]
}
wifi_connection () {
nmcli --terse --fields GENERAL.CONNECTION device show $1 | awk -F: '{print $2}'
} }
if [ $# -ne 2 ] if [ $# -ne 2 ]
...@@ -47,15 +53,19 @@ fi ...@@ -47,15 +53,19 @@ fi
which curl > /dev/null || die "Can't login to the train wifi, cURL is not installed." which curl > /dev/null || die "Can't login to the train wifi, cURL is not installed."
which awk > /dev/null || die "Can't login to the train wifi, awk is not installed." which awk > /dev/null || die "Can't login to the train wifi, awk is not installed."
which logger > /dev/null || dir "Can't login to the train wifi, logger is not installed." which logger > /dev/null || die "Can't login to the train wifi, logger is not installed."
which nmcli > /dev/null || die "Can't login to the train wifi, nmcli is not installed."
[ "$action" = 'up' ] || die "Can't login to the train wifi, action $action isn't up."
iswifi "$interface" || die "Can't login to the train wifi, interface $interface isn't wifi."
connection="$(wifi_connection $interface)"
[ "$connection" = "ISRAEL-RAILWAYS" ] || die "Can't login to the train wifi, wifi network $connection isn't ISRAEL-RAILWAYS."
if [ "$interface" = "ISRAEL-RAILWAYS" ] && [ "$action" = "up" ]
then
redirect_url="$(curl --output /dev/null --silent --write-out '%{redirect_url}' http://google.com/)" redirect_url="$(curl --output /dev/null --silent --write-out '%{redirect_url}' http://google.com/)"
debug "Train wifi redirect url: $redirect_url" logger -p user.debug "Train wifi redirect url: $redirect_url"
login_url="$(echo "$redirect_url" | awk -F\? '{printf("%s?allowAccess=true", $1)}' )" login_ip="$(echo "$redirect_url" | grep --only-matching '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*')" || die "Can't login to the train wifi, redirect URL doesn't contain an IP."
debug "Train wifi login url: $login_url" logger -p user.debug "Train wifi login IP: $ip"
curl "$login_url" login_url="http://$ip/loginHandler.php?allowAccess=true"
else logger -p user.debug "Train wifi login URL: $login_url"
debug "Interface isn't ISRAEL-RAILWAYS or action isn't up, not signing in to the train wifi." http_code="$(curl --output /dev/null --silent --write-out '%{http_code}' "$login_url")"
fi logger -p user.debug "Train wifi login HTTP code: $http_code"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment