Skip to content

Instantly share code, notes, and snippets.

Mohamed Saleh Zaied engmsaleh

Block or report user

Report or block engmsaleh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View K8S Cheatsheet
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 Oct 6, 2018 — forked from cecilemuller/letsencrypt_2019.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)
View letsencrypt_2018.md

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 Apr 15, 2017
Add new IAM user profile to AWS CLI
View gist:f40c644becf7d8bc5a465152f6460080
$ 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 Jan 1, 2016 — forked from r3econ/UIButton+VerticalLayout.h
UIButton category for centering title label and image vertically. The text label is placed below the image.
View UIButton+VerticalLayout.h
@interface UIButton (VerticalLayout)
- (void)centerVerticallyWithPadding:(float)padding;
- (void)centerVertically;
@end
@engmsaleh
engmsaleh / CEButton.h
Created Jan 1, 2016 — forked from oliverdowling/CEButton.h
A custom UIButton extension that can change title and image insets depending on button state.
View CEButton.h
//
// 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 Dec 23, 2015
Make UIToolBar transparent
View gist:3568f97acda9910683cc
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 Dec 23, 2015
Apply tint color on UIImage inside UIImageView
View gist:ede0a358dcdd3c209497
// 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];
@engmsaleh
engmsaleh / uiappearance-selector.md
Created Nov 16, 2015 — forked from mattt/uiappearance-selector.md
A list of methods and properties conforming to `UIAppearance` as of iOS 8.0
View uiappearance-selector.md

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

View Print in debugger the indexpath.row
expr (void)NSLog(@"indexPath row: %ld", (long int)[indexPath row])
@engmsaleh
engmsaleh / gist:6fa1f2ac1e572631cde4
Created Nov 13, 2015
Add Text on UIImage and return new UIImage
View gist:6fa1f2ac1e572631cde4
- (UIImage*)image:(UIImage*)image withText:(NSString*)text
{
CGRect rect = CGRectMake(0, 0, image.size.width, image.size.height);
UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);
[image drawInRect:rect];
/// Make a copy of the default paragraph style
NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
/// Set line break mode
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
You can’t perform that action at this time.