Skip to content

Instantly share code, notes, and snippets.

View bsormagec's full-sized avatar
:shipit:
Hello World!

Burak Sormageç bsormagec

:shipit:
Hello World!
  • Laravel, Blockchain, Web3, Solidity, NodeJs
  • Toronto,Canada
  • X @bsormagec
View GitHub Profile
@bsormagec
bsormagec / Dockerfile
Created November 11, 2016 10:16 — forked from ebuildy/Dockerfile
Install Php 7 with MongoDB driver on Docker from Ubuntu trusty base image.
FROM ubuntu:trusty
ENV HOME /root
ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
RUN add-apt-repository ppa:ondrej/php && \
apt-get update
@bsormagec
bsormagec / reverse-string.php
Created November 5, 2016 16:40 — forked from amochohan/reverse-string.php
Recurrsive function to reverse a string
<?php
function reverseString($string){
//Is this method being recurrsively called, i.e. do we still have part of the string being passed to the function to be reversed?
if(strlen($string)>1){
/*
* Return the last letter of the string, and append via calling this method again recursively (passing the remainder of the un-reversed string)
* to continue reversing the remainder of the string
*/
@bsormagec
bsormagec / 01_Laravel 5 Simple ACL manager_Readme.md
Created November 5, 2016 16:39 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@bsormagec
bsormagec / Taiga.io Ubuntu 15.10 DigitalOcean Install
Created October 25, 2016 13:23
Taiga.io Ubuntu 15.10 DigitalOcean Install
#good luck. This works until you get to circus/nginx, and then you get nothing.
#circus is horrible. running an application like this in virtualenv is horrible.
#the whole thing is horrible.
adduser taiga
nano /etc/sudoers
# add "taiga ALL=(ALL) NOPASSWD:ALL" without quotes then save the file.
cd /home/taiga
@bsormagec
bsormagec / LoggerApplication.php
Created June 14, 2016 10:51 — forked from nekudo/LoggerApplication.php
Monitoring PHP-CLI scripts with websockets
<?php
namespace WebSocket\Application;
/**
* Websocket-Server demo and test application.
*
* @author Simon Samtleben <web@lemmingzshadow.net>
*/
class LoggerApplication extends Application
@bsormagec
bsormagec / apache.conf
Created April 11, 2016 00:07 — forked from jjulian/apache.conf
Apache rewrite rules to show a maintenance page
# Capistrano-style: if maintenance.html exists, it will be served for any request
# other than style and images. Use status code 503 to tell crawlers to come back later.
ErrorDocument 503 /system/maintenance.html
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(css|gif|jpg|png)$
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ - [redirect=503,last]
@bsormagec
bsormagec / genPassword.php
Created April 9, 2016 14:38 — forked from gravataLonga/genPassword.php
Generate a random Password
<?php
function generatePassword ($length = 8) {
$password = "";
$possible = "2346789bcdfghjkmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ";
$maxlength = strlen($possible);
// check for length overflow and truncate if necessary
if ($length > $maxlength) {
$length = $maxlength;
@bsormagec
bsormagec / cleanUrl.php
Created April 9, 2016 14:38 — forked from gravataLonga/cleanUrl.php
Clean URL
<?php
function cleanForShortURL($toClean) {
$charactersToRemove = array(
'Š'=>'S', 'š'=>'s', 'Ð'=>'Dj','Ž'=>'Z', 'ž'=>'z', 'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A',
'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I',
'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U',
'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss','à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a',
'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i',
<?php
define ("SERIAL_DEVICE_NOTSET", 0);
define ("SERIAL_DEVICE_SET", 1);
define ("SERIAL_DEVICE_OPENED", 2);
/**
* Serial port control class
*
* THIS PROGRAM COMES WITH ABSOLUTELY NO WARANTIES !
* USE IT AT YOUR OWN RISKS !
@bsormagec
bsormagec / Proxy-README.md
Created February 28, 2016 13:33 — forked from redmoses/Proxy-README.md
SSH tunnelling using dynamic proxy

SSH Proxy Script by Red Moses

http://redmoses.me

This script connects to a SSH server to create a dynamic tunnel proxy. I'm assuming you use a private key for authenticating to the server.

Script configuration

To use this script you must first configure it according to your details. I have supplied some dummy values for the configuration fields to start with.

# SSH user