Skip to content

Instantly share code, notes, and snippets.

View selcukusta's full-sized avatar

Selçuk Usta selcukusta

View GitHub Profile
PUT /first_index HTTP/1.1
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"default": {
"filter": [
"lowercase",
public class MathFunctionsFixture
{
[Theory, ClassData(typeof(ExceptionTestTheoryData))]
public void Divide_ShouldAssertsTrue_WhenCultureSecondValueIsZero(ExceptionTestParameter parameter)
{
var exceptionType = Assert.ThrowsAny<SystemException>(() => parameter.FirstValue / parameter.SecondValue);
Assert.True(exceptionType.GetType().IsAssignableFrom(parameter.ExceptedException));
}
}
public class ExceptionTestTheoryData : TheoryData<ExceptionTestParameter>
{
public ExceptionTestTheoryData()
{
Add(new ExceptionTestParameter
{
FirstValue = 15,
SecondValue = 0,
ExceptedException = typeof(DivideByZeroException)
});
public class ExceptionTestParameter
{
public int? FirstValue { get; set; }
public int? SecondValue { get; set; }
public Type ExceptedException { get; set; }
}
from slackclient import SlackClient
slackclient = SlackClient("Buraya Bot User OAuth Access Token gelecek")
def get_users_in_channel(channel_id):
result = slackclient.api_call("conversations.members", channel=channel_id)
return result["members"]
def send_message(channel_id):
message = ":poultry_leg: *EFSANE ÖĞLEN YEMEĞİ* :poultry_leg:"
public static class MessagingFunction
{
[FunctionName("MessagingFunction")]
public static async Task<object> Run([HttpTrigger(WebHookType = "")]HttpRequestMessage req, TraceWriter log)
{
string jsonContent = await req.Content.ReadAsStringAsync();
var payload = PayloadHelper.GetPayload(WebUtility.UrlDecode(jsonContent));
if (string.IsNullOrWhiteSpace(payload))
{
return req.CreateResponse(HttpStatusCode.BadRequest, new { error = "Invalid payload format" });
/Home/Singleton /Home/PerRequest
568 ms 328 ms
37 ms 427 ms
64 ms 371 ms
36 ms 306 ms
34 ms 312 ms
44 ms 276 ms
36 ms 255 ms
29 ms 230 ms
30 ms 227 ms
curl -X POST \
http://localhost:9200/shopping_index/_search \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"aggs": {
"categories": {
"terms": {
"field": "CategoryId"
}
curl -X POST \
http://localhost:9200/shopping_index/_search \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{
"query": {
"bool": {
"filter": {
"term": {
"CategoryId": 3
curl -X POST \
http://localhost:9200/shopping_index/_bulk \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d '{"index":{"_index":"shopping_index", "_type":"product", "_id" : 1}}
{ "ProductName" : "Aeden (Bir Dünya Hikayesi) - Azra Kohen", "CategoryId":1, "Price" : 21.50}
{"index":{"_index":"shopping_index", "_type":"product", "_id" : 2}}
{ "ProductName" : "Taht Oyunları (9 Kitap) - George R. R. Martin", "CategoryId":1, "Price" : 199.00}
{"index":{"_index":"shopping_index", "_type":"product", "_id" : 3}}
{ "ProductName" : "Yüzüklerin Efendisi (3 Kitap Tek Cilt) - J. R. R. Tolkien", "CategoryId":1, "Price" : 86.86}