Skip to content

Instantly share code, notes, and snippets.

View antoinefortin's full-sized avatar

Antoine Fortin antoinefortin

  • Montreal, Canada
View GitHub Profile
@antoinefortin
antoinefortin / _Perctron.js
Created March 15, 2018 13:25
[Perceptron] A Perceptron implemented in Js
/*
This is a Perceptron implemented in the Javascript Langage,
For the purpose of this projects every x values of our datasets will be initialized with a
data value of *random. Feel free to implement the way weight is initialized :)
Epochs is set by default to 1000 and learning rate at .1.
// To use the Perceptron inside of your projects
@antoinefortin
antoinefortin / yarn-global-pack.js
Created March 15, 2018 13:44
[Install Yarn package Globally] Snippet Install Yarn package Globally
https://yarnpkg.com/lang/en/docs/cli/global/
$ yarn global add create-react-app --prefix /usr/local
# the `create-react-app` command is now available globally:
$ which create-react-app
$ /usr/local/bin/create-react-app
$ create-react-app
@antoinefortin
antoinefortin / changenpmVersion.sh
Created March 15, 2018 14:28
[Change Npm Version]
npm i npm@4 -g to use npm 4
@antoinefortin
antoinefortin / change-php-in-bash.txt
Created March 16, 2018 13:49
[Change Php in Bash]
Another way without changing the original php file / link is if you edit your .bashrc file as follows (works with other commands as well):
Open your Terminal / Commandline and type in:
vim ~/.bashrc
Then press "i" to get into edit-mode (if there shows up a problem before that, because of a swap file, then press "E" to edit the file anyway)
Add the following line (change the path as needed):
alias php="/Applications/MAMP/bin/php/php5.4.10/bin/php"
Press "ESC" and type in ":wq"
@antoinefortin
antoinefortin / print-error.php
Created March 16, 2018 14:10
[Print error Php]
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
@antoinefortin
antoinefortin / cpp-compuncomp-from-terminal.sh
Created March 16, 2018 15:05
[C++ compiled/Uncompiled from Terminal]
g++ main.cpp
otool -tvV a.out
@antoinefortin
antoinefortin / scp-command.sh
Created March 16, 2018 18:40
[SCP command]
Copy the file "foobar.txt" from a remote host to the local host
$ scp your_username@remotehost.edu:foobar.txt /some/local/directory
Copy the file "foobar.txt" from the local host to a remote host
$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory
Copy the directory "foo" from the local host to a remote host's directory "bar"
$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar
Copy the file "foobar.txt" from remote host "rh1.edu" to remote host "rh2.edu"
$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \
your_username@rh2.edu:/some/remote/directory/
Copying the files "foo.txt" and "bar.txt" from the local host to your home directory on the remote host
@antoinefortin
antoinefortin / connect-t0-db.php
Created March 19, 2018 17:47
[Connect to DB in Php]
<?php
$servername = "127.0.0.1";
$username = "root";
$password = "";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
@antoinefortin
antoinefortin / js-boolean.js
Created March 21, 2018 14:25
[Javascript Oscillate Boolean Counter]
var pi = Math.PI;
var lim = 200;
counter = 0;
for (i = 0; i++) {
if (sin(i*pi/lim) >= 0 ) {
counter ++
} else {
counter --
}
}
@antoinefortin
antoinefortin / latlong-flat.js
Created March 22, 2018 19:20
[LATLONG Js on Flat]
var mapimg;
var clat = 0;
var clon = 0;
var lat = 31.2674;
var lon = 121.5221;
var zoomLevel = 1;