mardi 28 juin 2016

[Git] init local project for bitbucket and first commit

1- create your repository on bitbucket


2- init local project:

mkdir /path/to/your/project
cd /path/to/your/project
git init 
git remote add origin https://<bitbucket_username>@bitbucket.org/<bitbucket_username>/<repository_in_lower_case>.git

3- first commit:

echo "James Bond" >> contributors.txt
git add contributors.txt
git commit -m 'Initial commit with contributors'
git push -u origin master

mercredi 20 avril 2016

[Linux] How to reinstall shutdown / reboot

First of all, check where they are :
which shutdown 
/sbin/shutdown

which reboot
/sbin/reboot

After, check the package :
$ dpkg -S /sbin/shutdown
upstart: /sbin/shutdown

$ dpkg -S /sbin/reboot
upstart: /sbin/reboot

Now we can reinstall :
sudo apt-get install --reinstall upstart

Source : http://askubuntu.com/questions/631929/reboot-and-shutdown-executables-missing

dimanche 10 avril 2016

[Apache2] Too many processes

If you have a lot of instances of apache2, you can update the values for StartServers, MinSpareServers and MaxSpareServers:

<IfModule mpm_prefork_module> 
StartServers 5 #at the begining
MinSpareServers 5  #min servers spare
MaxSpareServers 10  #max servers spare
MaxClients 150 
MaxRequestsPerChild 0 
</IfModule>

Source : https://fuscata.com/kb/set-maxclients-apache-prefork

jeudi 7 avril 2016

[LinkedIn] Build resume from profile

You can use the Linkedin CV chrome extension to generate a resume in PDF.

How to use
- Install the Linkedin CV extension.
- Go to your Linkedin profile and click the "View profile as" button. Because it will convert your complete profile not the editable one.
- Click the Linkedin logo in your browser address bar. Then your Linkedin profile will be converted.
- Press (Ctrl + P) to activate the print options in Google Chrome.
- From the options column on the left choose "Save as PDF" for destination.
- Click "Save" to save your CV.

samedi 2 avril 2016

[MongoDB] Please ensure LANG and/or LC_* environment variables are set correctly.

When I run:
mongo
Error message:
Failed global initialization: BadValue Invalid or no user locale set. Please ensure LANG and/or LC_* environment variables are set correctly.

Solution:
export LC_ALL=C

jeudi 12 novembre 2015

[AngularJS] retrieve param in url

function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
 
var queryValue = getParameterByName('test_user_bLzgB');

Then it is not necessary to enable html5 and to define a <base>...

Source : http://stackoverflow.com/a/28473677

mercredi 9 septembre 2015

http://{s}.tile.osm.org/{z}/{x}/{y}.png ERR_INSECURE_RESPONSE

If you use Leaflet (http://leafletjs.com) inside a HTTPS page and you would like to access to the OpenStreetMap tiles like that : 
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

You must do that :

L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

OpenStreetMap  doesn't have a certificate for the abbreviated domain osm.org




Source : https://github.com/Leaflet/Leaflet/issues/3186

jeudi 6 août 2015

[Ansible] problem when executing a mongo script on a remote server

When you want to execute the command mongo on the remote server (for exemple when you want to do mongo --host myserver --port 27017 myscript.js you must do that in your playbook :

-shell: mongo --host myserver --port 27017 < myscript.js 

Source : http://stackoverflow.com/questions/4837673/how-to-execute-mongo-commands-through-shell-scripts#comment21193090_4837678

Categories