Skip to content

Instantly share code, notes, and snippets.

View davydany's full-sized avatar
💭
Check out my app: The Civic Press! https://www.thecivicpress.com/

David Daniel davydany

💭
Check out my app: The Civic Press! https://www.thecivicpress.com/
View GitHub Profile
@davydany
davydany / postgresql-cheatsheet.md
Last active August 15, 2022 12:38
PostgreSQL Cheat Sheet

PostgreSQL Cheat Sheet

My personal Cheatsheet for PostgreSQL

Quick Commands

Creating a DB and Setting its Ownership

To create a database, you need to first ensure that the database's role exists first. Role and User are synonymous in PostgreSQL. Once you create the ROLE, you can create the Database and set the OWNER as the ROLE.

@davydany
davydany / kill-all-vms.sh
Created May 23, 2017 20:09
Destroy all running VirtualBox VMs
# Runs perfectly on CentOS 7
# Read all pids for "VBoxHeadless" process, and kill (-9) them.
while read -r pid; do
echo "Killing VirtualBox Process '${pid}'..."
kill -9 ${pid}
echo " OK Done."
done < <(pgrep VBoxHeadless)
# Read all VirtualBox VMs, and unregister, then delete them
@davydany
davydany / IPTABLES-CHEATSHEET.md
Last active May 27, 2024 14:55
IP Tables (iptables) Cheat Sheet

IP Tables (iptables) Cheat Sheet

IPTables is the Firewall service that is available in a lot of different Linux Distributions. While modifiying it might seem daunting at first, this Cheat Sheet should be able to show you just how easy it is to use and how quickly you can be on your way mucking around with your firewall.

Resources

The following list is a great set of documentation for iptables. I used them to compile this documentation.

@davydany
davydany / config.ru
Created February 17, 2017 23:45
Serving Static Sites in Heroku
# thanks to https://github.com/stevenhaddox
# Set Our Root Path
::ROOT = File.dirname( File.expand_path( __FILE__ ) )
ENV['RACK_ENV'] ||= 'development'
require 'rubygems'
# Serve our index file by default
use Rack::Static ,
@davydany
davydany / soupkitchen.sh
Last active February 23, 2017 19:42
Soup Kitchen - Runs vagrant commands for kitchen vms. Get it? Soup Kitchens serve Vagrants?
# soupkitchen
# -----------
# Runs vagrant commands for kitchen vms
function soupkitchen {
BROWN_ORANGE="\033[0;33m"
RED="\033[0;31m"
NC="\033[0m" # No Color
command=$1;
@davydany
davydany / .tmux.conf
Created July 9, 2015 16:50
My tmux.conf File
# indexing
set-option -g base-index 1
# synchronize panes with "Y"
bind-key y set-window-option synchronize-panes
# mouse & scroll configurations
set-option -g mode-mouse on # allows us to use the mouse for scrolling
set-option -g mouse-select-pane on # select a pane with mouse
set-option -g history-limit 100000 # really large scroll-back
@davydany
davydany / roulette-sim.py
Last active August 29, 2015 14:22
roulette-sim.py
#!/usr/bin/python
import random
NUMBER_OF_PLAYS = 1000000
class GamblingGame(object):
pass
@davydany
davydany / Bash Colors
Last active August 8, 2022 22:09
log4bash :-D - Just putting colors for nice clean logs in bash
BLACK="\033[0;30m"
DARK_GRAY="\033[1;30m"
LIGHT_GRAY="\033[0;37m"
WHITE="\033[1;37m"
BLUE="\033[0;34m"
LIGHT_BLUE="\033[1;34m"
GREEN="\033[0;32m"
LIGHT_GREEN="\033[1;32m"
@davydany
davydany / pom.xml
Created March 28, 2015 16:27
Hadoop Development - pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.davydany.hadoop</groupId>
<artifactId>MapReduce</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MapReduce</name>
@davydany
davydany / select_query_extractor.py
Last active August 29, 2015 14:01
Takes a log file with multipe SELECT query that was split across multiple lines, and extracts the SELECT query and prints it out on stdout.
"""
******************************************************************
WARNING: THIS DOES NOT TAKE INTO ACCOUNT NESTED SELECT QUERIES.
******************************************************************
Select Query query_extractor
============================
Takes a log file with multipe SELECT query that was split across
multiple lines, and extracts the SELECT query and prints it out on