Skip to content

Instantly share code, notes, and snippets.

View Gounlaf's full-sized avatar
🤩
I'm trying to port Magick.NET to Kotlin

Florian Levis Gounlaf

🤩
I'm trying to port Magick.NET to Kotlin
View GitHub Profile
@yuki777
yuki777 / pre-commit.md
Last active August 29, 2015 14:16
pre-commit, check-syntax, php-cs-fixer

pre-commit

#!/usr/bin/env bash
dir=`dirname realpath $0`

# Check php syntax
$dir/check-php-syntax
if [ $? -ne 0 ]; then
    message="Aborting commit due to files with syntax errors."
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@tsolar
tsolar / laravel-subdirectory.conf
Last active February 5, 2025 05:29
Laravel in subdirectory nginx example
server {
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 300M;
sendfile on;
send_timeout 300s;
# Port that the web server will listen on.
#listen 80;
@jdelisle
jdelisle / AbstractResourceListener.php
Last active September 29, 2015 10:21
Query string parameters validation for Zend's Apigility resource fetchAll method
<?php
namespace Application\Rest;
use Zend\InputFilter\Input;
use Zend\InputFilter\InputFilter;
use Zend\Stdlib\Parameters;
use ZF\ApiProblem\ApiProblem;
use ZF\Rest\ResourceEvent;
abstract class AbstractResourceListener extends \ZF\Rest\AbstractResourceListener {
@tongpu
tongpu / Init script for Taskserver
Created May 14, 2014 21:04
Taskserver Init and Logrotate configuration for Debian
#! /bin/sh
### BEGIN INIT INFO
# Provides: taskd
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts Taskserver
# Description: Starts Taskserver using start-stop-daemon
@johnkary
johnkary / LikeQueryHelpers.php
Last active April 22, 2022 08:09
Proper DQL escaping for LIKE queries with Doctrine 2.
<?php
namespace Foo;
/**
* Methods for safe LIKE querying.
*/
trait LikeQueryHelpers
{
/**
@jasny
jasny / bootstrap-em.less
Last active January 5, 2020 15:36
Use em or rem font-size in Bootstrap 3
/**
* Use em or rem font-size in Bootstrap 3
*/
@font-size-root: 14px;
@font-unit: 0rem; // Pick em or rem here
// Convert all variables to em
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@TemporaryJam
TemporaryJam / Howto convert a PFX to a seperate .key & .crt file
Last active April 4, 2024 10:52
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`