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 <sstream> | |
stringstream ss; | |
string s; //main string | |
string newString; //new string | |
ss << s; //assign s to ss | |
while(ss >> newString) { // Spilit string |
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
PREFIX ab: <http://learningsparql.com/ns/addressbook#> | |
SELECT ?name | |
WHERE { | |
?name ab:email "[email protected]" . | |
} |
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
@prefix ab: <http://learningsparql.com/ns/addressbook#> . | |
ab:ali_gatie ab:borns "Yemen" . | |
ab:ali_gatie ab:homeTel "01700000" . | |
ab:ali_gatie ab:email "[email protected]" . | |
# If we want to add more person... | |
ab:richard ab:borns "Berlin" . | |
ab:richard ab:homeTel "01700001" . | |
ab:richard ab:email "[email protected]" . |
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
@prefix ab: <http://learningsparql.com/ns/addressbook#> . | |
ab:ali_gatie ab:borns "Yemen" ; | |
ab:homeTel "01700000" ; | |
ab:email "[email protected]" . | |
# If we want to add more person... | |
ab:richard ab:borns "Berlin" ; | |
ab:homeTel "01700001" ; | |
ab:email "[email protected]" . |
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
input { | |
elasticsearch { | |
hosts => "localhost:9200" | |
index => "give_index_name" | |
query => ' | |
{ | |
"query": { | |
"match_all": {} | |
} | |
} |
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
# delete all data from _doc | |
curl -XPOST 'localhost:9200/pathao/zone_path/_delete_by_query?conflicts=proceed&pretty' -d' | |
{ | |
"query": { | |
"match_all": {} | |
} | |
}' | |
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
#!/bin/python3 | |
S = input().strip() | |
try: | |
print(int(S)) | |
except ValueError: | |
print('Bad String') |
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
class Difference: | |
def __init__(self, a): | |
self.__elements = a | |
self.maximumDifference = -1 | |
def computeDifference(self): | |
e = self.__elements | |
m = -1 | |
for i in range(len(e)): | |
for j in range(i+1, len(e)): |
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 abc import ABCMeta, abstractmethod | |
class Book(object, metaclass=ABCMeta): | |
def __init__(self,title,author): | |
self.title=title | |
self.author=author | |
@abstractmethod | |
def display(): pass | |
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
#!/bin/python3 | |
if __name__ == '__main__': | |
n = int(input()) | |
b = bin(n)[2:] # dec to binary | |
c = 0 | |
a = -1 | |
for i in b: | |
if i == '1': | |
c += 1 |
NewerOlder