Skip to content

Instantly share code, notes, and snippets.

View Ardakilic's full-sized avatar

Arda Kılıçdağı Ardakilic

View GitHub Profile
@Ardakilic
Ardakilic / nokiaLCDSPI.py
Created April 19, 2013 08:59
Raspberry Pi GPIO Nokia LCD w/ SPI
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# by Texy and the raspberry pi community
# bitmap display routine by POSitality
# this version using the SPI pins, but not
# using spidev
# 19/1/2013
import time
import wiringpi
#!/usr/bin/python
#
# HD44780 LCD Test Script for
# Raspberry Pi
#
# Author : Matt Hawkins
# Site : http://www.raspberrypi-spy.co.uk
#
# Date : 26/07/2012
#
@Ardakilic
Ardakilic / User.php
Created August 12, 2013 08:36
Laravel 4 User Class Extending Sentry If you use Sentry2 like me with Laravel 4, When using User model, you will get some errors. To prevent these, alter your user.php like this:
<?php
//use Illuminate\Auth\UserInterface;
//use Illuminate\Auth\Reminders\RemindableInterface;
class User extends Cartalyst\Sentry\Users\Eloquent\User {
//your shiny code comes here
}
@Ardakilic
Ardakilic / User.php
Last active January 25, 2016 16:52
To find all unbanned/unsuspended users with Sentry 2 using Laravel 4, try this method:
<?php
class User extends Cartalyst\Sentry\Users\Eloquent\User {
/**
* @author Arda Kılıçdağı,
* @param $orderBy string how to order
* @param $sortBy string Sort like Ascending or Descending, values are asc/desc
* @param $toArray boolean whether to return the output as array or not. Default is false
*
@Ardakilic
Ardakilic / memeyapma.php
Last active December 28, 2015 02:59
PHP-TR facebook sayfasından gelen bir soru üzerine can sıkıntısından bir snippet hazırladım. Bu kod resmin canvasını istenen değerde büyütüp altına fontun ebatında ideal ortalanmış ve istenen renkte (örnekte kırmızı) bir şerit atıp altına istenen metni istenen fontla ekliyor.
<?php
//önce dosya adımız
$resim_yolu = 'cat.jpg';
$yeni_yol = 'cat2.jpg';
$alttan_canvas = 100;
$font = './arial.ttf';
$fontSize = 20;
$metin = 'CAPS VER PAMPA';
@Ardakilic
Ardakilic / laravel-cache-pagination.php
Created September 23, 2014 09:51
arda.pw blog yazımda hazırladığım Laravel Cache + Pagination kullanımı örnek kod.
<?php
/**
* @author Arda Kılıçdağı
* @link http://arda.pw
*/
Route::get('cache_pagination', function(){
//sayfa başına kaç tane olacak?
$sayfaBasinaKacTane = 10;
@Ardakilic
Ardakilic / sshpass.rb
Created December 16, 2014 13:02
Homebrew sshpass formula. NOTE: This is blacklisted for a good reason, don't use if you are a novice user.
require 'formula'
class Sshpass < Formula
url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz'
homepage 'http://sourceforge.net/projects/sshpass'
md5 'c52d65fdee0712af6f77eb2b60974ac7'
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
#!/usr/bin/python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BOARD)
PINNO = 7
GPIO.setup(PINNO, GPIO.OUT)
p = GPIO.PWM(PINNO, 50)
@Ardakilic
Ardakilic / op.sh
Last active September 14, 2015 08:40
-sort of- daemon script to start / stop / restart nginx, redis, php-fpm and mysql that's installed from homebrew, run as user.
#! /bin/bash
if [ -n "$1" ]; then
if [ $1 = "start" ]; then
echo "Starting php-fpm ..."
launchctl load -w /usr/local/opt/php56/homebrew.mxcl.php56.plist
echo "Starting nginx ..."
sudo nginx
launchctl load -w /usr/local/opt/nginx/homebrew.mxcl.nginx.plist
echo "Starting mysql ..."
launchctl load -w /usr/local/opt/mysql/homebrew.mxcl.mysql.plist
### Keybase proof
I hereby claim:
* I am ardakilic on github.
* I am arda (https://keybase.io/arda) on keybase.
* I have a public key whose fingerprint is 3C02 0B62 F05B C82D 9819 2ECC 7D5B 52F5 1FAF A649
To claim this, I am signing this object: