Skip to content

Instantly share code, notes, and snippets.

View fpapadopou's full-sized avatar

Fotis Papadopoulos fpapadopou

View GitHub Profile
@fpapadopou
fpapadopou / redis_cheatsheet.bash
Created December 4, 2019 07:46 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# 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 November 20, 2019 13:36
A location-aware user database implemented using Google S2 Geometry and Hashicorp's go-memdb (insert/update operations)
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 November 20, 2019 13:35
A location-aware user database implemented using Google S2 Geometry and Hashicorp's go-memdb (store setup)
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 11:48 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

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

@fpapadopou
fpapadopou / FIleSystemOperations.java
Created March 8, 2018 14:31 — forked from ashrithr/FIleSystemOperations.java
HDFS FileSystems API example
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 March 5, 2018 15:45 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

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 November 16, 2017 19:00 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

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 :

@fpapadopou
fpapadopou / 1.How to easily implement a REST API with oAuth2 presentation.md
Created November 7, 2017 13:28 — forked from lologhi/1.How to easily implement a REST API with oAuth2 presentation.md
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

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 November 5, 2017 07:35 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

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 September 3, 2017 15:33 — forked from beberlei/MyWebTestCase.php
Easily Inject authenticated Symfony User objects into functional test
<?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
*/