Skip to content

Instantly share code, notes, and snippets.

@karlarao
karlarao / readme.md
Created August 2, 2018 19:53 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

@karlarao
karlarao / Search my gists.md
Created August 2, 2018 20:20 — forked from santisbon/Search my gists.md
How to search gists

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files. language:html

@karlarao
karlarao / avg.awk
Last active September 13, 2018 19:32 — forked from jamerfort/avg.awk
Awk scripts for total/average/max/min. All numbers come in on STDIN
#!/usr/bin/awk -f
BEGIN { TOTAL=0 }
{ TOTAL = TOTAL + $1 }
END { print TOTAL/NR }
https://stackoverflow.com/questions/19149731/use-awk-to-find-average-of-a-column
@karlarao
karlarao / postgres cheatsheet.md
Created January 31, 2019 08:27 — 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

@karlarao
karlarao / export_db_structure.sh
Created January 31, 2019 08:27 — forked from dantheman213/export_db_structure.sh
Batch backup and export your Postgres or PostgreSQL table schemas and stored functions or procedures into individual *.sql files --the easy way!
#!/bin/sh
# AUTHOR
# DANIEL E. GILLESPIE (2016)
# https://github.com/dantheman213
# DESCRIPTION
# Export your app's table schemas and stored functions from a PostgreSQL
# database into individual *.sql files for easy management and source control.
@karlarao
karlarao / flask-flaskrestful-nginx-setup.sh
Created April 27, 2019 21:02 — forked from lawrencefoley/flask-flaskrestful-nginx-setup.sh
Script to setup Python 3, Flask-Restful, and Nginx
#!/bin/bash
sudo apt-get update
sudo apt-get install -y python3 python3-pip nginx python3-setuptools git
sudo pip3 install uwsgi virtualenv Flask flask-restful gunicorn
sudo mkdir -p /var/www/
cd /var/www/
echo "<h1>Hello world!</h1>" | tee index.html
@karlarao
karlarao / s3update.py
Created May 2, 2019 00:40 — forked from nateware/s3update.py
Check local files vs what's on S3, and upload any that have changed.
#!/usr/bin/env python
# Compare a file on S3 to see if we have the latest version
# If not, upload it and invalidate CloudFront
import fnmatch
import os
import boto
import pprint
import re
@karlarao
karlarao / benchmark-commands.md
Created May 17, 2019 06:55 — forked from ueokande/benchmark-commands.md
Kafka Benchmark Commands

Benchmark commands

Producer

Setup

bin/kafka-topics.sh \
  --zookeeper zookeeper.example.com:2181 \
  --create \
@karlarao
karlarao / redis_cheatsheet.bash
Created August 1, 2019 20:57 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.