Skip to content

Instantly share code, notes, and snippets.

@ademalp
ademalp / .htaccess
Last active June 15, 2017 13:14
X-Frame-Options
<ifModule mod_headers.c>
#Header unset X-Frame-Options
Header set X-Frame-Options ALLOW-FROM https://www.youtube.com/
</ifModule>
@ademalp
ademalp / l298n.ino
Last active April 8, 2017 10:57
Arduino L298N Pot ile İleri Geri Hız
int motorpin1 = 7;//dijital pin
int motorpin2 = 8;//dijital pin
int hizpin = 9;//pwm pin
int potpin = A0;//analog pin
void setup() {
pinMode(motorpin1, OUTPUT);
pinMode(motorpin2, OUTPUT);
pinMode(hizpin, OUTPUT);
}
void ileri(int hiz) {
@ademalp
ademalp / info.php
Last active September 23, 2016 12:22
<?php
echo php_ini_loaded_file();
class STR
{
private static $tr_lo = array("ı", "ğ", "ü", "ş", "i", "ö", "ç");
private static $tr_up = array("I", "Ğ", "Ü", "Ş", "İ", "Ö", "Ç");
public static function strtolower($str, $encoding = "UTF-8")
{
return mb_convert_case(str_replace(self::$tr_up, self::$tr_lo, $str), MB_CASE_LOWER, $encoding);
}
<?php
function encrypt($plaintext,$plainkey){
$key = pack('H*', "$plainkey");
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$plaintext_utf8 = utf8_encode($plaintext);
$ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key,
@ademalp
ademalp / thumb.php
Last active December 17, 2015 09:59
<?php
$i = isset($_GET['f']) ? $_GET['f'] : "";//$yok;
$x = isset($_GET['w']) ? intval($_GET['w']) : 100;
$y = isset($_GET['h']) ? intval($_GET['h']) : 0;
$noimage = false;
if (is_file($i))
{
list($w, $h, $t) = getimagesize($i);
if (in_array($t, array(1, 2, 3))) {
@ademalp
ademalp / array_pattern.php
Created March 27, 2013 09:15
POST ya da herhangi bir dizinin keylerini verilen patterne göre filtreler.
<?php
function array_pattern($array,$pattern)
{
$return = array();
foreach($array as $key => $value)
{
$ret = sscanf($key, $pattern);
$pass = true;
foreach($ret as $val)
@ademalp
ademalp / image.php
Created March 27, 2013 08:15
Resimleri ajax ile html'ye aktarmak
<?php
function resize($resim, $max_en, $max_boy)
{
$boyut = getimagesize($resim);
$en = $boyut[0];
$boy = $boyut[1];
$x_oran = $max_en / $en;
$y_oran = $max_boy / $boy;
<?php
$xml = json_decode(json_encode((array) simplexml_load_file("https://api.twitter.com/1/followers/ids.xml?screen_name=BerkayGmstkn")), 1);
$takipciler = $xml['ids']['id'];
$xml = json_decode(json_encode((array) simplexml_load_file("https://api.twitter.com/1/following/ids.xml?screen_name=BerkayGmstkn")), 1);
$takip_edilenler=$xml['ids']['id'];
var_export(array_diff($takipciler,$takip_edilenler));
#!/bin/bash
# httpd.load.sh
# Script to check the 1-minute server load and sends a mail.
# script must be run as root; we run it from crontab every five minutes
# Copyright (C) NoBaloney Internet Services
# Licensed under GNU General Public License, Version 2
# Required Customizations:
SERVER_NAME="SERVER4"
EMAIL_ADDRESS="[email protected]"