Skip to content

Instantly share code, notes, and snippets.

@angebagui
angebagui / Query : distance
Created December 8, 2017 09:22 — forked from dev-hpjsolutions/Query : distance
Calculate distance between two points
<?php
// Permet d'obtenir les entrés contenu dans un rayon ($within)
$latitude = 45.545421;
$longitude = -73.59288;
$within = 100;
$query = "
SELECT `zip_code`, (6371 * acos(cos(radians($latitude)) * cos(radians(`lat`)) * cos(radians(`long`) - radians($longitude)) + sin(radians($latitude)) * sin(radians(`lat`))))
AS `distance`
@angebagui
angebagui / mongodb-s3-backup.sh
Created December 5, 2017 19:21 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh
@angebagui
angebagui / gist:2180d587d5e1bea67d4d899a8e93e50c
Created December 5, 2017 17:39 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu

Install and configure Sendmail on Ubuntu

This should help you get Sendmail installed with basic configuration on Ubuntu.

  1. If sendmail isn't installed, install it: sudo apt-get install sendmail
  2. Configure /etc/hosts file: nano /etc/hosts
  3. Make sure the line looks like this: 127.0.0.1 localhost yourhostname
  4. Run Sendmail's config and answer 'Y' to everything: sudo sendmailconfig
  5. Restart apache sudo service apache2 restart
@angebagui
angebagui / mypays.json
Created September 3, 2017 21:31
http:localhost:8082/api/v1/countries
// 20170903213159
// http://localhost:8082/api/v1/countries
[
{
"id": 1,
"indicatif_pays": 93,
"alpha2": "AF",
"alpha3": "AFG",
"nom_en_gb": "Afghanistan",
{"email":"", "password":"$2y$10$Gtwk0UOjZSu.edBqXX5Jvu/JZVCGB09qYdLiSQXhZpDklI8Zxb.na", "phrasecret":"", "locked":0, "id_fidele":201, "remember_token":"", "permission_gs":1, "permission_my":1}
{"id_fidele":1,
"mat_visiteur":"KOD-2016-1V",
"mat_membre":"CIV16-00001",
"nom_membre":"SANOGO",
"prenom_omonime_membre":"",
"prenom_membre":"Mohammed",
"statu":"5",
"ind_tel_fix":"", "tel_fix":"", "ind_tel_mob1":"255", "tel_mob1":"01236582", "email":"mohammed.sanogo@vasesdhonneur.info", "b_referent":0, "dat_affect_b_ref":"0000-00-00", "b_favho":0, "ind_tel_mob2":"", "tel_mob2":"", "civilite":"m", "genre":"0", "date_arr":"2016-10-30", "date_arr_suppose":"0000-00-00", "jour_nais":"", "mois_nais":"", "dat_nais":"0000-00-00", "lieu_nais":"", "id_fidele_conjoint":0, "nbr_enfant":4, "format_adr":"civ", "adr_rue":"", "adr_c_postal":"", "adr_ville":"", "adr_pays":"", "id_pays":0, "id_region":0, "id_langue":0, "adr_commune":"", "adr_quartier":"", "adr_complementaire":"", "autr_eglise":0, "lib_autr_eglise":"", "profession":"", "statu_professionnel":0, "id_tranch_age":0, "id_sit_matrimo":0, "dat_sit_matrimo":"0000-00-00", "dec_vie_jc":0, "dec_bapt":0, "sujet_priere":"", "dec_eng_jc":0, "dec_memb":0, "dec_
@angebagui
angebagui / category.json
Last active August 8, 2017 09:28
Creer un utilisateur
{
"_id":"epepep",
"name":"Immobilier",
"language":"fr",
"activated":false,
"code":1,
"deleted_at": 10101010101,
"created_at": 10101010101,
"updated_at": 10101010101
}
@angebagui
angebagui / visites_response.json
Last active July 26, 2017 15:36
Reponse Json de la liste des visites
[
{
"id":1,
"id_prospere": 8,
"id_personnel": 2,
"nom": "Franck Grah",
"tel": "+22577463312",
"email": "et@gmail.com",
"start_time": "100000000",
"end_time": "100000000",
@angebagui
angebagui / GetDistanceBetweenLocation.java
Created July 24, 2017 21:30
get Distance Between Location
public class GetDistanceBetweenLocation{
public static double getDistanceBetweenLocations(double originLat, double originLng,double destinationLat, double destinationLng ){
int radiusOfEarth = 6371; // Km
double dLat = Math.toRadians(destinationLat - originLat);
double dLng = Math.toRadians(destinationLng - originLng);
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(Math.toRadians(originLat)) * Math.cos(Math.toRadians(destinationLat)) * Math.sin(dLng / 2) * Math.sin(dLng / 2);
@angebagui
angebagui / restresponse.json
Last active June 29, 2017 10:29
Retour Json du Service MonEcole Eleve
//Presentation d'un utilisateur partout dans les reponses
{
"matricule": "PEPEPE",
"nom" : "Bagui",
"prenom":"Ange",
"photo":"http://example/image.png",
"classe" : "5eme3",
"etablissement":"Lycée Moderne de Cocody Angré"
}