Skip to content

Instantly share code, notes, and snippets.

@halidaltuner
halidaltuner / gist:661404
Created November 3, 2010 17:35
uploadify image random name generating
<?php
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/images/products/';
$ext = pathinfo($_FILES['Filedata']['name'], PATHINFO_EXTENSION);
$newFileName = md5($tempFile.microtime()).'.'.$ext;
$targetFile = str_replace('//','/',$targetPath) . $newFileName;
move_uploaded_file($tempFile,$targetFile);
}
echo $newFileName;
@halidaltuner
halidaltuner / gist:716753
Created November 26, 2010 14:09
basic model get dns record
<?php
$sonuc = dns_get_record("halid.org", DNS_A + DNS_MX + DNS_CNAME + DNS_NS + DNS_PTR + DNS_TXT + DNS_HINFO + DNS_SOA + DNS_AAAA + DNS_A6 + DNS_SRV + DNS_NAPTR);
print_r($sonuc);
?>
@halidaltuner
halidaltuner / gist:842267
Created February 24, 2011 15:11
Wrapper Based Simple Android Application ( via Google Reader )
package com.kulucka.googlereaderwrapper;
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class GoogleReaderWrapper extends Activity
@halidaltuner
halidaltuner / gist:1007879
Created June 4, 2011 12:56
youtube-dl youtube video grabber
<form method="post">
<input type="text" name="url" value="" style="width: 300px">
<input type="submit" value="getir">
</form>
<?php
ob_start();
if(isset($_POST['url']))
@halidaltuner
halidaltuner / gist:3812208
Created October 1, 2012 14:43
Zimbra Multiple Account Removing from text file
OLD_IFS=$IFS
IFS=$'\n'
lines_ary=( $(cat "./mail.txt") )
IFS=$OLD_IFS
for idx in $(seq 0 $((${#lines_ary[@]} - 1))); do
line="${lines_ary[$idx]}"
zmprov da ${line}
printf "${line} removed!\n"
done
@halidaltuner
halidaltuner / .zshrc
Created January 7, 2013 20:32
my oh-my-zshrc profile
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="random"
setopt AUTO_CD # cd if no matching command
setopt AUTO_PARAM_SLASH # adds slash at end of tabbed dirs
setopt CHECK_JOBS # check bg jobs on exit
setopt EXTENDED_GLOB # globs #, ~ and ^
setopt EXTENDED_HISTORY # saves timestamps on history
setopt GLOB_DOTS # find dotfiles easier
setopt HASH_CMDS # save cmd location to skip PATH lookup
setopt HIST_EXPIRE_DUPS_FIRST # expire duped history first
@halidaltuner
halidaltuner / unicorn.rb
Created September 19, 2013 13:51
unicorn example conf for redmine
worker_processes 4
working_directory "/usr/local/share/redmine"
listen "/usr/local/share/redmine/tmp/pids/.unicorn.sock", :backlog => 64
listen 8080, :tcp_nopush => true
timeout 30
@halidaltuner
halidaltuner / redmine.nginx.conf
Created September 19, 2013 15:01
unicorn conf for nginx
upstream redmine_stack {
server unix:/usr/local/share/redmine/tmp/pids/unicorn.sock fail_timeout=0;
}
server {
client_max_body_size 100M;
server_name alanadi.com;
keepalive_timeout 5;
root /usr/local/share/redmine/public;
try_files $uri/index.html $uri.html $uri @app;
#!/bin/sh
#
# glassfish Startup script for glassfish
#
# chkconfig: - 99 01
# processname: glassfish
# config: /etc/glassfish/glassfish.conf
# config: /etc/sysconfig/glassfish
# pidfile: /var/run/glassfish.pid
# description: glassfish is a JavaEE Application Server
# for golang
# mkdir $HOME/go
# mkdir -p $GOPATH/src/github.com/user
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin