Skip to content

Instantly share code, notes, and snippets.

Advanced Git

Git foundations

Data storage

  • Git is like a key-value store
    • key = data
    • value = hash of the data
  • The key (SHA1)
@AhmadTawila
AhmadTawila / dumprequest.php
Created October 13, 2021 11:24 — forked from magnetikonline/dumprequest.php
PHP script to dump full HTTP request to file (method, HTTP headers and body).
<?php
// https://gist.github.com/magnetikonline/650e30e485c0f91f2f40
class DumpHTTPRequestToFile {
public function execute($targetFile) {
$data = sprintf(
"%s %s %s\n\nHTTP headers:\n",
$_SERVER['REQUEST_METHOD'],
$_SERVER['REQUEST_URI'],
@AhmadTawila
AhmadTawila / wordpress-upload-base64.php
Created July 13, 2021 18:31 — forked from cyberwani/wordpress-upload-base64.php
Upload a base64 string as image to the WordPress media library
<?php
/**
* Save the image on the server.
*/
function save_image( $base64_img, $title ) {
// Upload dir.
$upload_dir = wp_upload_dir();
$upload_path = str_replace( '/', DIRECTORY_SEPARATOR, $upload_dir['path'] ) . DIRECTORY_SEPARATOR;
#!/bin/bash
if [ $# -lt 1 ]
then
cat << HELP
dockertags -- list all tags for a Docker image on a remote registry.
EXAMPLE:
- list all tags for ubuntu:
# http://jerwinroy.blogspot.com/2015/04/view-current-userhostport-and-database.html
prompt = function() {
user = db.runCommand({connectionStatus:1}).authInfo.authenticatedUsers[0]
host = db.getMongo().toString().split(" ")[2]
curDB = db.getName()
if (user) {
uname = user.user
}
else {
@AhmadTawila
AhmadTawila / wifi-password
Created May 31, 2019 12:30
Display WIFI password Win cmd
netsh wlan show profiles key=clear name=<network-ssid>
@AhmadTawila
AhmadTawila / iterm2-solarized.md
Created November 21, 2018 13:05 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@AhmadTawila
AhmadTawila / README.md
Created June 22, 2018 11:45 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \