Skip to content

Instantly share code, notes, and snippets.

View hakanu's full-sized avatar
🎯
Focusing

Hakan hakanu

🎯
Focusing
View GitHub Profile
@hakanu
hakanu / tr_instagram_image_downloader.py
Created October 16, 2020 00:03
[paylas.io/r/python] Instagram'dan foto indirme scripti
import json
import requests
import re
html = requests.get('https://www.instagram.com/instagram/').text
print('Instagramdan cektigim html boyutu: ', len(html))
pattern = '<script type="text\/javascript">window._sharedData = (.*?);<\/script>'
@hakanu
hakanu / .vimrc
Last active December 21, 2018 21:43
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@hakanu
hakanu / forwarding_server.py
Created February 21, 2017 22:29
Minimal proxy server for get requests
# -- coding: utf-8 --
import urllib
import json
import web
import requests
urls = (
'/.*', 'MainHandler'
)
@hakanu
hakanu / cifar.py
Last active October 23, 2016 23:54
Convolutional neural network based on cifar data. Base code: https://github.com/tflearn/tflearn/blob/master/examples/images/convnet_cifar10.py
# -*- coding: utf-8 -*-
""" Convolutional network applied to CIFAR-10 dataset classification task.
References:
Learning Multiple Layers of Features from Tiny Images, A. Krizhevsky, 2009.
Links:
[CIFAR-10 Dataset](https://www.cs.toronto.edu/~kriz/cifar.html)
"""
from __future__ import division, print_function, absolute_import
@hakanu
hakanu / eksi_backup_xml_to_json.py
Created March 30, 2016 09:58
Eksisozluk backup xmllerini json formatina cevirmece konvertoru
import json
import re
import sys
entry_xml_path = sys.argv[1]
print 'parsing: ', entry_xml_path
lines = open(entry_xml_path, 'r').read().split('\n')
entry_dict = {}
entries = []
@hakanu
hakanu / setup_dev.sh
Last active September 3, 2017 14:00
Initial development environment setup for ubuntu after clean install
# curl https://gist.githubusercontent.com/hakanu/7a8a14f60bdc8478d194/raw/3c02c7c3f0c30cee4348016ceb6a6d528a6e86ac/setup_dev.sh | bash
# Base stuff.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install build-essential
sudo apt-get -y install git
sudo apt-get -y install screen
sudo apt-get -y install ruby
#!/usr/bin/env python
"""Utility methods for Google Spreadsheets based on gspread library.
Used mostly for logging.
http://hakanu.net/2014/09/14/how-i-store-server-logs-in-google-spreadsheets/
Here are the dependecies:
sudo apt-get install python-pip python-dev build-essential
sudo easy_install gspread
"""
@hakanu
hakanu / capitalize.java
Last active August 29, 2015 14:04
Java Capitalize a sentence with multiple words (especially for Turkish)
public static String capitalize(String line) {
String[] words = line.split(" ");
StringBuilder sb = new StringBuilder();
for(String word: words) {
sb.append(Character.toUpperCase(word.charAt(0)));
sb.append(word.substring(1).toLowerCase(new Locale("tr", "TR")));
sb.append(" ");
}
return sb.toString();
}
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@hakanu
hakanu / json_ghostify.py
Last active August 29, 2015 14:01
A very simple script which transforms wordpress dump json into ghost-import friendly format
"""A very simple script which transforms wordpress dump into ghost-import
friendly format. This is just a quick script for migration.
This script solves the postgres related problems like:
- RejectionError: current transaction is aborted, commands ignored until end of
transaction block
- js console: POST http://haku.io/ghost/api/v0.1/db/ 503 (Service Unavailable)
http://devdala.files.wordpress.com/2014/05/screen-shot-2014-05-26-at-16-43-08.png
Detailed explanation: