Skip to content

Instantly share code, notes, and snippets.

View mstfydmr's full-sized avatar
🚀
Focusing

Mustafa Aydemir mstfydmr

🚀
Focusing
View GitHub Profile
@mstfydmr
mstfydmr / parse_uptime_output.py
Last active July 21, 2018 08:19
Python3 - Linux uptime command output parser
# Parse Uptime
# ------------------------------
def parse_uptime(output = False):
try:
import re
parsed = []
@mstfydmr
mstfydmr / tcp_flags.txt
Created July 12, 2018 13:37 — forked from tuxfight3r/tcp_flags.txt
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@mstfydmr
mstfydmr / migrate-django.md
Last active October 24, 2018 06:07 — forked from sirodoht/migrate-django.md
How to migrate Django from SQLite to MySQL

How to migrate Django from SQLite to MySQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on MySQL. Then:

@mstfydmr
mstfydmr / copy_remote_files.py
Created April 15, 2018 13:57 — forked from mariusavram91/copy_remote_files.py
Copy remote files to local with Python's Paramiko
import os
import paramiko
paramiko.util.log_to_file('/tmp/paramiko.log')
paramiko.util.load_host_keys(os.path.expanduser('~/.ssh/known_hosts'))
host = 'local'
port = 22
username = 'user'
files = ['file1', 'file2', 'file3', 'file4']
@mstfydmr
mstfydmr / A.markdown
Created April 14, 2018 14:15 — forked from larrybotha/A.markdown
Add your public SSH key to your server in one command

Add Your Public SSH Key To Your Server In One Command

You will need to create .ssh/authorized_keys if it is not yet on your server.

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

Generating Your Own Public Key

@mstfydmr
mstfydmr / parse_ps_aux.py
Created March 20, 2018 13:42 — forked from cahna/parse_ps_aux.py
Parse the output of `ps aux` into a list of dictionaries representing the parsed process information from each row of the output.
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pprint
import subprocess
def get_processes():
"""
Parse the output of `ps aux` into a list of dictionaries representing the parsed
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@mstfydmr
mstfydmr / curl.md
Created February 1, 2018 17:05 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@mstfydmr
mstfydmr / gist:067ac5583c36c60a30263b454a492392
Created January 12, 2018 11:41 — forked from ozh/gist:8169202
Human readable time difference between 2 dates in PHP
<?php
/**
* Get human readable time difference between 2 dates
*
* Return difference between 2 dates in year, month, hour, minute or second
* The $precision caps the number of time units used: for instance if
* $time1 - $time2 = 3 days, 4 hours, 12 minutes, 5 seconds
* - with precision = 1 : 3 days
* - with precision = 2 : 3 days, 4 hours
@mstfydmr
mstfydmr / CreateWordpressUser.php
Last active October 26, 2019 13:06 — forked from jawinn/CreateWordpressUser.php
Create WordPress Admin User from PHP
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
// Delete it when you're done.
require_once('wp-blog-header.php');
require_once('wp-includes/registration.php');
// ----------------------------------------------------