Skip to content

Instantly share code, notes, and snippets.

Fotis Papadopoulos fpapadopou

Block or report user

Report or block fpapadopou

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fpapadopou
fpapadopou / redis_cheatsheet.bash
Created Dec 4, 2019 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
View redis_cheatsheet.bash
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@fpapadopou
fpapadopou / operations.go
Created Nov 20, 2019
A location-aware user database implemented using Google S2 Geometry and Hashicorp's go-memdb (insert/update operations)
View operations.go
package store
import (
"github.com/golang/geo/s1"
"github.com/golang/geo/s2"
"github.com/hashicorp/go-memdb"
)
// Insert adds a new user to th
func (s *Store) Insert(user int, lat float64, lon float64) error {
@fpapadopou
fpapadopou / store.go
Last active Nov 20, 2019
A location-aware user database implemented using Google S2 Geometry and Hashicorp's go-memdb (store setup)
View store.go
package store
import (
"github.com/golang/geo/s1"
"github.com/golang/geo/s2"
"github.com/hashicorp/go-memdb"
)
const (
minLevel = 15
@fpapadopou
fpapadopou / docker-cleanup-resources.md
Created May 21, 2019 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
View FIleSystemOperations.java
package com.cloudwick.mapreduce.FileSystemAPI;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@fpapadopou
fpapadopou / multiple_ssh_setting.md
Created Mar 5, 2018 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts
View multiple_ssh_setting.md

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@fpapadopou
fpapadopou / README.md
Created Nov 16, 2017 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle
View README.md

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

View 1.How to easily implement a REST API with oAuth2 presentation.md

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. :

@fpapadopou
fpapadopou / MySQL_macOS_Sierra.md
Created Nov 5, 2017 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew
View MySQL_macOS_Sierra.md

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

@fpapadopou
fpapadopou / MyWebTestCase.php
Last active Sep 3, 2017 — forked from beberlei/MyWebTestCase.php
Easily Inject authenticated Symfony User objects into functional test
View MyWebTestCase.php
<?php
use Liip\FunctionalTestBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @group functional
*/
You can’t perform that action at this time.