Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Taha Doğan Güneş tdgunes

🎯
Focusing
Block or report user

Report or block tdgunes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tdgunes
tdgunes / demo.cpp
Created Mar 20, 2015
g++ demo.cpp -g -lSDL2 -lSDL2_ttf -framework OpenGL -lGLEW -o demo
View demo.cpp
//From here but switched to 3.3 http://stackoverflow.com/questions/19748147/sdl-ttf-draws-garbage
#include <GL/glew.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>
#include <SDL2/SDL_ttf.h>
#include <string>
#include <iostream>
View quicksort.py
import random
def partition(lst, left, right, pivotIndex):
# print pivotIndex
pivotValue = lst[pivotIndex]
lst[pivotIndex], lst[right] = lst[right], lst[pivotIndex]
storeIndex = left
@tdgunes
tdgunes / gist:87fce4f335cee4c934b7
Created Oct 25, 2014
IE381 - Calculating GINI and Entropy
View gist:87fce4f335cee4c934b7
import math
def cal_entropy(lst):
t = sum(lst)
result = 0
for i in lst:
division = float(i)/float(t)
View KeychainService.swift
import UIKit
import Security
let serviceIdentifier = "com.company"
let accessGroup = "com.company.app"
let kSecClassValue = kSecClass as NSString
let kSecAttrAccountValue = kSecAttrAccount as NSString
let kSecValueDataValue = kSecValueData as NSString
let kSecClassGenericPasswordValue = kSecClassGenericPassword as NSString
@tdgunes
tdgunes / city_town.json
Created Jul 11, 2014
Dataset for finding the closest city to a point for Mongo, taken with QGIS from Natural Earth Map dataset
View city_town.json
{"lat": -34.47999900541754, "type": "city/town", "lon": -57.84000247340134, "name": "Colonia del Sacramento", "country": "Uruguay"}
{"lat": -33.5439989373607, "type": "city/town", "lon": -56.90099656015872, "name": "Trinidad", "country": "Uruguay"}
{"lat": -33.1389990288435, "type": "city/town", "lon": -58.3039974719095, "name": "Fray Bentos", "country": "Uruguay"}
{"lat": -34.538004006675465, "type": "city/town", "lon": -56.28400149324307, "name": "Canelones", "country": "Uruguay"}
{"lat": -34.09900200521719, "type": "city/town", "lon": -56.21499844799416, "name": "Florida", "country": "Uruguay"}
{"lat": 9.26100006831723, "type": "city/town", "lon": 0.7890035737781318, "name": "Bassar", "country": "Togo"}
{"lat": 8.557002133057097, "type": "city/town", "lon": 0.9849964623313099, "name": "Sotouboua", "country": "Togo"}
{"lat": 33.399999002467325, "type": "city/town", "lon": 10.4166995575967, "name": "Medenine", "country": "Tunisia"}
{"lat": 33.689997034920566, "type": "city/town", "lon": 8.9710025379012, "nam
@tdgunes
tdgunes / geo_test_gen.py
Created Jul 10, 2014
Test data generator
View geo_test_gen.py
# !/usr/bin/python
# -*- coding: utf-8 -*-
"""
geo_test_gen.py
~~~~~~~~~~
Author: Taha Dogan Gunes
"""
import json
@tdgunes
tdgunes / test.py
Created Jul 7, 2014
Pyplyn multiple pipes
View test.py
import pyplyn as p
first_pipe = p.Pipe(name="first")
first_pipe.add(p.LambdaFilter(lambda x: "hello" in x))
first_pipe.add(p.LambdaExtension(lambda x: x.title()))
first_pipe.add(p.Writer("./test/output-1.txt"))
second_pipe = p.Pipe(name="second")
second_pipe.add(p.LambdaFilter(lambda x: "world" in x))
@tdgunes
tdgunes / pipe.py
Last active Aug 29, 2015
Python Terminal A Progress bar
View pipe.py
#...
class MongoProgressBarElement(FilterPipeElement):
def __init__(self, db_name, collection_name, sample):
self.total = pymongo.MongoClient()[db_name][collection_name].find().count()
self.count = 0
self.sample_count = 0
self.start = 0
self.operation_time = 0
self.total_operation = 0
View TFTDisplayText.ino
// Taha Dogan Gunes
// tdgunes@gmail.com
// Edited the example 'TFTDisplayText'
// So you can use the same diagram to connect the wires to screen
#include <TFT.h>
#include <SPI.h>
@tdgunes
tdgunes / add_ssh.py
Last active Aug 29, 2015
My Terminal Utils
View add_ssh.py
# Using this method:
# http://www.linuxproblem.org/art_9.html
import os
import save_as_alias
user = raw_input("User(root etc.): ")
host = raw_input("Host(x.x.x.x): ")
path = os.getcwd()
You can’t perform that action at this time.