Skip to content

Instantly share code, notes, and snippets.

View tuupola's full-sized avatar

Mika Tuupola tuupola

View GitHub Profile
@geggleto
geggleto / index.php
Created January 26, 2016 22:29
slim 3 gist 7
<?php
$app->add(function ($req, $res, $next) {
//DO SOMETHING BEFORE THE REQUEST IS PROCESSED
$res = $next($req, $res); //PROCESS THE REQUEST
//DO SOMETHING AFTER THE REQUEST HAS BEEN PROCESSED
if ($res->getStatusCode() > 500) {
//Do something with a server error, maybe email someone or submit a bug report
}
@chriseldredge
chriseldredge / dnsmasq-regex.rb
Created November 9, 2013 19:30
Homebrew Formula for installing dnsmasq with regex patch from Jan Seiffert See: http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2013q2/007124.html
require 'formula'
class DnsmasqRegex < Formula
homepage 'http://www.thekelleys.org.uk/dnsmasq/doc.html'
url 'http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.66.tar.gz'
sha256 '36232fa23d1a8efc6f84a29da5ff829c2aa40df857b9116a9320ea37b651a982'
option 'with-idn', 'Compile with IDN support'
depends_on "libidn" if build.include? 'with-idn'
@l0gicgate
l0gicgate / RequestMethodDetector.php
Last active February 16, 2018 06:46
Determine all allowed request methods for a request outside of slim app
<?php
use FastRoute\Dispatcher;
use FastRoute\RouteParser;
use FastRoute\RouteParser\Std as StdParser;
use FastRoute\RouteCollector;
use FastRoute\DataGenerator\GroupCountBased as GroupCountBasedDataGenerator;
use Psr\Http\Message\RequestInterface;
use Slim\Route;
use Slim\Router;
@AndrewDryga
AndrewDryga / reload_vb_kernel.sh
Created March 30, 2014 22:23
Shell script to rebuild VirtualBox kernel extensions under Mac OS X
#!/bin/bash
unload() {
if [ `ps -ef | grep -c VirtualBox$` -ne 0 ]
then
echo "VirtualBox still seems to be running. Please investigate!!"
exit 1;
elif [ `ps -ef | grep -c [V]ir` -gt 0 ]
then
echo "Stopping running processes before unloading Kernel Extensions"
@swrobel
swrobel / README.md
Last active May 25, 2018 21:25 — forked from denvazh/README.md
Scheduled update for homebrew

Scheduled updates for homebrew

This two launchdaemon scripts provide scheduled updates and upgrade for homebrew packages.

It will run in the following way:

  • brew update every day at 12:10
  • brew upgrade every day at 12:20

How to install

@ziadoz
ziadoz / eloquent.php
Last active November 28, 2018 14:40
Laravel 4 Eloquent ORM Standalone (Observers, Query Logging).
<?php
class Post
{
protected $table = 'posts';
/**
* You can define your own custom boot method.
*
* @return void
**/
@balupton
balupton / README.md
Last active July 4, 2021 19:07
DNSCrypt Setup
@tschaefer
tschaefer / linux-error.txt
Created April 9, 2014 08:00
glibc linux error list
code[1] define[EPERM] str[Operation not permitted]
code[2] define[ENOENT] str[No such file or directory]
code[3] define[ESRCH] str[No such process]
code[4] define[EINTR] str[Interrupted system call]
code[5] define[EIO] str[Input/output error]
code[6] define[ENXIO] str[No such device or address]
code[7] define[E2BIG] str[Argument list too long]
code[8] define[ENOEXEC] str[Exec format error]
code[9] define[EBADF] str[Bad file descriptor]
code[10] define[ECHILD] str[No child processes]
@maoueh
maoueh / gist:8260199
Last active March 31, 2022 12:30
OpenELEC (4.0.1) WIFI connection details using `connman`

Even though there is a nice XBMC add-on to configure your WIFI settings, sometimes, you may still want to setup the WIFI connection for many reasons or just for fur.

OpenELEC use connman for managing connection to the various available network.

Setuping connman to connect to your protected WIFI network is an easy requiring you only to create a config file and enter some commands in a shell.

anonymous
anonymous / gist:8565929
Created January 22, 2014 19:42
There are a lot of complaints going around about Laravel these days, but a lot
of the important ones seem to be missing from the spotlight.
Bugfixes, issues and pull requests being left open for months with no
clarification of intent:
- https://github.com/laravel/framework/pull/1799
- https://github.com/laravel/framework/issues/1963
- https://github.com/laravel/framework/issues/2089
- https://github.com/laravel/framework/issues/2234