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
# Gets the next tag of the given branch | |
get_next_tag() | |
{ | |
latestTag=$(git describe --tags $(git rev-list --tags="$1-*" --max-count=1)) | |
tagC=$(git rev-parse $latestTag) | |
head=$(git rev-parse HEAD) | |
if [ "$tagC" == "$head" ]; then | |
return 1 |
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 count_bits(x): | |
num_bits = 0 | |
while x: | |
num_bits += x & 1 | |
x = x >> 1 | |
return num_bits | |
for i in range(10): |
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 get_sum_of_individual_digits(n: int, total: int = 0) -> int: | |
if n == 0: | |
# print(total) | |
return total | |
digit = n % 10 | |
total = total + digit | |
return get_sum_of_individual_digits(n // 10, total) |
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 get_sum_of_individual_digits(n: int, total: int = 0) -> int: | |
if n == 0: | |
# print(total) | |
return total | |
else: | |
digit = n % 10 | |
total = total + digit | |
return get_sum_of_individual_digits(n // 10, total) |
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 datetime | |
import scrapy | |
import re | |
from pathlib import Path | |
from urllib.parse import unquote | |
RE_URL = r"<loc>(https://\D+)</loc>" | |
RE_PATH = r"/([^a-z | /]+)" # The last part of the URL |
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 sum(array): | |
sum = 0 | |
for i in array: | |
sum += i | |
return sum | |
class Matrix(): | |
def __init__(self): | |
self.row = 0 | |
self.array = [[0]*6 for i in range(6)] |
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
int mid = 0; | |
int mn = 0; | |
int mx = 0; | |
int totalAnalogPinInUse = 9; //Please specify the total number of pins you used for the IR array | |
void setup() { | |
//put other setups | |
//calibrating the sensors | |
for(int i = 0; i<5000; i++){ |
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 requests | |
api_key = "ADD YOUR OWN API KEY" | |
def get_duration(source, destination, key): | |
query_url = "https://maps.googleapis.com/maps/api/distancematrix/json" | |
try: | |
data = requests.get(query_url, params={ | |
"destinations": destination, |
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
#include <stdio.h> | |
int main() { | |
float A,B,med; | |
scanf("%f %f",&A,&B); | |
med=((A*3.5)+(B*7.5))/(3.5+7.5); |
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
#include <stdio.h> | |
int main() { | |
float a,b,c,med; | |
scanf("%f%f%f", &a, &b, &c); | |
med = ((a*2) + (b*3)+(c*5)) / (2+3+5); | |
printf("MEDIA = %.1f\n", med); | |
NewerOlder