Skip to content

Instantly share code, notes, and snippets.

View halilim's full-sized avatar

Halil Özgür halilim

View GitHub Profile
@halilim
halilim / gezgin.php
Last active December 22, 2015 02:49
A PHP file and db explorer (shell?) experiment from the past
<?php //İ
define('_K','b7f3l0h');
define('U_IPC',true);
define('U_U','test');
define('U_P','test');
define('U_UA',$_SERVER['HTTP_USER_AGENT']);
define('U_IP',$_SERVER['REMOTE_ADDR']);
// todo: secure this (i.e. include in the logged in part)
if (isset($_GET['dl']))
@halilim
halilim / bozuk_turkce_karakter_duzelt.php
Created September 1, 2013 18:32
Bozuk Türkçe karakter düzelt - Fix corrupt Turkish characters
<?php
function array_make_first(&$array, $element) {
if (($ndx = array_search($element, $array)) !== false) {
unset($array[$ndx]);
array_unshift($array, $element);
}
}
$encler = mb_list_encodings();
@halilim
halilim / mysql_mass_change_charset.php
Last active December 22, 2015 02:49
Mass MySQL database character set changer
<html>
<head>
<title>Mass MySQL database character set changer</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<pre><?php
$db_host = 'localhost';
$db_user = 'root';
@halilim
halilim / mass_convert_encoding.php
Created September 1, 2013 16:01
Mass convert encodings of files with selected extensions in a folder recursively.
#!/usr/bin/php
<?php
if (count($argv) < 6) {
echo '
Usage :
> php ' . $_SERVER['SCRIPT_FILENAME'] . '
source_folder
destination_folder
source_charset
@halilim
halilim / DNS-Switcher.jse
Created September 1, 2013 14:11
Windows DNS Switcher - Switch your DNS resolvers for all network interfaces in Windows from command line.
/**
* Windows DNS Switcher - Don't wear out your mouse trying to change your DNS server adresses.
* @author Halil Ozgur
* @license GPL Licence
*/
var dnsler = [
["Empty (DHCP-Auto)", []],
["OpenDNS", ["208.67.222.222", "208.67.220.220"]],
["Google DNS", ["8.8.8.8", "8.8.4.4"]],
@halilim
halilim / switch.bat
Created August 25, 2013 16:41
Simple Apache/PHP version switcher. Assumes there are folders like "php5.4", "Apache2.4Win64VC11", "php5.5VC11x64ts" etc with php and Apache unzipped. Usage: switch 2.4 5.5
:: Simple Apache/PHP version switcher. Assumes there are folders like "php5.4",
:: "Apache2.4Win64VC11", "php5.5VC11x64ts" etc with php and Apache unzipped.
:: Usage: switch 2.4 5.5
@echo off
:: Get Apache service version, e.g. 2.2/2.4
set ApacheName=%1
set ApacheServiceVersion=%ApacheName:~0,3%
@halilim
halilim / thunderbird_with_smtp__log.bat
Created August 6, 2013 08:51
Start Thunderbird with logging enabled - Windows
set NSPR_LOG_MODULES=smtp:5
set NSPR_LOG_FILE=D:\Users\halil\Desktop\smtp.log
"%ProgramFiles(x86)%\Mozilla Thunderbird\thunderbird.exe"
@halilim
halilim / bitki_puan_sira.sql
Created August 4, 2013 13:33
Bitki puan sırası
SELECT
t.bid, t.badi, t.averaj, t.sira
FROM (
SELECT b.bid, b.badi, p.averaj, @sira := @sira + 1 AS sira
FROM bitki b
JOIN (SELECT @sira := 0) r
INNER JOIN (SELECT bid,AVG(puan) averaj FROM puanlar GROUP BY bid) p ON p.bid=b.bid
ORDER BY p.averaj DESC
) t
WHERE t.bid = 3;
<?php
// http://googlewebmastercentral.blogspot.com/2011/01/how-to-deal-with-planned-site-downtime.html
header('HTTP/1.1 503 Service Temporarily Unavailable');
?>
<!doctype html>
<html itemscope itemtype="http://schema.org/WebPage">
<head>
<meta charset="utf-8">
<title>Company Name</title>
</head>
@halilim
halilim / optionTextPluckJoin.js
Created July 26, 2013 08:47
Pluck texts of all options of a select and join them with \n. Useful for pasting into Navicat.
jQuery.makeArray($("<SELECTOR>").find("option").map(function() { return $(this).text(); })).join("\n");