Skip to content

Instantly share code, notes, and snippets.

@brexis
brexis / fedapay.php
Last active February 8, 2022 10:28
FedaPay php integration
require_once('vendor/autoload.php');
$token = "sk_sandbox_WNxERQEilcpD-fYboNG2-Twy";
\FedaPay\FedaPay::setApiKey($token);
\FedaPay\FedaPay::setEnvironment('sandbox'); //ou setEnvironment('live');
// Créer une transaction
try {
$transaction = \FedaPay\Transaction::create(array(
"description" => "Transaction for [email protected]",
"amount" => 2000,
@brexis
brexis / class19.json
Last active December 19, 2020 12:42
Class19 test
{
"version": "2020-12-19T12:41:30.720Z",
"data": {
"Maths": [
{
"name": "Triangles",
"TDS": [
{
"name": "Nombres réels",
"video": {
@brexis
brexis / gist:9e5eb4e0019774691bd3d8f69515c598
Created November 21, 2018 23:11
Run composer on shared hosting
php -d suhosin.executor.include.whitelist=phar composer install
php -d suhosin.executor.include.whitelist=phar -d memory_limit=-1 composer install
# Change elasticsearch image
export ELASTICSEARCH_IMAGE="elasticsearch"
export ELASTICSEARCH_IMAGE_VERSION="5.6.6"
# set vm.max_map_count=262144 in /etc/sysctl.conf permanently
$ grep vm.max_map_count /etc/sysctl.conf
vm.max_map_count=262144
# To apply the setting on a live system type:
$ sysctl -w vm.max_map_count=262144
@brexis
brexis / gist:4ca65c3e96016ded81286a174252b376
Created February 25, 2018 10:04
How to fix Composer's slowness
$ composer config --global repo.packagist composer https://packagist.org
@brexis
brexis / schema.sql
Created October 28, 2017 11:29
Radius Mysql schema.sql
###########################################################################
# db_mysql.sql rlm_sql - FreeRADIUS SQL Module #
# #
# Database schema for MySQL rlm_sql module #
# #
# To load: #
# mysql -uroot -prootpass radius < db_mysql.sql #
# #
# Mike Machado <[email protected]> #
###########################################################################
@brexis
brexis / laravel5_shared_hosting_project.sh
Created March 4, 2016 11:02 — forked from meganlkm/laravel5_shared_hosting_project.sh
setup a laravel5 project to deploy to a shared hosting provider
#!/bin/bash
myproject='myproject'
mywww='public_html'
# initialize project
composer create-project laravel/laravel $myproject --prefer-dist
cd $myproject
# fix paths to public
@brexis
brexis / ssl_puma.sh
Created January 22, 2016 16:34 — forked from tadast/ssl_puma.sh
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@brexis
brexis / GIF-Screencast-OSX.md
Last active August 29, 2015 14:27 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@brexis
brexis / gist:0018f3a3921b6816c7a6
Created June 12, 2015 15:14
Image to dataurl Node.js
var request = require('request').defaults({encoding: null});
var imgUrl = 'URL_OF_IMG';
request.get(imgUrl, function (error, rep, body) {
var data = '';
if (!error && rep.statusCode === 200) {
data = 'data:' + rep.headers['content-type'] + ';base64,' + new Buffer(body).toString('base64');
}
// Do something with data
});