Skip to content

Instantly share code, notes, and snippets.

View akopitsa's full-sized avatar
🏠
Working from home

Andrey Kopitsa akopitsa

🏠
Working from home
View GitHub Profile
@akopitsa
akopitsa / php-mail-postfix-ubuntu
Last active August 29, 2015 14:27 — forked from yourdesigncoza/php-mail-postfix-ubuntu
Ubuntu PHP mail() Function with Postfix
# Ubuntu PHP mail
# Ubuntu 12.04 LTS
# IMPORTANT : add your own data or parameters, I make use of double segments [[ your variable ]]. eg. ssh root@[[ 96.172.44.11 ]] should be replaced with ssh [email protected] where "888.88.88.88" is your value, variable etc. I have a habit of using ":::" to indicate line ending and end of paragraph, crazy I know but be warned its just how I write ::: All notes are for my own use & should you use any it's at your own risk, it's NOT a Tutorial :::
# Resources
# https://help.ubuntu.com/12.04/serverguide/postfix.html
# http://sourcelibrary.org/2011/08/29/how-to-set-up-the-php-mail-function-on-a-ubuntu-linux-lamp-server/
# http://stackoverflow.com/questions/12083025/xampp-on-ubuntu-server-12-04-with-pear-installed-returns-errors-when-trying-to-u
# http://askubuntu.com/questions/47609/how-to-have-my-php-send-mail
@akopitsa
akopitsa / ajax_setup.js
Created December 2, 2016 17:06 — forked from rca/ajax_setup.js
Setup Django CSRF token in JQuery AJAX requests
/**
* setup JQuery's AJAX methods to setup CSRF token in the request before sending it off.
* http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request
*/
function getCookie(name)
{
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
@akopitsa
akopitsa / newrelic-installer-ubuntu.sh
Created July 20, 2017 14:20 — forked from sumodirjo/newrelic-installer-ubuntu.sh
Install NewRelic Server Monitoring Ubuntu / Debian
echo "deb http://apt.newrelic.com/debian/ newrelic non-free" | sudo tee -a /etc/apt/sources.list.d/newrelic.list > /dev/null
wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install newrelic-sysmond
sudo nrsysmond-config --set license_key=<YOUR LICENSE HERE>
sudo /etc/init.d/newrelic-sysmond start
@akopitsa
akopitsa / nginx.conf
Created August 30, 2017 06:00 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@akopitsa
akopitsa / linux-rails-and-redmin-in-ubuntu-1604-mint18.sh
Created September 12, 2017 09:54 — forked from rotexdegba/linux-rails-and-redmin-in-ubuntu-1604-mint18.txt
Installing Rails and Redmine in Ubuntu 16.04 LTS / Linux Mint 18
# Make sure you have already installed apache and mysql;
# see https://gist.github.com/rotexdegba/d0cab757b5194a58c93db5ab6df7dc67
# for instructions.
# install rails
# https://help.ubuntu.com/lts/serverguide/ruby-on-rails.html
sudo apt install rails
# install comman dependencies
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev make libmysqlclient-dev imagemagick \
@akopitsa
akopitsa / awsEc2MetadataShortcuts.sh
Created October 13, 2017 13:17 — forked from mambroziak/awsEc2MetadataShortcuts.sh
AWS EC2 Instance Metadata to BASH Script Variables
#!/bin/bash
# JQ is required to more easily parse json.
AWS_IAM_ROLE=`curl -sL http://169.254.169.254/latest/meta-data/iam/security-credentials/`
AWS_ACCESS_KEY_ID=`curl -sL http://169.254.169.254/latest/meta-data/iam/security-credentials/$AWS_IAM_ROLE/ | jq -r '.AccessKeyId'`
AWS_SECRET_ACCESS_KEY=`curl -sL http://169.254.169.254/latest/meta-data/iam/security-credentials/$AWS_IAM_ROLE/ | jq -r '.SecretAccessKey'`
AWS_TOKEN=`curl -sL http://169.254.169.254/latest/meta-data/iam/security-credentials/$AWS_IAM_ROLE/ | jq -r '.Token'`
AWS_AZ=`curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone`
AWS_DEFAULT_REGION="`echo \"$AWS_AZ\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`"
LOCAL_IP=`curl -sL http://169.254.169.254/latest/meta-data/local-ipv4`
PUBLIC_IP=`curl -sL http://169.254.169.254/latest/meta-data/public-ipv4`
# Reference:
https://www.cloudgear.net/blog/2015/5-minutes-kubernetes-setup/
# install homebrew and cask
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install virtualbox
brew cask install virtualbox
# install dockertoolbox
@akopitsa
akopitsa / 1_kubernetes_on_macOS.md
Created November 29, 2017 16:08 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@akopitsa
akopitsa / installJava8.sh
Created January 3, 2018 15:13 — forked from aweijnitz/installJava8.sh
Provisioning script for non-interactive Java8 installation on Linux
#!/bin/sh
# From http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html
#
# You need to run this script as root
#
# su -
echo "INSTALLING JAVA 8 AS USER `whoami` "
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
@akopitsa
akopitsa / remove-docker-containers.md
Created February 4, 2018 18:10 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images