Showing posts from 2016

Use Github as a CDN to store and serve static content (JavaScript, CSS, Images) with rawgit

In this article I will be explaining how to use Github's "raw" feature coupled with rawgit to store and serve static content Please note I assume you have some basic git knowledge 1.- Creating a Github accountOk so first things first, in order to do this you need a Github account; so if you don't have one head up to the GitHub website and create one ; go ahead I'll wait :) 2.- Creating a Github repositoryLogin to your Git account and create a new repository : Provide a name for your repo (for example static_files) : 3.- Build repository structure We will now create a folder structure for our repository in order for us to organise the files, for example : cssjsimgSo now go ahead and clone your git repository from either the command line or with your favorite tool git clone Once the repository is cloned; go ahead and create the 3 folders mentioned above cd static_files mkdir css mkdir js mkdir img Ok so Git does not allow y…

Preventing bash commands to be displayed in the history or deleting a specific command from history

It's sometimes useful when using the linux command line to prevent things to go into the bash history; for example if you're using curl to download a file while providing your username password.This can be easily done in linux by configuring the HISTCONTROL variable in either your ~/.bashrc (which I recommend in order to have it permanently in your bash sessions) or by just changing the value for your current session. Either way either set the variable as follows on your ~/.bashrc or on your current session HISTCONTROL=ignorespace If you took the ~/.bashrc approach don't forget to source it to have i Once this is done commands that you start with a white space will be ignored : [root@myserver] curl -o strx25.tar.bz2 --user user:password note the whitespace before the curl commandRemoving a specific line from historyNow if you have to remove a specific line from history this is done in 2 steps Display commands…

OSX Wi-fi and Ethernet network simultaneously connected and static routing

So recently I had a situation where I had my Ethernet and Wifi connected to 2 different networks in my MAC OS X, and I had a very specific use case for this I needed to use the Ethernet connection to access 1 specific host (an internal web service), the connection through the ethernet cable allowed this but did not allow internet access, the Wifi connection allowed internet access but will not allow access to the internal web service, so basically what I needed was :Have both connections activeAccess the internal web service through the Ethernet connectionAccess all the other hosts through the Wi-fi connectionJust connecting both interfaces does not work I was either getting access to the internet or either access to the internal WebService; if you check this article over at apple OS X network interfaces priority you can see that you can change the priority used by the system to route the requests; so if you change the priority of the Wi-fi to be on top you get internet access but not…

Debug Java SSL/HTTPS WebService with man in the middle proxy

In this article I will be showing how to debug WebServices HTTPS/SSL requests by using a Man in the Middle proxy, this can especially be useful when dealing with WebServices errors since all request will go through the proxy we will be able to see all the content that is sent back and forwardThere are several proxies out there that support HTTPS/SSL queries but my favorite by far is mitmproxy and this is the one I will be showing in this post.The installation instructions detailed here for mitmproxy are for MacOSX but can easily be adapted to Linux distributions; please note that a lot of the instructions detailed here apply to Java applications1. Install mitmproxyPersonally I use home-brew for my package management; so I assume you have it installed (otherwise you'll have to install mitmproxy manually) Run the following command to install mitmproxy : brew install mitmproxy Your output should look something similar to this ==> Installing dependencies for mitmproxy: libpng, f…

Linux change timezone and force ntpd synchronization

This short article shows how to change the timezone of the Linux distribution as well as forcing the synchronisation of date/time with the ntpd serversThis applies specifically applies to CentOS so some changes might be possible depending on the distribution 1.Change timezone cp /etc/localtime /root/old.timezone rm /etc/localtime ln –s /usr/share/zoneinfo/Europe/Zurich /etc/localtime 2.Add ntpd servers to you configuration file (optional)Edit (or create) the /etc/ntpd.conf and add the appropriate ntpd servers : server server note: is the ip or domain name of the server 3.Stop the ntpd daemon /etc/init.d/ntpd stop 4.Force the date updateForce the update of the date with the new timezone and eventually the ntpd servers ntpdate 5.Stop the ntpd daemon /etc/init.d/ntpd start 6.Stop the ntpd daemon date

Install / build docker squash on OS X to reduce docker image size

Recently while I was trying to install a Docker related app called docker-squash on OSX El Capitan. For those who are not familiar with the utility; docker squash is a nice utility that reduces the size of docker images by removing the layers However when running the command go get I was getting the following error message : Building docker-squash export.go:19:2: cannot find package "" in any of: /usr/lib/go/src/pkg/ (from $GOROOT) /root/t/docker-squash/src/ Below I will show you how to build docker squash step by step (some steps can be omitted i.e. installing go if you already have installed) Install go and set-up variables brew install go mkdir $HOME/.go export GOPATH=$HOME/.go export PATH=$PATH:$GOPATH/bin Clone the docker squash repo I'm not sure this is required but clone the repo under ~/.go/src/…

Jaspersoft Studio OSX jdk 8/7 not starting

Recently I downloaded Jaspersoft studio on my Mac OSX but I was having trouble laughing the app as the system kept telling me I needed the older runtime version of Java, as you can see from the screenshot below (sorry in french) Luckily this is solved pretty easy head up to your Applications folder and right click on Jaspersoft then on the pop-up menu show package contents then inside the Contents folder you should find an info.plist file; edit the file and add the following line (or change the Current in the path with the JDK version you want) : -vm/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/javaSave the edited file; you should now be able to launch the software without problems