Skip to content

Instantly share code, notes, and snippets.

View Nek-'s full-sized avatar
:octocat:

Maxime Veber Nek-

:octocat:
View GitHub Profile
@Nek-
Nek- / README.md
Created February 11, 2024 19:37
Installation protoc/grpc with php plugin on macos

Installation with homebrew

brew install protobuf
brew install grpc
pecl install grpc
@Nek-
Nek- / output_when_pressing_a.txt
Last active August 29, 2023 14:16
Windows PHP FFI handle creation
********You pressed A
@Nek-
Nek- / stripe_front_payment.html
Created November 23, 2022 18:10
Quick & dirty simulation of frontend application validating a stripe card payment
<!DOCTYPE html>
<html lang="en">
<head>
<title>This is the title of the webpage!</title>
<script src="https://js.stripe.com/v3/"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
@Nek-
Nek- / console.php
Last active August 8, 2022 15:48
Quelques fonctions pour utiliser le terminal en PHP
<?php declare(strict_types=1);
// Ce fichier contient tout un tas de fonctions utile pour faire des opérations spéciales
// dans les terminaux.
// Lire le contenu des fonctions n'est pas toujours simple car on utilise justement des fonctions pour se simplifier
// la vie, leur contenu est souvent donc un peu compliqué à lire.
// Mais ici pour les curieux j'ai pris le temps de commenter le code !
// Pour en apprendre plus comment cela fonctionne vous pouvez aller lire ce tutoriel sur ZdS:
// https://zestedesavoir.com/tutoriels/1733/termcap-et-terminfo/
// Ou naturellement faire quelques recherches sur internet. ;-) (c'est d'ailleurs principalement ce que j'ai fait)
<?php
require_once __DIR__.'/../vendor/autoload.php';
use Amp\Loop;
Loop::run(function () {
$messages = [];
function receive(&$messages) {
@Nek-
Nek- / old_node.sh
Last active October 7, 2021 21:45
An alias that uses docker to run old version of nodejs
alias n14='docker run -it --rm -w "/myvolume" -v "`pwd`:/myvolume" node:14'
n14 yarn install
n14 node something
# Side note: will not work with stuff that need network access such as server. In this case you need to map ports manually.
<?php
// Utilisation d'une classe Task pour clarifier mon code précédent à base de tableaux
class Task
{
protected $taskId;
protected $coroutine;
protected $sendValue = null;
protected $beforeFirstYield = true;
@Nek-
Nek- / ldap_working_for_ad.php
Last active May 29, 2020 09:19
Active directory ldap PHP
<?php
$bind = ldap_bind($ldap, $username, $password);
$res = ldap_search(
$ldap,
'OU=UTILISATEUR,DC=scaprim,DC=local',
// Weirdo syntax to say objetClass must be type user but the username is either
// userprincipalname or samaccountname
"(&(objectClass=user)(|(userprincipalname=$username)(samaccountname=$username)))"
);
@Nek-
Nek- / main.ts
Created September 25, 2017 19:16
PixiJS & TypeScript & Webpack 3.5
import * as PIXI from 'pixi.js';
document.addEventListener('DOMContentLoaded', () => {
let renderer = PIXI.autoDetectRenderer(
600,
400,
{antialias: true, transparent: false, resolution: 1, backgroundColor: 0xFFFFFF}
);
}, false);
[push]
default = simple
[pull]
rebase = preserve
[alias]
pf = push --force-with-lease