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 / 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 / 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 / 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 / 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 / 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.