Skip to content

Instantly share code, notes, and snippets.

View engmsaleh's full-sized avatar

Mohamed Saleh Zaied engmsaleh

View GitHub Profile
@engmsaleh
engmsaleh / wpdb_default_tables.sql
Created September 26, 2023 14:20 — forked from rnagle/wpdb_default_tables.sql
Default WordPress Database Table Create Statements
DROP TABLE IF EXISTS wp_users;
CREATE TABLE wp_users (
ID bigint(20) unsigned NOT NULL auto_increment,
user_login varchar(60) NOT NULL default '',
user_pass varchar(64) NOT NULL default '',
user_nicename varchar(50) NOT NULL default '',
user_email varchar(100) NOT NULL default '',
user_url varchar(100) NOT NULL default '',
user_registered datetime NOT NULL default '0000-00-00 00:00:00',
user_activation_key varchar(60) NOT NULL default '',
@engmsaleh
engmsaleh / phpstorm-xdebug.md
Last active May 8, 2021 10:30
PhpStorm 2020.3 with Xdebug 2.9.8 Setup on Ubuntu 2020

Instruction collected from multiple sources, there may be unnecessary steps, but that what worked with me after 4 days of stuggling :), so I'm recording it all

Install Xdebug 2.9.8 using pecl

sudo apt -y install php7.4-dev php-pear
pecl install xdebug-2.9.8

Create xdebug.ini file in mods-available

Triggering a Cron Job manually on Kubernetes

So you've defined a cronjob.yaml manifest, but it doesn't run until midnight and you want to test it now? Simply replace the variables, and run the following command to create a job from the cronjob.

kubectl create job --from=cronjob/{{ cron_job_name }} {{ the-name-of-this-one-off-job }}

This will create a one-off job in your cluster based on your cronjob.yaml manifest, which might look something like this.

apiVersion: batch/v1beta1
kubectl get services # List all services
kubectl get pods # List all pods
kubectl get nodes -w # Watch nodes continuously
kubectl version # Get version information
kubectl cluster-info # Get cluster information
kubectl config view # Get the configuration
kubectl describe node <node> # Output information about a node
kubectl get pods # List the current pods
kubectl describe pod <name> # Describe pod <name>
kubectl get rc # List the replication controllers
@engmsaleh
engmsaleh / letsencrypt_2018.md
Last active October 6, 2018 20:00 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@engmsaleh
engmsaleh / gist:f40c644becf7d8bc5a465152f6460080
Created April 15, 2017 17:42
Add new IAM user profile to AWS CLI
$ aws configure --profile account1
// To use the profile
$ aws s3 ls --profile account2
// To set the default profile
$ export AWS_DEFAULT_PROFILE=account1
@engmsaleh
engmsaleh / UIButton+VerticalLayout.h
Created January 1, 2016 00:27 — forked from r3econ/UIButton+VerticalLayout.h
UIButton category for centering title label and image vertically. The text label is placed below the image.
@interface UIButton (VerticalLayout)
- (void)centerVerticallyWithPadding:(float)padding;
- (void)centerVertically;
@end
@engmsaleh
engmsaleh / CEButton.h
Created January 1, 2016 00:26 — forked from oliverdowling/CEButton.h
A custom UIButton extension that can change title and image insets depending on button state.
//
// CEButton.h
//
// Created by Cemal Eker on 11/12/13. (2013-11-12)
// Mofidied by Oliver Dowling on 2014-04-28.
//
#import <UIKit/UIKit.h>
@interface CEButton : UIButton
@engmsaleh
engmsaleh / gist:3568f97acda9910683cc
Created December 23, 2015 19:16
Make UIToolBar transparent
if ([self.shareFooterToolBar respondsToSelector:@selector(setBackgroundImage:forToolbarPosition:barMetrics:)]) {
[self.shareFooterToolBar setBackgroundImage:[UIImage new] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault];
}
if ([self.shareFooterToolBar respondsToSelector:@selector(setShadowImage:forToolbarPosition:)]) {
[self.shareFooterToolBar setShadowImage:[UIImage new] forToolbarPosition:UIToolbarPositionAny];
}
@engmsaleh
engmsaleh / gist:ede0a358dcdd3c209497
Last active December 23, 2015 13:19
Apply tint color on UIImage inside UIImageView
// Source http://mikethinkingoutloud.com/color-a-uiimage/
// init the image using imageWithRenderingMode set to AlwaysTemplate
UIImage *image = [[UIImage imageNamed:@"checkmark"]
imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
// put UIImage in a UIImageView and adjust color with tintColor
UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
imageView.tintColor = [UIColor redColor];