This file contains hidden or 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 Prime | |
| { | |
| static bool IsPrime(int num) | |
| { | |
| int to = (int)Math.Round(Math.Sqrt(num)); | |
| return !Enumerable.Range(2, to).Any(i => num % i == 0); | |
| } | |
| public static IEnumerable<int> GetPrimes(int count) | |
| { | |
| int current = 2; |
This file contains hidden or 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 math | |
| #verilen aralığa kadar asal sayıları bul ve liste olarak geri döndür find_primes(100) | |
| find_primes = lambda j: list(filter(lambda x: not any([i for i in range(2, int(round(math.sqrt(x))) + 1) if x % i == 0]), list(range(2, j + 1)))) | |
| #fibonacci jeneratörü | |
| def fibonacci(to): | |
| a, b = 1, 1 | |
| count = 1 | |
| while (count < to): |
This file contains hidden or 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 <iostream> | |
| using namespace std; | |
| int main() { | |
| int* a; | |
| int* b; | |
| int c=12; | |
| a=&c; |
This file contains hidden or 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
| Type type = this.getClass().getGenericSuperclass(); | |
| ParameterizedType pt = (ParameterizedType) type; | |
| Class c = (Class)pt.getActualTypeArguments()[0]; | |
| System.out.println(c.getSimpleName()); |
This file contains hidden or 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 django.contrib.auth.decorators import user_passes_test | |
| from django.contrib.auth import REDIRECT_FIELD_NAME | |
| from django.core.exceptions import PermissionDenied | |
| def has_any_role(roles, login_url=None, raise_exception=False): | |
| def check_role(user): | |
| if isinstance(roles, list): | |
| perms = roles |
This file contains hidden or 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
| package main | |
| import ( | |
| "crypto/sha256" | |
| "encoding/base64" | |
| "fmt" | |
| "golang.org/x/crypto/pbkdf2" | |
| "strconv" | |
| "strings" | |
| ) |
This file contains hidden or 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
| create database <dbname> with LC_COLLATE='tr_TR.UTF-8' LC_CTYPE='tr_TR.UTF-8' template=template0 owner='<owner>' |
This file contains hidden or 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 f1(n): | |
| import time | |
| start=time.time() | |
| a = ["Hi there "] | |
| for i in range(n): | |
| a.append(f"({i},{i}),") | |
| s="".join(a) | |
| end=time.time() | |
| print(f"{n} adet deneme -> {end-start}") | |
| return s |
This file contains hidden or 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
| package main | |
| import ( | |
| "bytes" | |
| "fmt" | |
| "strconv" | |
| "strings" | |
| "time" | |
| ) |
This file contains hidden or 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 flask import Flask, render_template | |
| from suds.client import Client | |
| app = Flask(__name__) | |
| class CityService(object): | |
| __cities = [] | |
| __loaded = False | |
| __wsdl = "https://api.n11.com/ws/CityService.wsdl" |