Skip to content

Instantly share code, notes, and snippets.

View Romain-P's full-sized avatar
🈴
/home

- Romain-P

🈴
/home
View GitHub Profile
import {config} from "../app.config";
import {crypto} from 'crypto-browserify';
import {Buffer} from 'buffer/';
export class RsaService {
private privateKey: string;
private publicKey: string;
private enabled: boolean;
constructor() {
@Romain-P
Romain-P / OrtecAuthenticationProviderImpl.java
Created September 26, 2017 14:13
Exemple d'implémentation authentification ortec
@Component
public class OrtecAuthenticationProviderImpl extends OrtecAuthenticationProvider<UserDTO> {
@Autowired
private UserRepository repository;
@Override
protected void configure(AuthenticationConfigurer<UserDTO> configurer) {
configurer
.loadUserByUsername(username -> repository.findByUsername(username))
.createUserEntity(ldap -> {
@Romain-P
Romain-P / main.c
Last active September 20, 2017 13:24
#include "string.h"
void main(int ac, char **args) {
String hello = string_init("hello");
hello->append(hello, " my girl");
printf("got a length of %d now", hello->length(hello));
}
@Romain-P
Romain-P / ActivityService.java
Created September 4, 2017 12:28
Service gérant la logique métier des activités
/**
* @Author: romain.pillot
* @Date: 18/08/2017
*/
@Service
public class ActivityService extends AbstractCrudService<ActivityDTO, ActivityRepositoryImpl> {
@Autowired
private UserService userService;
@Romain-P
Romain-P / authentification.service.ts
Created August 29, 2017 14:35
Service d'authentification pour accéder aux ressources du webservice.
import {Injectable} from '@angular/core';
import {Http, Headers} from '@angular/http';
import {Observable} from 'rxjs/Rx';
import 'rxjs/add/operator/catch';
import "rxjs/add/operator/mergeMap";
import "rxjs/add/operator/do";
import {isNullOrUndefined} from "util";
@Injectable()
export class AuthenticationService {
@Romain-P
Romain-P / AFTER.java
Last active August 4, 2017 16:48
BEFORE.java
@Override
protected void defineConverter(ConverterBuilder<User, UserDTO> builder, Converter converter) {
builder
.convertEntity((entity, dto) -> dto.getRoles().addAll(entity.getRoles().stream()
.map(x -> converter.convert(x, RoleDTO.class))
.collect(Collectors.toSet())))
.convertDto((dto, entity) -> entity.setRoles(dto.getRoles().stream()
.map(x -> converter.convert(x, Role.class))
.collect(Collectors.toSet())));
}
#include <stdlib.h>
char *strdupl(char const *str)
{
char *new;
int i;
i = 0;
while (str && str[i] && ++i);
if (!(new = malloc(sizeof(char) * (i + 1))))
return (NULL);
static t_object *create_object(t_key *key)
{
t_object *object;
if (!(object = malloc(sizeof(t_object))))
return (NULL);
object->type = keyget_integer(key, "type");
object->position = my_create_sfvector3f(keyget_integer(key, "position.x"),
keyget_integer(key, "position.y"),
keyget_integer(key, "position.z"));
@Romain-P
Romain-P / gist:85f10af4b84af2bc96e7fad966f4a4ef
Created May 21, 2017 21:28 — forked from rxdazn/gist:2198830
moulinette norme epitech
#!/usr/bin/python
#
# Made by [email protected]
# Version: 1.2.1
#
'''
An Epitech norme checker
Usage: python norme.py <files to scan> [-nocheat] [-verbose] [-score] [-libc]
if not defined then
defined = true
ArenaEnemies = {
"arenapet1",
"arenapet2",
"arenapet3",
"arena1",
"arena2",
"arena3",