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 / linux_mysql_commands
Created August 2, 2017 16:18
Linux Mysql Commands
# Create User
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'newuser'@'%' IDENTIFIED BY 'password';
# Permissions
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'%';
FLUSH PRIVILEGES;
@mstfydmr
mstfydmr / apache2_configuration_on_linux
Last active August 2, 2017 16:43
Apache2 Configiration on Linux
# Virtual Host Config
# /etc/apache2/sites-available/criexe.com.conf
<VirtualHost *:80>
ServerName criexe.com
ServerAdmin mustafa@aydemir.im
DocumentRoot /var/www/criexe.com
<Directory "/var/www/criexe.com">
@mstfydmr
mstfydmr / scan_recursive.go
Last active December 9, 2022 01:02
Go Lang - Scan Folder Recursive. Find all files and folders.
package main
import (
"fmt"
"os"
"path/filepath"
"strings"
"log"
)
@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');
// ----------------------------------------------------
@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 / 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.

<?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 / 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
@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 / 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']