Skip to content

Instantly share code, notes, and snippets.

View avi-beetul's full-sized avatar

Avi Beetul avi-beetul

  • Melbourne
View GitHub Profile
@avi-beetul
avi-beetul / postgres cheatsheet.md
Created November 14, 2018 03:53 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@avi-beetul
avi-beetul / ansible-summary.md
Created May 7, 2018 07:06 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@avi-beetul
avi-beetul / handler.py
Created March 13, 2018 04:38 — forked from patrickbrandt/handler.py
Restricting Lambda function by IP address
import json
import os
def ping(event, context):
ip1 = event['headers']['X-Forwarded-For'].split(',')[0]
ip2 = event['requestContext']['identity']['sourceIp']
print('two different referring IP address parsing techniques ip1: %s and ip2: %s') % (ip1, ip2)
referringIP = event['requestContext']['identity']['sourceIp']
#TODO: use a comma-delimited string to store multiple IP address values in the environment variable
from boto.route53.connection import Route53Connection
import urllib2
from syslog import syslog
# ======= CONFIG ========
AWS_ACCESS_KEY_ID = 'XXXXXXXXXXXXXXXXXX'
AWS_SECRET_ACCESS_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'
DDNSNAME = "foo.example.com." # Should end in period
ZONEID = "XXXXXXXXX"
# ===== END CONFIG ======
"""
Requeriments:
$ sudo pip install boto dnspython
Edit ~/.boto to use your AWS credentials
"""
import time
import sys