Skip to content

Instantly share code, notes, and snippets.

View ahmed-bhs's full-sized avatar
👽

Ahmed EBEN HASSINE 脳の流れ ahmed-bhs

👽
View GitHub Profile
@ahmed-bhs
ahmed-bhs / IriConverter.php
Created September 1, 2023 10:52 — forked from soyuka/IriConverter.php
Override IriConverter and allow an ApiResource to not have any item route associated with it.
<?php
/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@ahmed-bhs
ahmed-bhs / rabbitmq.txt
Created December 15, 2018 09:53 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
http://cronus.allowed.org works for me, 2018.1.6
@ahmed-bhs
ahmed-bhs / GIT.MD
Created November 3, 2018 13:30 — forked from jpchateau/GIT.MD
Git - Commandes / Configuration / Astuces

Commandes

git add -vA # ajoute tous les changements au commit, verbeux
git rm [fichiers] # supprime les fichiers du dépôt
git add -p [fichier] # permet de préciser quels morceaux de code d'un fichier sont à ajouter au commit
git pull # met à jour ses fichiers locaux à partir d'un dépôt distant (cela effectue un fetch puis un merge)
git pull -r
git push # Pousse les modifications locales sur un dépôt distant
git push -f # force à pousser ses modifications locales sur un dépôt distant. À utiliser avec précaution.
@ahmed-bhs
ahmed-bhs / auto-deploy.md
Created November 1, 2018 17:33 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@ahmed-bhs
ahmed-bhs / auto-deploying.md
Created November 1, 2018 17:32 — forked from nickbclifford/auto-deploying.md
How to automatically deploy code to a server using Travis CI

Auto-Deploying via Travis CI

Because Travis CI can automatically execute scripts after successfully (or unsuccessfully!) executing tests, it is an obvious choice for a deployment tool. In order to deploy to a Git repository on a remote server, the process generally is as follows:

  • Set up SSH keys
  • Add the server's copy of the repository as a Git remote
  • Push to the remote
  • SSH into the server and execute any installation/compilation/miscellaneous commands

Before even touching .travis.yml...

Users

@ahmed-bhs
ahmed-bhs / .travis.yml
Created November 1, 2018 12:57 — forked from n0ni0/.travis.yml
Travis-CI file for PHP/Symfony 3
# Project language
language: php
# Allows use container-based infrastructure
sudo: false
# Start mysql service
services:
- mysql
def generate_RSA(bits=2048):
'''
Generate an RSA keypair with an exponent of 65537 in PEM format
param: bits The key length in bits
Return private key and public key
'''
from Crypto.PublicKey import RSA
new_key = RSA.generate(bits, e=65537)
public_key = new_key.publickey().exportKey("PEM")
private_key = new_key.exportKey("PEM")
@ahmed-bhs
ahmed-bhs / Stop tracking directory in Git repo
Created April 29, 2018 12:08 — forked from mandiwise/Stop tracking directory in Git repo
A command to stop tracking and entire directory in a Git repo
// Reference: http://stackoverflow.com/questions/936249/stop-tracking-and-ignore-changes-to-a-file-in-git
$ git rm --cached -r <dir>
@ahmed-bhs
ahmed-bhs / LikeQueryHelpers.php
Created April 28, 2018 08:40 — forked from johnkary/LikeQueryHelpers.php
Proper DQL escaping for LIKE queries with Doctrine 2.
<?php
namespace Foo;
/**
* Methods for safe LIKE querying.
*/
trait LikeQueryHelpers
{
/**