This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #Getting started | |
| # install sudo | |
| apt-get install sudo | |
| # create new user | |
| adduser alice | |
| # add to sudo group | |
| usermod -aG alice | |
| # change accounts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sys import argv | |
| n = argv[1] | |
| co_dividend = 0 | |
| dec_expansion = 0 | |
| pow_max = len(n) - 2 # Last iteration should be pow == 0, first it should be the highest | |
| for (i,c) in enumerate(n[:-1]): # Ignore last digit | |
| pow_i = pow_max - i | |
| co_dividend += int(c) # Sum of all digits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sys import argv | |
| def process_email(email_raw_line): | |
| email = email_raw_line.strip() | |
| [user, domain] = email.split("@") | |
| # Remove user plus suffix: + marks ignored section | |
| plus_index = user.find("+") | |
| user = user[:plus_index] if plus_index > -1 else user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run through ct | |
| systemd: | |
| units: | |
| - name: systemd-networked.service | |
| enabled: true | |
| - name: systemd-resolved.service | |
| enabled: true | |
| - name: docker-tcp.socket | |
| enabled: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DOMAIN ?= localhost | |
| DAYS ?= 500 | |
| SAN_DOMAINS ?= | |
| COUNTRY := IT | |
| STATE := IT | |
| COMPANY := Evil Corp. | |
| # credits to: https://gist.github.com/fntlnz/cf14feb5a46b2eda428e000157447309 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Downloads from bintray and extracts into cellar | |
| # Intended as support brew switch <formula> <version> | |
| # in case that the given version is no longer available in cellar | |
| # e.g. | |
| # $0 terraform 0.11.11 should download the following | |
| # https://bintray.com/homebrew/bottles/download_file?file_path=terraform-0.11.11.sierra.bottle.tar.gz | |
| # Which allows brew switch terraform 0.11.11 to succeed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function jc_remote { | |
| jmx_host=$1 | |
| jmx_port=${2:-5000} | |
| proxy_port=${3:-8123} | |
| echo "Connecting jconsole to $jmx_host:$jmx_port via SOCKS proxy using local port $proxy_port" | |
| ssh -ND $proxy_port $jmx_host & | |
| jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=${proxy_port} \ | |
| service:jmx:rmi:///jndi/rmi://localhost:${jmx_port}/jmxrmi | |
| kill %1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| listen 80 default_server; | |
| listen [::]:80 default_server; | |
| root /var/www/html; | |
| charset utf-8; | |
| location / { | |
| autoindex on; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $env:SCOOP_GLOBAL='D:\ProgramData\scoop' | |
| [Environment]::SetEnvironmentVariable('SCOOP_GLOBAL', $env:SCOOP_GLOBAL, 'Machine') | |
| Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
| iwr -useb get.scoop.sh | iex | |
| scoop install 7zip git openssh aria2 curl grep sed less touch --global | |
| scoop bucket add extras | |
| scoop install imageglass paint.net firefox vlc vcredist2015 --global | |
| scoop install googlechrome --global | |
| scoop install neovim deluge discord steam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| key="${1:?Env var is required as first parameter}" | |
| default=${2:-} | |
| value="${!key:-$default}" | |
| : "${value:?Env var $key not found}" | |
| printf "%s" "${value}" |