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 / gist:44419d07cbfab7bbdde7a294a340d9be
Created August 1, 2023 12:39 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
<?php
function addCanonicalTag($html, $url) {
$dom = new DOMDocument();
@$dom->loadHTML($html, LIBXML_HTML_NODEFDTD);
$head = $dom->getElementsByTagName('head')->item(0);
if ($head) {
$canonical = $dom->getElementsByTagName('link')->item(0);
@mstfydmr
mstfydmr / TailwindCSS_CheatSheet.json
Created November 19, 2022 21:21
TailwindCSS JSON Cheat Sheet
[
{
"title": "Layout",
"content": [
{
"title": "Aspect Ratio",
"docs": "https://tailwindcss.com/docs/aspect-ratio",
"description": "Utilities for controlling the aspect ratio of an element.",
"table": [
["aspect-auto", "aspect-ratio: auto;", ""],
@mstfydmr
mstfydmr / clean.sh
Created September 17, 2021 06:59 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
@mstfydmr
mstfydmr / mysql_cli.sql
Last active August 29, 2019 18:29
MySQL CLI
CREATE DATABASE dbname CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
# Dump
mysqldump -uUSER -pPASS DBNAME > dump.sql
# Restore
@mstfydmr
mstfydmr / pip_upgrade_all.sh
Created May 7, 2019 08:18
PIP - Upgrade All
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
@mstfydmr
mstfydmr / generate_ssh_key.sh
Created May 1, 2019 12:01
Generate SSH Key
ssh-keygen -t rsa
# === OR ====
mkdir /path/to/folder
chmod -R 755 /path/to/folder
ssh-keygen -t rsa -b 4096 -C "mustafa@aydemir.im" -f /path/to/folder/key -q -N “”
@mstfydmr
mstfydmr / sqlmap.md
Last active March 10, 2019 10:20
Sqlmap

Windows

C:\Python27\python.exe sqlmap.py -v 3 --risk=3 --level=3 --identify-waf --random-agent --tamper=space2comment -u URL

Linux

./sqlmap.py -v 3 --risk=3 --level=3 --identify-waf --random-agent --tamper=space2comment -u URL

Usage

sqlmap.py -u URL --dbs
sqlmap.py -u URL -D DATABASE --tables
@mstfydmr
mstfydmr / bytes.py
Created August 10, 2018 09:26 — forked from leepro/bytes.py
Human readable bytes conversions
## {{{ http://code.activestate.com/recipes/578019/ (r15)
#!/usr/bin/env python
"""
Bytes-to-human / human-to-bytes converter.
Based on: http://goo.gl/kTQMs
Working with Python 2.x and 3.x.
Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com>
License: MIT
# Install requirements
apt-get install -y build-essential
apt-get install -y checkinstall
apt-get install -y libreadline-gplv2-dev
apt-get install -y libncursesw5-dev
apt-get install -y libssl-dev
apt-get install -y libsqlite3-dev
apt-get install -y tk-dev
apt-get install -y libgdbm-dev
apt-get install -y libc6-dev