From 2f442be010f531ade1dc93db311c99bc18804dcb Mon Sep 17 00:00:00 2001 From: RenatoXSR Date: Mon, 10 Sep 2018 20:19:08 -0300 Subject: [PATCH] Merging old admin.git repo. --- .zshrc | 186 ++++++++++++++++++++++++++++++++++++++ 80-dhpc.network | 9 ++ 81-dhcp-secondary.network | 6 ++ cloud.renatorosa.com | 128 ++++++++++++++++++++++++++ default | 91 +++++++++++++++++++ fastcgi.conf | 26 ++++++ fastcgi_params | 25 +++++ gdfuse | 9 ++ nginx.conf | 86 ++++++++++++++++++ phpmyadmin | 33 +++++++ settings.json | 68 ++++++++++++++ sha1base64c30.sh | 2 + sp.renatorosa.com | 14 +++ speedtest.sh | 3 + ssh-to-zsh.sh | 9 ++ vnc.sh | 40 ++++++++ 16 files changed, 735 insertions(+) create mode 100644 .zshrc create mode 100644 80-dhpc.network create mode 100644 81-dhcp-secondary.network create mode 100644 cloud.renatorosa.com create mode 100644 default create mode 100644 fastcgi.conf create mode 100644 fastcgi_params create mode 100755 gdfuse create mode 100644 nginx.conf create mode 100644 phpmyadmin create mode 100644 settings.json create mode 100755 sha1base64c30.sh create mode 100644 sp.renatorosa.com create mode 100644 speedtest.sh create mode 100755 ssh-to-zsh.sh create mode 100755 vnc.sh diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..186e977 --- /dev/null +++ b/.zshrc @@ -0,0 +1,186 @@ +###################################################################### +# mako's zshrc file, v0.1 +# +# +###################################################################### + +# next lets set some enviromental/shell pref stuff up +# setopt NOHUP +#setopt NOTIFY +#setopt NO_FLOW_CONTROL +setopt APPEND_HISTORY +# setopt AUTO_LIST # these two should be turned off +# setopt AUTO_REMOVE_SLASH +# setopt AUTO_RESUME # tries to resume command of same name +unsetopt BG_NICE # do NOT nice bg commands +setopt CORRECT # command CORRECTION +setopt EXTENDED_HISTORY # puts timestamps in the history +# setopt HASH_CMDS # turns on hashing +setopt HIST_ALLOW_CLOBBER +setopt HIST_REDUCE_BLANKS +setopt INC_APPEND_HISTORY SHARE_HISTORY +setopt ALL_EXPORT + +setopt MENUCOMPLETE +# Set/unset shell options +setopt notify globdots correct pushdtohome cdablevars autolist +setopt correctall autocd recexact longlistjobs +setopt autoresume histignoredups pushdsilent noclobber +setopt autopushd pushdminus extendedglob rcquotes mailwarning +unsetopt bgnice autoparamslash + +# Autoload zsh modules when they are referenced +zmodload -a zsh/stat stat +zmodload -a zsh/zpty zpty +zmodload -a zsh/zprof zprof + +# mapfile : parameter already exists +#zmodload -ap zsh/mapfile mapfile + + +PATH="/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin/:$PATH" +TZ="America/Sao_Paulo" +HISTFILE=$HOME/.zhistory +HISTSIZE=1000 +SAVEHIST=1000 +HOSTNAME="`hostname`" +PAGER='less' +EDITOR='vim' + autoload colors zsh/terminfo + if [[ "$terminfo[colors]" -ge 8 ]]; then + colors + fi + for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do + eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}' + eval PR_LIGHT_$color='%{$fg[${(L)color}]%}' + (( count = $count + 1 )) + done + PR_NO_COLOR="%{$terminfo[sgr0]%}" +PS1="[$PR_MAGENTA%n$PR_NO_COLOR@$PR_GREEN%U%m%u$PR_NO_COLOR:$PR_RED%2c$PR_NO_COLOR]%(!.#.$) " +RPS1="$PR_MAGENTA(%D{%d-%m-%y %H:%M})$PR_NO_COLOR" +#LANGUAGE= +LC_ALL='pt_BR.UTF-8' +LANG='pt_BR.UTF-8' +LC_CTYPE=C +DISPLAY=:0 + +if [ $SSH_TTY ]; then + MUTT_EDITOR=vim +else + MUTT_EDITOR=emacsclient.emacs-snapshot +fi + +unsetopt ALL_EXPORT +# # -------------------------------------------------------------------- +# # aliases +# # -------------------------------------------------------------------- +alias slrn="slrn -n" +alias man='LC_ALL=PT-BR LANG=PT-BR man' +alias f=finger +alias ll='ls -ashpGl --color ' +alias ls='ls -G --color ' +alias offlineimap-tty='offlineimap -u TTY.TTYUI' +alias hnb-partecs='hnb $HOME/partecs/partecs-hnb.xml' +alias rest2html-css='rst2html --embed-stylesheet --stylesheet-path=/usr/share/python-docutils/s5_html/themes/default/print.css' +alias dmesg="sudo dmesg" +#if [[ $HOSTNAME == "kamna" ]] { +# alias emacs='emacs -l ~/.emacs.kamna' +#} + +# alias =clear +stty erase ^H &>/dev/null +bindkey "^[[3~" delete-char +#chpwd() { +# [[ -t 1 ]] || return +# case $TERM in +# sun-cmd) print -Pn "\e]l%~\e\\" +# ;; +# *xterm*|screen|rxvt|(dt|k|E)term) print -Pn "\e]2;%~\a" +# ;; +# esac +#} + +#chpwd + +autoload -U compinit +compinit +bindkey '^r' history-incremental-search-backward +bindkey "^[[5~" up-line-or-history +bindkey "^[[6~" down-line-or-history +bindkey "^[[H" beginning-of-line +bindkey "^[[1~" beginning-of-line +bindkey "^[[F" end-of-line +bindkey "^[[4~" end-of-line +bindkey ' ' magic-space # also do history expansion on space +bindkey '^I' complete-word # complete on tab, leave expansion to _expand + +zstyle ':completion::complete:*' use-cache on +zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST + +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s' +zstyle ':completion:*' menu select=1 _complete _ignored _approximate +zstyle -e ':completion:*:approximate:*' max-errors \ + 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )' +zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' +zstyle ':completion:*:processes' command 'ps -axw' +zstyle ':completion:*:processes-names' command 'ps -awxho command' +# Completion Styles +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31' +# list of completers to use +zstyle ':completion:*::::' completer _expand _complete _ignored _approximate + +# allow one error for every three characters typed in approximate completer +zstyle -e ':completion:*:approximate:*' max-errors \ + 'reply=( $(( ($#PREFIX+$#SUFFIX)/2 )) numeric )' + +# insert all expansions for expand completer +zstyle ':completion:*:expand:*' tag-order all-expansions +# +#NEW completion: +# 1. All /etc/hosts hostnames are in autocomplete +# 2. If you have a comment in /etc/hosts like #%foobar.domain, +# then foobar.domain will show up in autocomplete! +zstyle ':completion:*' hosts $(awk '/^[^#]/ {print $2 $3" "$4" "$5}' /etc/hosts | grep -v ip6- && grep "^#%" /etc/hosts | awk -F% '{print $2}') +# formatting and messages +zstyle ':completion:*' verbose yes +zstyle ':completion:*:descriptions' format '%B%d%b' +zstyle ':completion:*:messages' format '%d' +zstyle ':completion:*:warnings' format 'No matches for: %d' +zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b' +zstyle ':completion:*' group-name '' + +# match uppercase from lowercase +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' + +# offer indexes before parameters in subscripts +zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters + +# command for process lists, the local web server details and host completion +#zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args' +#zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html' +zstyle '*' hosts $hosts + +# Filename suffixes to ignore during completion (except after rm command) +zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \ + '*?.old' '*?.pro' +# the same for old style completion +#fignore=(.o .c~ .old .pro) + +# ignore completion functions (until the _ignored completer) +zstyle ':completion:*:functions' ignored-patterns '_*' +zstyle ':completion:*:scp:*' tag-order \ + files users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' +zstyle ':completion:*:scp:*' group-order \ + files all-files users hosts-domain hosts-host hosts-ipaddr +zstyle ':completion:*:ssh:*' tag-order \ + users 'hosts:-host hosts:-domain:domain hosts:-ipaddr"IP\ Address *' +zstyle ':completion:*:ssh:*' group-order \ + hosts-domain hosts-host users hosts-ipaddr +zstyle '*' single-ignored show + +source $HOME/.bash_aliases + +source $HOME/.profile + +#source /home/renato/WebApp/silvrosa.llm-node.google-api.sh diff --git a/80-dhpc.network b/80-dhpc.network new file mode 100644 index 0000000..bb326bd --- /dev/null +++ b/80-dhpc.network @@ -0,0 +1,9 @@ +[Match] +Name=enp1s0 + +[Link] +RequiredForOnline=No + +[Network] +IPForward=1 +DHCP=ipv4 diff --git a/81-dhcp-secondary.network b/81-dhcp-secondary.network new file mode 100644 index 0000000..3ac3eda --- /dev/null +++ b/81-dhcp-secondary.network @@ -0,0 +1,6 @@ +[Match] +Name=enp4s0 + +[Network] +IPForward=1 +DHCP=ipv4 diff --git a/cloud.renatorosa.com b/cloud.renatorosa.com new file mode 100644 index 0000000..c3fbb0e --- /dev/null +++ b/cloud.renatorosa.com @@ -0,0 +1,128 @@ +upstream php-handler { + #server 127.0.0.1:9000; + #server unix:/var/run/php5-fpm.sock; + server unix:/var/run/php/php7.2-fpm.sock; +} + +server { + listen 80; + listen [::]:80; + server_name cloud.renatorosa.com; + + # Add headers to serve security related headers + # Before enabling Strict-Transport-Security headers please read into this + # topic first. + # add_header Strict-Transport-Security "max-age=15768000; + # includeSubDomains; preload;"; + # + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header X-Download-Options noopen; + add_header X-Permitted-Cross-Domain-Policies none; + + # Path to the root of your installation + root /var/www/nextcloud/; + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + # The following 2 rules are only needed for the user_webfinger app. + # Uncomment it if you're planning to use this app. + #rewrite ^/.well-known/host-meta /public.php?service=host-meta last; + #rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json + # last; + + location = /.well-known/carddav { + return 301 $scheme://$host/remote.php/dav; + } + location = /.well-known/caldav { + return 301 $scheme://$host/remote.php/dav; + } + + # set max upload size + client_max_body_size 512M; + fastcgi_buffers 64 4K; + + # Enable gzip but do not remove ETag headers + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; + + # Uncomment if your server is build with the ngx_pagespeed module + # This module is currently not supported. + #pagespeed off; + + location / { + rewrite ^ /index.php$uri; + } + + location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ { + deny all; + } + location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { + deny all; + } + + location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) { + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param HTTPS on; + #Avoid sending the security headers twice + fastcgi_param modHeadersAvailable true; + fastcgi_param front_controller_active true; + fastcgi_pass php-handler; + fastcgi_intercept_errors on; + fastcgi_request_buffering off; + } + + location ~ ^/(?:updater|ocs-provider)(?:$|/) { + try_files $uri/ =404; + index index.php; + } + + # Adding the cache control header for js and css files + # Make sure it is BELOW the PHP block + location ~ \.(?:css|js|woff|svg|gif)$ { + try_files $uri /index.php$uri$is_args$args; + add_header Cache-Control "public, max-age=15778463"; + # Add headers to serve security related headers (It is intended to + # have those duplicated to the ones above) + # Before enabling Strict-Transport-Security headers please read into + # this topic first. + add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;"; + # + # WARNING: Only add the preload option once you read about + # the consequences in https://hstspreload.org/. This option + # will add the domain to a hardcoded list that is shipped + # in all major browsers and getting removed from this list + # could take several months. + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + add_header X-Download-Options noopen; + add_header X-Permitted-Cross-Domain-Policies none; + # Optional: Don't log access to assets + access_log off; + } + + location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ { + try_files $uri /index.php$uri$is_args$args; + # Optional: Don't log access to other assets + access_log off; + } +} + diff --git a/default b/default new file mode 100644 index 0000000..c841ceb --- /dev/null +++ b/default @@ -0,0 +1,91 @@ +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# https://www.nginx.com/resources/wiki/start/ +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ +# https://wiki.debian.org/Nginx/DirectoryStructure +# +# In most cases, administrators will remove this file from sites-enabled/ and +# leave it as reference inside of sites-available where it will continue to be +# updated by the nginx packaging team. +# +# This file will automatically load configuration files provided by other +# applications, such as Drupal or Wordpress. These applications will be made +# available underneath a path with that package name, such as /drupal8. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +# Default server configuration +# +server { + listen 80 default_server; + listen [::]:80 default_server; + + # SSL configuration + # + # listen 443 ssl default_server; + # listen [::]:443 ssl default_server; + # + # Note: You should disable gzip for SSL traffic. + # See: https://bugs.debian.org/773332 + # + # Read up on ssl_ciphers to ensure a secure configuration. + # See: https://bugs.debian.org/765782 + # + # Self signed certs generated by the ssl-cert package + # Don't use them in a production server! + # + # include snippets/snakeoil.conf; + + root /var/www/html; + + # Add index.php to the list if you are using PHP + index index.html index.htm index.nginx-debian.html; + + server_name _; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ =404; + } + + # pass PHP scripts to FastCGI server + # + #location ~ \.php$ { + # include snippets/fastcgi-php.conf; + # + # # With php-fpm (or other unix sockets): + # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; + # # With php-cgi (or other tcp sockets): + # fastcgi_pass 127.0.0.1:9000; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} + + +# Virtual Host configuration for example.com +# +# You can move that to a different file under sites-available/ and symlink that +# to sites-enabled/ to enable it. +# +#server { +# listen 80; +# listen [::]:80; +# +# server_name example.com; +# +# root /var/www/example.com; +# index index.html; +# +# location / { +# try_files $uri $uri/ =404; +# } +#} diff --git a/fastcgi.conf b/fastcgi.conf new file mode 100644 index 0000000..091738c --- /dev/null +++ b/fastcgi.conf @@ -0,0 +1,26 @@ + +fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; +fastcgi_param QUERY_STRING $query_string; +fastcgi_param REQUEST_METHOD $request_method; +fastcgi_param CONTENT_TYPE $content_type; +fastcgi_param CONTENT_LENGTH $content_length; + +fastcgi_param SCRIPT_NAME $fastcgi_script_name; +fastcgi_param REQUEST_URI $request_uri; +fastcgi_param DOCUMENT_URI $document_uri; +fastcgi_param DOCUMENT_ROOT $document_root; +fastcgi_param SERVER_PROTOCOL $server_protocol; +fastcgi_param REQUEST_SCHEME $scheme; +fastcgi_param HTTPS $https if_not_empty; + +fastcgi_param GATEWAY_INTERFACE CGI/1.1; +fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; + +fastcgi_param REMOTE_ADDR $remote_addr; +fastcgi_param REMOTE_PORT $remote_port; +fastcgi_param SERVER_ADDR $server_addr; +fastcgi_param SERVER_PORT $server_port; +fastcgi_param SERVER_NAME $server_name; + +# PHP only, required if PHP was built with --enable-force-cgi-redirect +fastcgi_param REDIRECT_STATUS 200; diff --git a/fastcgi_params b/fastcgi_params new file mode 100644 index 0000000..28decb9 --- /dev/null +++ b/fastcgi_params @@ -0,0 +1,25 @@ + +fastcgi_param QUERY_STRING $query_string; +fastcgi_param REQUEST_METHOD $request_method; +fastcgi_param CONTENT_TYPE $content_type; +fastcgi_param CONTENT_LENGTH $content_length; + +fastcgi_param SCRIPT_NAME $fastcgi_script_name; +fastcgi_param REQUEST_URI $request_uri; +fastcgi_param DOCUMENT_URI $document_uri; +fastcgi_param DOCUMENT_ROOT $document_root; +fastcgi_param SERVER_PROTOCOL $server_protocol; +fastcgi_param REQUEST_SCHEME $scheme; +fastcgi_param HTTPS $https if_not_empty; + +fastcgi_param GATEWAY_INTERFACE CGI/1.1; +fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; + +fastcgi_param REMOTE_ADDR $remote_addr; +fastcgi_param REMOTE_PORT $remote_port; +fastcgi_param SERVER_ADDR $server_addr; +fastcgi_param SERVER_PORT $server_port; +fastcgi_param SERVER_NAME $server_name; + +# PHP only, required if PHP was built with --enable-force-cgi-redirect +fastcgi_param REDIRECT_STATUS 200; diff --git a/gdfuse b/gdfuse new file mode 100755 index 0000000..21f5925 --- /dev/null +++ b/gdfuse @@ -0,0 +1,9 @@ +#!/bin/bash + +su renato -l -c "google-drive-ocamlfuse -label $1 $*" +exit 0 + +## gogole-drive-ocaml user renato +#gdfuse#SILVROSA /home/renato/SILVROSA fuse uid=1000,gid=1000,allow_other,user,_netdev 0 0 + + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..fb4d231 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,86 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + +### RENATO - tirei o # da linha abaixo cf. digital ocean + server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +} + + +#mail { +# # See sample authentication script at: +# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript +# +# # auth_http localhost/auth.php; +# # pop3_capabilities "TOP" "USER"; +# # imap_capabilities "IMAP4rev1" "UIDPLUS"; +# +# server { +# listen localhost:110; +# protocol pop3; +# proxy on; +# } +# +# server { +# listen localhost:143; +# protocol imap; +# proxy on; +# } +#} diff --git a/phpmyadmin b/phpmyadmin new file mode 100644 index 0000000..ea559e0 --- /dev/null +++ b/phpmyadmin @@ -0,0 +1,33 @@ +server { + listen 80; + server_name phpmyadmin.sp.renatorosa.com phpmyadmin.cloud.renatorosa.com; + + access_log /var/log/nginx/phpmyadmin_access.log; + error_log /var/log/nginx/phpmyadmin_error.log; + + root /usr/share/phpmyadmin; + index index.php; + + location / { + try_files $uri $uri/ @phpmyadmin; + } + + location @phpmyadmin { + fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; + # If nginx running on TCP socket, comment line above and uncomment line beneath + #fastcgi_pass 127.0.0.1:9000; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin/index.php; + fastcgi_param SCRIPT_NAME /index.php; + } + + location ~ \.php$ { + fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; + # If nginx running on TCP socket, comment line above and uncomment line beneath + #fastcgi_pass 127.0.0.1:9000; + include fastcgi_params; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$fastcgi_script_name; + } +} + diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..e9e71c2 --- /dev/null +++ b/settings.json @@ -0,0 +1,68 @@ +{ + "alt-speed-down": 50, + "alt-speed-enabled": false, + "alt-speed-time-begin": 540, + "alt-speed-time-day": 127, + "alt-speed-time-enabled": false, + "alt-speed-time-end": 1020, + "alt-speed-up": 50, + "bind-address-ipv4": "0.0.0.0", + "bind-address-ipv6": "::", + "blocklist-enabled": false, + "blocklist-url": "http://www.example.com/blocklist", + "cache-size-mb": 4, + "dht-enabled": true, + "download-dir": "/data/Downloads", + "download-queue-enabled": true, + "download-queue-size": 3, + "encryption": 1, + "idle-seeding-limit": 30, + "idle-seeding-limit-enabled": true, + "incomplete-dir": "/data/Downloads/Incompletos", + "incomplete-dir-enabled": true, + "lpd-enabled": false, + "message-level": 1, + "peer-congestion-algorithm": "", + "peer-id-ttl-hours": 6, + "peer-limit-global": 100, + "peer-limit-per-torrent": 20, + "peer-port": 51413, + "peer-port-random-high": 65535, + "peer-port-random-low": 49152, + "peer-port-random-on-start": false, + "peer-socket-tos": "default", + "pex-enabled": true, + "port-forwarding-enabled": true, + "preallocation": 1, + "prefetch-enabled": true, + "queue-stalled-enabled": true, + "queue-stalled-minutes": 30, + "ratio-limit": 2, + "ratio-limit-enabled": true, + "rename-partial-files": true, + "rpc-authentication-required": false, + "rpc-bind-address": "0.0.0.0", + "rpc-enabled": true, + "rpc-host-whitelist": "cloud.renatorosa.com,bt.renatorosa.com,bt.sp.renatorosa.com", + "rpc-host-whitelist-enabled": true, + "rpc-password": "{643fd916cef438568068999bc1a41dfa204a6ad6mNbx2OSs", + "rpc-port": 9091, + "rpc-url": "/transmission/", + "rpc-username": "renato", + "rpc-whitelist": "*.*.*.*,192.168.*,192.168.201.*", + "rpc-whitelist-enabled": false, + "scrape-paused-torrents-enabled": true, + "script-torrent-done-enabled": false, + "script-torrent-done-filename": "", + "seed-queue-enabled": false, + "seed-queue-size": 10, + "speed-limit-down": 100, + "speed-limit-down-enabled": false, + "speed-limit-up": 100, + "speed-limit-up-enabled": false, + "start-added-torrents": true, + "trash-original-torrent-files": false, + "umask": 2, + "upload-slots-per-torrent": 14, + "utp-enabled": true +} diff --git a/sha1base64c30.sh b/sha1base64c30.sh new file mode 100755 index 0000000..9fc471d --- /dev/null +++ b/sha1base64c30.sh @@ -0,0 +1,2 @@ +#!/bin/bash +echo $1 | sha1sum | head -c 30 | xxd -r -p | base64 diff --git a/sp.renatorosa.com b/sp.renatorosa.com new file mode 100644 index 0000000..af3d8b8 --- /dev/null +++ b/sp.renatorosa.com @@ -0,0 +1,14 @@ +server { + listen 80; + listen [::]:80; + + root /var/www/default; + index index.php index.html index.htm index.nginx-debian.html; + + server_name sp.renatorosa.com www.sp.renatorosa.com; + + location / { + try_files $uri $uri/ =404; + } +} + diff --git a/speedtest.sh b/speedtest.sh new file mode 100644 index 0000000..aaa4b3d --- /dev/null +++ b/speedtest.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# setup : pip3 install speedtest-cli jsonf +speedtest-cli --server 10506 --share --json | python3 -m json.tool diff --git a/ssh-to-zsh.sh b/ssh-to-zsh.sh new file mode 100755 index 0000000..8d42dd7 --- /dev/null +++ b/ssh-to-zsh.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# $1 = IP ADDR +# alt: ssh -t [ip] zsh +ssh -t $1 'PS1='\''${${functions[zsh_directory_name]::=" + unsetopt promptsubst + unfunction zsh_directory_name + unset PS1 + . /home/renato/.zshrc + "}+}${(D):-}${PS1=%m%# }'\' exec zsh -o promptsubst -f diff --git a/vnc.sh b/vnc.sh new file mode 100755 index 0000000..68fac5a --- /dev/null +++ b/vnc.sh @@ -0,0 +1,40 @@ +#!/bin/bash +DEFAULT_DISPLAY=:0 +X11VNC_DISPLAY="$DEFAULT_DISPLAY" + +if [ -x /usr/bin/x11vnc ]; then + [ "$1" == '-nocache' ] && CACHE_FLAG='-noncache' || CACHE_FLAG='-noncache' + [ "$2" == '-guess' ] && GUESS_FLAG='-auth guess' || GUESS_FLAG='' + [ -f /root/.vnc/passwd ] && PASSWORD="/root/.vnc/passwd" + [ -f $HOME/.vnc/passwd ] && PASSWORD="$HOME/.vnc/passwd" + [ ! -z "$PASSWORD" ] && x11vnc -display $X11VNC_DISPLAY -xkb -rfbauth $PASSWORD -rfbport 5900 -shared -forever -nowf -norc -notruecolor -bg $GUESS_FLAG $CACHE_FLAG -noxdamage + EXIT_CODE=$? + if [ $EXIT_CODE -ne 0 ]; then + + echo "\n*********************************************************************" + echo "*** Could not start x11vnc! Trying again with gdm MAGIC_COOKIE! ***" + echo "*********************************************************************\n" + + # Old GDM location for Ubuntu <= 17.10 + MAGIC_COOKIE_FILE=`sudo find /var/run/gdm/ -iname database | grep for-gdm` + + # New GDM location for Ubuntu >= 17.10 + [ -z "$MAGIC_COOKIE_FILE" ] && NUM_MAGIC_COOKIE_FILE_SESSIONS=`sudo find /run/user/ -iwholename '*/gdm/*' -iname '*Xauthority' 2>/dev/null | wc -l` + if [ -z "$MAGIC_COOKIE_FILE" -a "$NUM_MAGIC_COOKIE_FILE_SESSIONS" -gt 1 ]; then + # Find the current user's session + MAGIC_COOKIE_FILE=`sudo find /run/user/$(id -u) -iwholename '*/gdm/*' -iname '*Xauthority'` + X11VNC_DISPLAY=":1" + else + # Find the GDM user's session (or whichever shows up first in ps list) + # This should pick up the original gdm session which grabs :0 + # If you login after gdm login screen, your Xorg server may end up on another display! + # Workaround for now is to restart x11vnc on that display number + [ -z "$MAGIC_COOKIE_FILE" ] && MAGIC_COOKIE_FILE=`sudo find /run/user/ -iwholename '*/gdm/*' -iname '*Xauthority' | head -n1` + fi + # Old lightdm location for Ubuntu <= 17.10 + [ -z "$MAGIC_COOKIE_FILE" ] && MAGIC_COOKIE_FILE=`sudo find /var/lib -name '.Xauthority' -o -wholename '/var/run/lightdm/root/:0' | head -n1` + #sudo bash -c "[ -z \"$MAGIC_COOKIE_FILE\" -a -e /var/run/lightdm/root/:0 ]" && MAGIC_COOKIE_FILE='/var/run/lightdm/root/:0' + [ -n "$MAGIC_COOKIE_FILE" -a -z "$GUESS_FLAG" ] && AUTH_COOKIE_FLAG="-auth $MAGIC_COOKIE_FILE" + [ ! -z "$PASSWORD" ] && sudo x11vnc -display $X11VNC_DISPLAY -xkb -rfbauth $PASSWORD -rfbport 5900 -shared -forever -nowf -norc -notruecolor -bg $GUESS_FLAG $CACHE_FLAG -noxdamage ${AUTH_COOKIE_FLAG} + fi +fi