Skip to content

Instantly share code, notes, and snippets.

View erenhatirnaz's full-sized avatar
🏠
Working from home

Eren Hatırnaz erenhatirnaz

🏠
Working from home
View GitHub Profile
@erenhatirnaz
erenhatirnaz / web-crawler-loop.py
Last active May 30, 2016 06:15
Web Crawler Döngüsü
for site in sites: # sites dizisinin içerisinden linkleri tek tek getiriyoruz
if not site in visited: # eğer link visited dizisinin içerisinde yok ise(yani daha önce ziyaret edilmemiş ise):
status, response = http.request(site) # http.request fonksiyonu ile linki GET methodu ile ziyaret ediyoruz ve sitenin bize verdiği status kodunu status; bize verdiği html içerikli cevabı ise response değişkenine atıyoruz.
print("Scanning "+site+": ") # ekrana taradığımız linki yazdırıyoruz
for link in BeautifulSoup(response, parseOnlyThese=SoupStrainer('a')): # sitenin bize verdiği response'un içerisinden tüm a taglarını çekiyoruz(yani tüm linkleri)
if link.has_attr('href'): # ve href attribute'u(özelliği) varmı diye kontrol ediyoruz yani <a href='burada bişey varsa'></a>
url = urljoin(site, link['href']) # linkler site içerisinden /dosyaismi.html şeklinde geldiği için bunun önüne domain eklemek gerekiyor bu nedenle urllib kütüphanesinin urljoin fonksiyonundan yararlanarak düzgün linkimizi oluşturuy
@erenhatirnaz
erenhatirnaz / twitch
Last active April 20, 2016 12:51
Shows live streamers that you followed
#!/usr/bin/env ruby
require 'net/https'
require 'uri'
require 'json'
require 'colorize'
def get(url)
url = URI.parse(url)
req = Net::HTTP::Get.new(url.to_s)
http = Net::HTTP.new(url.host, url.port)
@erenhatirnaz
erenhatirnaz / letter-upper.c
Created January 20, 2019 06:33
ImageMagick paketindeki hatayı keşfetmek için kodladığım bir deney
#include <stdio.h>
#include <ctype.h>
#include <locale.h>
int main() {
setlocale(LC_ALL, "tr_TR.utf8");
// setlocale(LC_ALL, "en_US.utf8");
char ext = 'i';
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Register') }}</div>
<div class="card-body">
@erenhatirnaz
erenhatirnaz / teknoseyir.ts
Created May 18, 2020 08:21
Deno deniyoruz örneği. TeknoSeyir'de yazdığım Yazılım Gündemi - 19 yazısı için oluşturuldu. https://teknoseyir.com/blog/yazilim-gundemi-2020-19
import { bgRed, white, bold } from "https://deno.land/std/fmt/colors.ts";
let teknoseyir: string = bold("Tekno") + bold(bgRed(white("Seyir")));
console.log("Selam "+ teknoseyir +"! Deno deniyoruz.");
@erenhatirnaz
erenhatirnaz / auto-expander.user.js
Last active January 31, 2021 21:29
GitHub Dashboard Auto Expander
// ==UserScript==
// @name GitHub Dashboard Auto Expander
// @description This userscript clicks all 'expand' buttons on the dashboard
// @version 1.0
// @author Eren Hatırnaz
// @homepageURL https://gist.github.com/erenhatirnaz/754a561cca7b4310b86269af5c812afa
// @grant none
// @match https://github.com/
// ==/UserScript==
@erenhatirnaz
erenhatirnaz / Controller.php
Last active November 3, 2021 05:51
Controller.php
/**
* @OA\Info(
* title="Laravel OpenAPI Example",
* version="1.0"
* )
*
*/
class Controller extends BaseController
{
@erenhatirnaz
erenhatirnaz / LoginRequest.php
Last active November 3, 2021 05:52
AuthController@login
/**
* @OA\RequestBody(
* request="LoginRequest",
* required=true,
* @OA\JsonContent(
* required={"email", "password"},
* @OA\Property(property="email", type="string", description="E-mail address", example="john.doe@example.com"),
* @OA\Property(property="password", type="string", description="Password", example="123456"),
* )
* )
@erenhatirnaz
erenhatirnaz / Address.php
Last active November 3, 2021 05:53
Address Resource
/**
* @OA\Schema(
* schema="Address",
* @OA\Property(property="id", type="integer", description="Address ID", example=1),
* @OA\Property(property="type", type="string", enum={"home", "work", "other"}, description="Type", example="home"),
* @OA\Property(property="title", type="string", minLength=2, description="Title", example="Ev adresim"),
* @OA\Property(property="address", type="string", minLength=10, description="Address", example="Bahçeşehir 2. Kısım 12. Caddesi no: 12I İstanbul Başakşehir"),
* @OA\Property(property="address_recipe", type="string", minLength=2, description="Address recipe", example="erdal bakkal karşısı"),
* @OA\Property(property="lat_long", type="string", description="Coordinates, Format: LAT, LONG", example="41.08442, 28.67263"),
* @OA\Property(property="city", type="string", description="City", example="İstanbul"),
@erenhatirnaz
erenhatirnaz / l5-swagger.php
Created October 24, 2021 12:22
l5-swagger config
<?php
return [
// ...
'securityDefinitions' => [
'securitySchemes' => [
'token' => [
'type' => 'http',
'description' => 'Bearer token for user',
'scheme' => 'bearer',