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 '',

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 / 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 / uiappearance-selector.md
Created November 16, 2015 18:12 — forked from mattt/uiappearance-selector.md
A list of methods and properties conforming to `UIAppearance` as of iOS 8.0

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

@engmsaleh
engmsaleh / gist:c7ecb5696e943d3da3ab
Created November 11, 2015 19:25 — forked from omz/gist:1102091
Creating arbitrarily-colored icons from a black-with-alpha master image (iOS)
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
@engmsaleh
engmsaleh / info.plist
Created October 6, 2015 19:05 — forked from jonalter/info.plist
iOS: launch your app from another app
// info.plist from Test 5
// Open your info.plist and look for CFBundleURLSchemes
// this is the string that you will use to open that app
// You can also copy the info.plist to the root of your app and edit it.
// You can even have multiple schemes that you can use to launch it.
// Here I can launch the app using either 'test5://' or 'pedro://'
// Be SURE to do a clean build
<key>CFBundleURLSchemes</key>
<array>
@engmsaleh
engmsaleh / gist:be0b4ba50ab94929b17a
Last active August 29, 2015 14:28 — forked from snikch/gist:3661188
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}