Skip to content

Instantly share code, notes, and snippets.

View MohammedRashad's full-sized avatar
🎸
Developing New Tech

Mohamed Rashad MohammedRashad

🎸
Developing New Tech
View GitHub Profile
@MohammedRashad
MohammedRashad / arduino_ROV.ino
Last active November 14, 2016 10:38
ROV Controlling Sketch, Receiving Commands via UART
#include <Servo.h>
Servo esc1;
Servo esc2;
Servo esc3;
Servo esc4;
int x = 220;
void setup() {
@MohammedRashad
MohammedRashad / SharedPreferences.java
Last active November 14, 2016 10:33
Helper Class for saving values in android using SharedPreferences
package com.dummyname.app;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
public class SharedPreferences{
SharedPreferences spf;
SharedPreferences.Editor edit;
@MohammedRashad
MohammedRashad / FragmentChange.java
Last active April 13, 2017 23:55
Helper Class to move between fragments in android
package com.dummy.app;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
public class FragmentChange {
FragmentTransaction fragmentTransaction;
public void setCurrentFragment(Fragment newFragment, Context mContext) {
@MohammedRashad
MohammedRashad / fibbonaci.c
Created November 15, 2016 14:42
Calculate a number in Fibonacci Series by its index
uint32_t fibonacci(uint32_t n){
if (n == 0) return 0;
if (n == 1) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);
}
@MohammedRashad
MohammedRashad / FizzBuzz.java
Created November 20, 2016 20:34
FizzBuzz Interview question in Java
public class FizzBuzz {
public static void main(String[] args) {
for (int i = 1; i <= 100; i++) {
if (i%3 == 0 && i%5 == 0)
System.out.println("FizzBuzz");
else if (i%5 == 0)
System.out.println("Buzz");
@MohammedRashad
MohammedRashad / power.c
Created November 20, 2016 20:37
calculate the power of any integer
uint32_t power(uint32_t n,uint32_t m){
if (m == 0) return 1;
if (m == 1) return n;
return n * power(m - 1);
}
@MohammedRashad
MohammedRashad / geometry.cpp
Created December 17, 2016 12:46
C++ program that calculates various shapes' perimeter, area and volume
#include <iostream>
#include <string>
#define PI 3.1415926
using namespace std;
///////////////////------------------Variables---------------/////////////////////////
@MohammedRashad
MohammedRashad / token.c
Created March 22, 2017 16:57
Token Counter
#include <stdio.h>
void vowelCounters() {
printf("Enter your String : ");
scanf("%s", & input);
printf("\n\nYour String : %s", input);
for (i = 0; i <= 20; i++) {
@MohammedRashad
MohammedRashad / calculator.c
Created March 22, 2017 16:58
Calculator Program
#include <stdio.h>
int main(int argc, char** argv) {
double x, y, z, n;
char a;
printf("===== Calculator App =====\n\n");
printf("Choose Operation : \n\n");
printf("1-Add");
@MohammedRashad
MohammedRashad / RESTful.py
Last active April 22, 2017 20:07 — forked from miguelgrinberg/rest-server.py
Code used to demonstrate RESTful APIs in my API Design Workshop in NASA Space Apps Ismailia 2017 (Data Bootcamp)
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask.ext.httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':