Skip to content

Instantly share code, notes, and snippets.

@StyleT
StyleT / aws_mfa.sh
Last active December 2, 2017 09:40
Retrieves a set of temporary MFA-signed credentials for an AWS account or IAM user.
#!/usr/bin/env bash
# Retrieves a set of temporary MFA-signed credentials for an AWS account or IAM user.
#
# To use it you should save MFA ARN to the profile config:
# aws configure set mfa_serial_number <ARN_OF_MFA> [--profile disco]
#
# Once the temp token is obtained, profile with "_mfa" postfix will be created
# Example: ./aws_mfa.sh disco 345324 - profile "disco_mfa" will be created with obtained creds
AWS_CLI=`which aws`
@tomfun
tomfun / .bashrc
Created July 24, 2017 20:02
my colored .bashrc
alias grep='grep --color=auto'
alias ls='ls --color=auto'
#PS1='\[\033[1;36m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '
git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
BRANCH='\033[00;33m$(git_branch)\033[0m'
PSC() { echo -ne "\[\033[${1:-0;38}m\]"; }
PR="1;36" # default color used in prompt is green
if [ "$(id -u)" = 0 ]; then
@tomfun
tomfun / gen_new_client.sh
Last active June 7, 2023 14:38
how to: tls client nginx
#!/bin/sh
echo $1
echo "optional questions is: A challenge password, An optional company name, Enter Export Password, Enter Import Password"
mkdir -p client/$1
# Create the Client Key and CSR
# личный ключ клиента, только ему самому стоит его знать. если софт поддерживает пассфраз (как ниже), лучше его использовать.
openssl genrsa -des3 -out client/$1/key.key 2048
@tomfun
tomfun / visudo
Created September 14, 2015 09:53
allow sudo for user liberulo without password
liberulo ALL=NOPASSWD:ALL
@tomfun
tomfun / gen.sh
Created September 4, 2015 10:30
generate ssl certificate/wildcard
#!/usr/bin/env bash
# https://serversforhackers.com/self-signed-ssl-certificates
# http://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate
# Specify where we will install
# the xip.io certificate
SSL_DIR="/home/tomfun/prj/ssl/o.o"
SSL_FILE="o.o"
# Set the wildcarded domain
# we want to use
DOMAIN="*.o.o"
@geerteltink
geerteltink / PHP Setter Method
Created April 12, 2015 09:41
PhpStorm file and code templates (Apache Velocity)
#set($typeHintText = "$TYPE_HINT ")
## First we check against a blacklist of primitive and other common types used in documentation.
#set($nonTypeHintableTypes = ["", "string", "int", "mixed", "number", "void", "object", "real", "double", "float", "resource", "null", "bool", "boolean"])
#foreach($nonTypeHintableType in $nonTypeHintableTypes)
#if ($nonTypeHintableType == $TYPE_HINT)
#set($typeHintText = "")
#end
#end
## Make sure the type hint actually looks like a legal php class name(permitting namespaces too) for future proofing reasons.
## This is important because PSR-5 is coming soon, and will allow documentation of types with syntax like SplStack<int>
@thoop
thoop / nginx.conf
Last active December 8, 2023 21:55
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@arunoda
arunoda / gist:7790979
Last active February 16, 2024 14:05
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X