Skip to content

Instantly share code, notes, and snippets.

// Burdaki gibi çağırman lazım
$fields = array('searchTerm', 'clicks', 'impressions', 'convertedClicks', 'cost', 'totalConvValue', 'day');
$parameters['ignoreDimensions'] = array('day');
$searchTerms = AdProReports::DownloadSearchTermReport($fields,30, $parameters);
//Bu da search term methodu
public static function DownloadSearchTermReport($fields, $range = 30, $parameters = array()){
// Type of the report.
@karakanb
karakanb / github-trending.js
Created March 22, 2018 11:38
A sample JS request exported from Postman, fetching the trending repositories from GitHub API.
import concurrent.futures
import time
def function_to_execute_in_parallel(id):
# Function that takes long time.
time.sleep(abs(3 - id))
# Print id to test the order.
print("-- Processed id: %d -- " % id)
@karakanb
karakanb / README.md
Last active October 25, 2018 22:42
How to create an Nginx proxy container using Docker

Minikube Proxy

For a project of mine, I needed a way to make my minikube cluster reachable over localhost:4567, which seems to have no easy solution with basic tools. The script here basically uses the provided nginx.conf file and proxies all the requests to your provided IP address. In my case, my minikube installation had the IP address 192.168.99.101, which means my nginx.conf file was like this:

server {
  listen 80;
  server_name localhost;
    location / {
      access_log off;
      proxy_pass http://192.168.99.101;
 proxy_set_header X-Real-IP $remote_addr;
@karakanb
karakanb / asus.py
Last active January 13, 2020 13:48
some dumb scripts to retrieve list of clients from an asus modem
import base64
import json
import urllib2
class Asus(object):
def __init__(self, ip, username, password):
self.ip = ip
self.username = username
self.password = password
@karakanb
karakanb / Dockerfile
Last active February 1, 2020 19:50
Acceptance Tests Dockerfile
FROM python:3.8-alpine3.11
# update apk repo
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.11/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.11/community" >> /etc/apk/repositories
# install chromedriver
RUN apk --no-cache add chromium chromium-chromedriver
# install selenium
module.exports.producthunt = (event, context, callback) => {
var url = 'https://api.producthunt.com/v1/posts?access_token=my-api-token';
helpers.get(url, output => {
callback(null, helpers.rawResponse(JSON.parse(output).posts));
}, err => callback(null, helpers.failure(err.message)));
}
@karakanb
karakanb / serverless.yml
Created February 20, 2020 23:26
The Serverless Framework configuration file that is used for Devo backend.
service: devo-backend
provider:
name: aws
runtime: nodejs10.x
functions:
github:
handler: handler.github
events:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
namespace Tests\Feature;
use App\User;
use Laravel\Cashier\SubscriptionBuilder;
use Tests\TestCase;
use function route;