Skip to content

Instantly share code, notes, and snippets.

View amonmoce's full-sized avatar

Amon Moce Rodolphe BAZONGO amonmoce

View GitHub Profile
@amonmoce
amonmoce / Setting Environnment for Service Oriented Architecture Course on MAC laptop
Last active August 29, 2015 14:06
Problems encountered with MAC laptop during the installation of the environment for SOA class. The programming language is Ruby. So we have to install Ruby via RVM. But first Xcode command line tools and Homebrew (as missing package manager for OSX)
Step 1: Installing Xcode command line tools
I already had Xcode IDE installed. I launch Xcode and went to Xcode->Open Developper Tools->More Developpers Tools that led me to a website where i downloaded Xcode command line tools and installed it. And I tried the suggestion on ISS-SOA Github tutorial, the command 'xcode-select --install' which stopped with an error: Can't install the Software because it is not currently available from the Software Update server.Lucky then.
Step 2: Installing Homebrew
ruby -e "$(curl -fsSL XXXX)"
XXXX as an url that was the one on the Homebrew website.
@amonmoce
amonmoce / FizzBuzz.rb
Last active August 29, 2015 14:06
A fizzbuzz implementation in Ruby language with map ... Rubocop tested "no offense"
def fizzbuzz(n)
numbers = Array.new(n) { |i| i + 1 }
numbers.map! { |x| x % 3 == 0 && x % 5 != 0 ? 'Fizz' : x }
numbers.map! { |x| x % 5 == 0 && x % 3 != 0 ? 'Buzz' : x }
numbers.map! { |x| x % 15 == 0 ? 'FizzBuzz' : x }
print numbers
end
@amonmoce
amonmoce / tsv_to_yaml.rb
Last active August 29, 2015 14:06
A Ruby code that convert tsv file into yaml file ... like $ruby tsv_to_yaml.rb in_filename.tsv out_filename.yml; Rubocop tested no offense
# Check the output file
if ARGV[1].nil?
print 'Insert the name of your output file (yml file) '
outname = $stdin.gets.chomp
else
outname = ARGV[1]
end
# Build the array of Hashes
require 'yaml'
survey = []
@amonmoce
amonmoce / yaml_to_tsv.rb
Last active September 10, 2016 15:47
A Ruby code that convert yaml file into tsv file ... like $ruby yaml_to_tsv.rb in_filename.yml out_filename.tsv; Rubocop tested no offense
# Check the output file
if ARGV[1].nil?
print 'Insert the name of your output file (tsv file) '
outname = $stdin.gets.chomp
else
outname = ARGV[1]
end
# Deserialize
require 'yaml'
survey = YAML.load(File.read(ARGV[0]))
@amonmoce
amonmoce / Updating Git for Mac OS
Last active August 29, 2015 14:07
Updating Git to the latest version in a Mac OS Maverick
Mac OS comes with a pre-installed Git. But this version is generally outdated.
Solution 1:
To update it, we can go to Git website and download the latest version available for Mac and install it. But even if you type "git --version", you will not see the latest version you have installed. How come ?
When you installed Git from the Git Installer, it will install the git executable in a different place than your system's default one. The default is /usr/bin/git, and the new one is /usr/local/git/bin/git. Your shell however will not pick up the later one if its PATH isn't configured properly. How to configure the PATH ?
You can try adding the following to your ~/.bash_profile (if you use Bash, that is):
export PATH=/usr/local/git/bin:$PATH
Then, restart your shell and see if git now points to the new version. (Test with which git or git --version).
Solution 2: (from http://superuser.com/questions/776726/cant-use-homebrew-installed-git but solved my problem)
@amonmoce
amonmoce / Symfony 2 error timezone
Created October 12, 2014 20:40
Cannot run php app/console ... when I do so I have a problem related to date_default_timezone_get ....
Symfony 2 error:
======================
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: date_default_timezone_get(): It is not safe to rely on the system
's timezone settings. You are *required* to use the date.timezone setting
or the date_default_timezone_set() function. In case you used any of those
methods and you are still getting this warning, you most likely misspelle
d the timezone identifier. We selected the timezone 'UTC' for now, but ple
ase set date.timezone to select your timezone. in /Users/amonmoce/Document
s/Web/www/ZakafricaProject/vendor/monolog/monolog/src/Monolog/Logger.php l
Trying to use Windows 7 USB/DVD Download Tool, to create a bootable USB in order to install Windows from USB.
Problem: "Sorry, we are unable to copy your files .... (blablabla)"
Solution: Type these commands on the cmd
diskpart
list disk
select disk #
clean
create partition primary
select partition 1
@amonmoce
amonmoce / gist:998dd2e150dfdf2d96fe
Created October 26, 2015 14:50
the best way to completely uninstall node + npm from MAC OSX
The following is the best way to completely uninstall node + npm:
go to /usr/local/lib and delete any node and node_modules
go to /usr/local/include and delete any node and node_modules directory
if you installed with brew install node, then run brew uninstall node in your terminal
check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
go to /usr/local/bin and delete any node executable
You may need to do the additional instructions as well:
#image of /dev/sd5 in sd5.img
sudo dd if=/dev/sda5 of=/home/sda5.img
#install grub in sdb
grub-install /dev/sdb
update-grub
#make a disk bootable
sudo umount /dev/sdX
sudo dd if=/path/to/ubuntu.iso of=/dev/sdX bs=4M && sync
#set a partition to boot
parted -s /dev/sda set 2 boot on
@amonmoce
amonmoce / nginxproxy.md
Created May 3, 2017 14:59 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers