View Android location GPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
View download_parse_entrezgene.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
from urllib2 import urlopen, URLError, HTTPError | |
import re | |
# Change information as appropriate | |
# Where files will be downloaded and unzipped |
View gist:19fb603a4ac82999839ba01388cf1e8e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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(); |
View iris.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
View narmal_distribution_iris.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
View Max_likelihood_one_datapoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
View max_likelihood_2_datapoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
View tensorflow_mnist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
View Kmeans.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import numpy | |
import os | |
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' | |
numpy.set_printoptions(threshold=sys.maxsize) | |
import torch | |
from torch.distributions import normal | |
import seaborn as sns; |
OlderNewer