Skip to content

Instantly share code, notes, and snippets.

@s4l1h
s4l1h / v1.go
Created March 8, 2018 16:44
Golang JSON ve interface kullanımı.(v1)
package main
import (
"encoding/json"
"fmt"
)
// Person object
type Person struct {
FirstName, LastName string // Küçük harf olursa json kütüphanesi erişemeyecek.
acl CONNECT method CONNECT
# line 919: add (define ACL for internal)
acl lan src 10.0.0.0/24
http_access allow localhost
# line 1058: add (set ACL for internal)
http_access allow lan
http_access allow all
http_port 3120
via off
forwarded_for delete
@s4l1h
s4l1h / function.run.php
Last active November 9, 2017 14:08
Smarty call_user_func
<?php
// file : /smartyplugins/function.run.php
function smarty_function_run($params, $template)
{
//var_dump($params);
if ($params['method'] == '') {
trigger_error("url: run Komutunda method parametresi boş olamaz.");
return;
}
@s4l1h
s4l1h / debian-8-build-php-5.3.29.sh
Created February 28, 2017 13:39
Debian 8 (jessie) build php 5.3.29
#!/bin/bash
mkdir /opt/php-5.3.29
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget http://de.php.net/get/php-5.3.29.tar.bz2/from/this/mirror -O php-5.3.29.tar.bz2
tar jxf php-5.3.29.tar.bz2
# Thanks https://crybit.com/20-common-php-compilation-errors-and-fix-unix/
apt-get install libbz2-dev libxml2-dev libcurl4-openssl-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libc-client2007e-dev libkrb5-dev libmcrypt-dev libpq-dev libmysqlclient-dev
mkdir /usr/include/freetype2/freetype
@s4l1h
s4l1h / convert.sh
Last active January 25, 2017 23:15
Multiple File Encoding Conversion Raw
#!/bin/bash
# Test On Mac OS X
#
#enter input encoding here
FROM_ENCODING="ISO-8859-9"
#output encoding(UTF-8)
TO_ENCODING="UTF-8//TRANSLIT"
#convert
#iconv -f ISO-8859-9 -t UTF-8//TRANSLIT index.php -o index.php.utf8
CONVERT="iconv -f $FROM_ENCODING -t $TO_ENCODING"
package main
import (
"fmt"
"sync"
)
// Hit objemiz
type Hit struct {
count int
package main
import (
"fmt"
"sync"
)
// Hit objemiz
type Hit struct {
count int
func GetirOnu(key string,cache Cache) (string,error]){
value, err := cache.Get(key)
if err != nil {
fmt.Println("Hata Oluştu : ", err)
return "",error
}
return string(value),nil
}
/*
GetirOnu fonksiyonu gördüğünüz gibi ilk parametre olarak cache key alıyor
fakat ikinci parametre MemoryCache olmalı.
Redis yada memcache'e uyarlamak istediğinizde projedeki tüm MemoryCache yazan satırları değişmeniz gerekir
GetirOnu fonksiyonunu sadece MemoryCache ile çalışıyor.
*/
func GetirOnu(key string,cache *MemoryCache) (string,error]){
value, err := cache.Get(key)
if err != nil {
fmt.Println("Hata Oluştu : ", err)
@s4l1h
s4l1h / c1.go
Created October 16, 2016 14:11
package main
import (
"errors"
"fmt"
)
// Cache interface
type Cache interface {
// Name cache provider adını döndürecek