Skip to content

Instantly share code, notes, and snippets.

DTailor DTailor

Block or report user

Report or block DTailor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am dtailor on github.
  • I am dtailor (https://keybase.io/dtailor) on keybase.
  • I have a public key ASBiHLMc6dEiRpClfT9utqBxnAv5eBM_HaogyBvjorC5vQo

To claim this, I am signing this object:

@DTailor
DTailor / backup_restore.sh
Last active Sep 15, 2019
Backup/Restore PostgreSQL Database
View backup_restore.sh
# List all databases
sudo -u postgres psql --list
# Create backup file
sudo -u postgres pg_dump [database_name] > dumpl.sql
# Drop the database
sudo -u prostgres dropdb [database_name]
# Create a new database
@DTailor
DTailor / gist:3955355
Created Oct 25, 2012
Get all objects added today from midnight
View gist:3955355
import datetime
from django.utils.timezone.utcnow().replace(tzinfo=utc)
now = datetime.datetime.utcnow().replace(tzinfo=utc)
midnight = now.replace(hour=0,minute=0,second=0,microsecond=0)
queries = YourModel.objects.filter(time__gte = midnight )
@DTailor
DTailor / sniffer.py
Created May 8, 2012
Raw Socket Sniffer
View sniffer.py
import socket
from struct import *
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)
while True:
pack = s.recvfrom(20000)
#Get the single element from the tuple
You can’t perform that action at this time.