Skip to content

Instantly share code, notes, and snippets.

View davydany's full-sized avatar

David Daniel davydany

View GitHub Profile
@davydany
davydany / IPTABLES-CHEATSHEET.md
Last active September 24, 2026 05:29
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 / how-to-tmux-background-process.md
Last active July 31, 2026 18:19
Using TMUX for running processes after you log off

How to Run a Process in the Background with TMUX

There are times when you need to log off your Linux Desktop, and you want a process to run in the background. TMUX manages this very well.

For this example, let's suppose you're running a long running task like running rspecs on your project and it is 5pm, and you need to go home.

Run Your Process

@davydany
davydany / disks.md
Last active March 23, 2026 03:04
All Things Disks

All Things Disks

This is my personal documentation for dealing with Disks on a Linux Systems. This assumes that we're on CentOS (6.8).

NOTE: This tutorial does not talk about how to attach a disk to your Linux Box, or removing a disk. This is because in a physical machine, you will literally put the disk in or pull it out. On a VM, you will

NOTE: All the commands you run are to be run as root, and so, it will require superuser permissions when running sudo ....

@davydany
davydany / postgresql-cheatsheet.md
Last active March 23, 2026 03:04
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 / capture_stdout.go
Created November 9, 2022 23:16
Go - Capture Stdout from your tests
func startCapturingStdout() {
// capture things from stdout
suite.Old = os.Stdout // keep backup of the real stdout
r, w, _ := os.Pipe()
suite.R = r
suite.W = w
os.Stdout = suite.W
@davydany
davydany / network-monitoring.md
Last active August 18, 2024 08:43
Linux Tools

Tools for Network Monitoring

The purpose of this document is to show utilities that are available in the Linux world to monitor network traffic (so we're not reinventing the wheel).

Here are some good resources to read, but this file contains my favorite utilities:

@davydany
davydany / getting-started-mysql.md
Last active August 18, 2024 08:38
Getting Started with MySQL

Getting Started with MySQL

I swap between databases all the time for various projects, and end up Googling on how to do the inital setup all the time, so the purpose of this document is to list a set of commands that anyone would end up using in getting started.

Getting Started with the MySQL Client Console

Login to the MySQL console as the root user, with your password for the root user.

@davydany
davydany / django_generate_http_request.py
Last active June 20, 2023 20:49
Generate a HTTP Request that you can use to testing purposes with a view.
import json
from django.test import RequestFactory
from django.http import QueryDict
def generate_http_request(url, user, method='GET', query_params=None, data=None, headers=None, request_attrs=None):
"""
Generate an HTTP request for a given URL and user.
Args:
url (str): The URL for the request.
#/usr/bin/env python3
"""
LogScan - by David Daniel (david.daniel@cyware.com)
===================================================
Usage
-----
usage: logscan.py [-h] [--end_time end_time] [--start_time start_time]
directory [directory ...] date pattern
@davydany
davydany / getting-started-postgres.md
Last active May 30, 2023 17:11
Getting Started with PostgreSQL

Getting Started with Postgres

I swap between databases all the time for various projects, and end up Googling and how to do the initial setup all the time, so the purpose of this document is to list a set of commands that anyone would end up using in getting started.

Creating a User

The simplest way to do this, without calling the psql utility and calling the CREATE ROLE and a bunch of other SQL Statements is to use the createuser utility.