diff --git a/bash_aliases b/bash_aliases index f5cdfa6..179c944 100644 --- a/bash_aliases +++ b/bash_aliases @@ -2,24 +2,32 @@ #Django stuff alias djrun="source /home/fergalm/Dropbox/development/deepsouthsounds.com/dss.docker/api_env && python manage.py runserver 0.0.0.0:8001" alias djshell="python manage.py shell_plus --use-pythonrc --ipython" -alias dbshell="python manage.py dbshell" +alias djdb="python manage.py dbshell" alias djmigrate="python manage.py schemamigration spa --auto" + alias dss="cd ~/Dropbox/development/deepsouthsounds.com/dss.api && workon dss" alias dss_radio="cd ~/Dropbox/development/deepsouthsounds.com/dss.radio && workon dss.radio && docker start dssdocker_icecast_1" alias pgdo="sudo -u postgres" +alias sqlw="sqlw &" alias reloadbashrc="source ~/.bashrc" -alias rmdb="find . -name \*\'s\ conflicted\ copy\ \* -exec rm {} \;" alias server="python -m SimpleHTTPServer 9999" alias upd="sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove" alias psql="sudo -u postgres psql deepsouthsounds" +alias code="/usr/bin/code-insiders" + alias dbstatus="dropbox.py status" +alias dbignore='find `pwd` -type d -regex ".*\(node_modules\|temp\|tmp\|bower_components\|cache\)$" -prune -exec dropbox exclude add {} \;' +alias dbrm="find . -name \*\'s\ conflicted\ copy\ \* -exec rm {} \;" + alias pbcopy='xclip -selection clipboard' alias pbpaste='xclip -selection clipboard -o' alias iotop='sudo iotop' alias rmq=' sudo rabbitmqctl' alias congo='node /srv/dev/working/congo/server.js' +alias zap='/home/fergalm/working/ZAP/zap.sh > /dev/null 2>&1 &' + alias andconnect='adb connect 10.1.1.102:5555' doAgFind(){ diff --git a/bash_functions b/bash_functions index 57d91ab..01208f4 100644 --- a/bash_functions +++ b/bash_functions @@ -32,3 +32,13 @@ cb() { fi fi } + +function gi() { curl -L -s https://www.gitignore.io/api/\$@ ;} + +function installCode(){ + cd /tmp + sudo rm -rfv /opt/VSCode-linux-x64 + sudo unzip /tmp/VSCode-linux-x64-stable.zip -d /opt/ + sudo chown fergalm:fergalm /opt/VSCode-linux-x64 -R + sudo chown fergalm:fergalm /opt/VSCode-linux-x64 +} diff --git a/bashrc b/bashrc index 38bb4d6..801b544 100644 --- a/bashrc +++ b/bashrc @@ -119,6 +119,7 @@ if [ -f ~/.bash_functions ]; then fi +export ASPNET_ENV=Development export ANDROID_SDK=/opt/android-sdk-linux/ export PATH=$PATH:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools/:/opt/genymotion export SENCHA_CMD_3_0_0="/home/fergalm/dev/sencha/Sencha/Cmd/4.0.0.203" @@ -140,3 +141,12 @@ shopt -s histappend # append to history, don't overwrite it export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" export PATH=$PATH:/home/fergalm/Dropbox/development/working/cray/bin + +export DOCKER_TLS_VERIFY="1" +export DOCKER_HOST="tcp://dssvm2.cloudapp.net:2376" +export DOCKER_CERT_PATH="/home/fergalm/.docker/machine/machines/dssvm2" +export DOCKER_MACHINE_NAME="dssvm2" + +export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' + +source /home/fergalm/.dnx/dnvm/dnvm.sh diff --git a/dropbox.py b/dropbox.py index 22b301d..56d0b04 100755 --- a/dropbox.py +++ b/dropbox.py @@ -4,7 +4,7 @@ # # dropbox # Dropbox frontend script -# This file is part of nautilus-dropbox 1.6.2. +# This file is part of nautilus-dropbox 2015.10.28. # # nautilus-dropbox is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -212,7 +212,7 @@ def verify_signature(key_file, sig_file, plain_file): def download_file_chunk(url, buf): opener = urllib2.build_opener() - opener.addheaders = [('User-Agent', "DropboxLinuxDownloader/1.6.2")] + opener.addheaders = [('User-Agent', "DropboxLinuxDownloader/2015.10.28")] sock = opener.open(url) size = int(sock.info()['content-length']) @@ -995,10 +995,10 @@ This is an alias for filestatus -l @command @requires_dropbox_running def puburl(args): - u"""get public url of a file in your dropbox + u"""get public url of a file in your dropbox's public folder dropbox puburl FILE -Prints out a public url for FILE. +Prints out a public url for FILE (which must be in your public folder). """ if len(args) != 1: console_print(puburl.__doc__,linebreak=False) @@ -1017,6 +1017,153 @@ Prints out a public url for FILE. except DropboxCommand.CouldntConnectError, e: console_print(u"Dropbox isn't running!") +@command +@requires_dropbox_running +def sharelink(args): + u"""get a shared link for a file in your dropbox +dropbox sharelink FILE + +Prints out a shared link for FILE. +""" + if len(args) != 1: + console_print(sharelink.__doc__, linebreak=False) + return + + try: + with closing(DropboxCommand()) as dc: + try: + path = unicode_abspath(args[0].decode(sys.getfilesystemencoding())) + link = dc.get_shared_link(path=path).get('link', [u'No link'])[0] + console_print(link) + except DropboxCommand.CommandError, e: + console_print(u"Couldn't get shared link: " + str(e)) + except DropboxCommand.BadConnectionError, e: + console_print(u"Dropbox isn't responding!") + except DropboxCommand.EOFError: + console_print(u"Dropbox daemon stopped.") + except DropboxCommand.CouldntConnectError, e: + console_print(u"Dropbox isn't running!") + +@command +@requires_dropbox_running +def proxy(args): + u"""set proxy settings for Dropbox +dropbox proxy MODE [TYPE] [HOST] [PORT] [USERNAME] [PASSWORD] + +Set proxy settings for Dropbox. + +MODE - one of "none", "auto", "manual" +TYPE - one of "http", "socks4", "socks5" (only valid with "manual" mode) +HOST - proxy hostname (only valid with "manual" mode) +PORT - proxy port (only valid with "manual" mode) +USERNAME - (optional) proxy username (only valid with "manual" mode) +PASSWORD - (optional) proxy password (only valid with "manual" mode) +""" + mode = None + type_ = None + if len(args) >= 1: + mode = args[0].decode(sys.getfilesystemencoding()).lower() + if len(args) >= 2: + type_ = args[1].decode(sys.getfilesystemencoding()).lower() + + if (len(args) == 0 or + mode not in [u'none', u'auto', u'manual'] or + (mode == 'manual' and len(args) not in (4, 6)) or + (mode != 'manual' and len(args) != 1) or + (mode == 'manual' and type_ not in [u'http', u'socks4', u'socks5'])): + # Print help + console_print(proxy.__doc__, linebreak=False) + return + + ARGS = ['mode', 'type', 'host', 'port', 'username', 'password'] + + # Load the args into a dictionary + kwargs = dict(zip(ARGS, [a.decode(sys.getfilesystemencoding()) for a in args])) + + # Re-set these two because they were coerced to lower case + kwargs['mode'] = mode + if type_: + kwargs['type'] = type_ + + try: + with closing(DropboxCommand()) as dc: + try: + dc.set_proxy_settings(**kwargs) + console_print(u'set') + except DropboxCommand.CommandError, e: + console_print(u"Couldn't set proxy: " + str(e)) + except DropboxCommand.BadConnectionError, e: + console_print(u"Dropbox isn't responding!") + except DropboxCommand.EOFError: + console_print(u"Dropbox daemon stopped.") + except DropboxCommand.CouldntConnectError, e: + console_print(u"Dropbox isn't running!") + +@command +@requires_dropbox_running +def throttle(args): + u"""set bandwidth limits for Dropbox +dropbox throttle DOWNLOAD UPLOAD + +Set bandwidth limits for file sync. + +DOWNLOAD - either "unlimited" or a manual limit in KB/s +UPLOAD - one of "unlimited", "auto", or a manual limit in KB/s +""" + if len(args) != 2: + console_print(throttle.__doc__, linebreak=False) + return + + downlimit = args[0].decode(sys.getfilesystemencoding()).lower() + uplimit = args[1].decode(sys.getfilesystemencoding()).lower() + + download_limit = None + download_mode = None + if downlimit == u'unlimited': + download_mode = downlimit + else: + try: + download_limit = int(downlimit) + download_mode = u'manual' + except ValueError: + console_print(throttle.__doc__, linebreak=False) + return + + upload_limit = None + upload_mode = None + if uplimit in [u'unlimited', u'auto']: + upload_mode = uplimit + else: + try: + upload_limit = int(uplimit) + upload_mode = u'manual' + except ValueError: + console_print(throttle.__doc__, linebreak=False) + return + + kwargs = { + u'download_mode': download_mode, + u'upload_mode': upload_mode, + } + if download_limit: + kwargs[u'download_limit'] = unicode(download_limit) + if upload_limit: + kwargs[u'upload_limit'] = unicode(upload_limit) + + try: + with closing(DropboxCommand()) as dc: + try: + dc.set_bandwidth_limits(**kwargs) + console_print(u'set') + except DropboxCommand.CommandError, e: + console_print(u"Couldn't set bandwidth limits: " + str(e)) + except DropboxCommand.BadConnectionError, e: + console_print(u"Dropbox isn't responding!") + except DropboxCommand.EOFError: + console_print(u"Dropbox daemon stopped.") + except DropboxCommand.CouldntConnectError, e: + console_print(u"Dropbox isn't running!") + @command @requires_dropbox_running def status(args): diff --git a/install.sh b/install.sh index b30ba33..b17beeb 100755 --- a/install.sh +++ b/install.sh @@ -6,7 +6,7 @@ h dir=~/dotfiles # dotfiles directory olddir=~/dotfiles_old # old dotfiles backup directory -files="bashrc bash_aliases bash_profile bash_prompt bash_functions" # list of files/folders to symlink in homedir +files="bashrc bash_aliases bash_profile bash_prompt bash_functions sqliterc" # list of files/folders to symlink in homedir ########## diff --git a/sqliterc b/sqliterc new file mode 100644 index 0000000..86ab5c6 --- /dev/null +++ b/sqliterc @@ -0,0 +1,2 @@ +.headers ON +.mode column