Skip to content

Instantly share code, notes, and snippets.

View MinaGabriel's full-sized avatar

Mina MinaGabriel

View GitHub Profile
public void getCurrentLocation() {
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager) getSystemService(context);
Criteria crta = new Criteria();
crta.setAccuracy(Criteria.ACCURACY_FINE);
crta.setAltitudeRequired(false);
crta.setBearingRequired(false);
crta.setCostAllowed(true);
crta.setPowerRequirement(Criteria.POWER_LOW);
@MinaGabriel
MinaGabriel / gist:c97b7a22c40c94b283723c7226dc9b68
Created November 17, 2016 00:34
Python socket program Server/ Client with Android Client
****************** Server ********************
import socket
import sys
HOST = '192.168.142.160' #this is your localhost
PORT = 8888
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#socket.socket: must use to create a socket.
#socket.AF_INET: Address Format, Internet = IP Addresses.
@MinaGabriel
MinaGabriel / download_parse_entrezgene.py
Created March 24, 2017 21:08
download_parse_entrezgene
#!/usr/bin/python
import os
from urllib2 import urlopen, URLError, HTTPError
import re
# Change information as appropriate
# Where files will be downloaded and unzipped
def heapify(arr, n, i):
largest = i # Initialize largest as root
l = 2 * i + 1 # left = 2*i + 1
r = 2 * i + 2 # right = 2*i + 2
print(arr,"largest: " + str(largest), "i: " + str(i), "l: " + str(l), "r: " + str(r), h)
# See if left child of root exists and is
# greater than root
if l < n and arr[i] < arr[l]:
largest = l
@MinaGabriel
MinaGabriel / index.html
Created April 14, 2018 15:32
Connect to server using JQuery
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(function(){
$("button").click(function(){
//get the value of both (username and password fields)
var username = $("#username").val();
import matplotlib.pyplot as plt
from sklearn import datasets
iris = datasets.load_iris()
X = iris.data[:, 0:2]
y = iris.target
plt.scatter(X[:, 0], X[:, 1], c=y, edgecolor='k')
plt.xlabel('Sepal length')
plt.ylabel('Sepal width')
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model, datasets
from scipy.special import expit
from scipy.stats import binom
from scipy import stats
import pandas as pd
plt.subplot(2, 1, 1)
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
from scipy.stats import norm
fig = plt.figure()
ax = fig.gca(projection='3d')
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
import numpy as np
from scipy.stats import norm
fig = plt.figure()
ax = fig.gca(projection='3d')
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()